I try to develop an exe tu compare to pdf files. i need to get all differences between a master pdf and a generated one, like images or texts position and size, text content, and as much data as possibles.
here is my test with iTextSharp to try to get data that i need :
Document doc = new Document();
PdfReader reader = new PdfReader(@"C:\tmp\PDFFlattener\Input\Interior_30087_068x1XWX6516_M_210x297_FLA_68_1_5873301420.pdf");
for (int page = 1; page <= reader.NumberOfPages; page++)
{
var currentPage = reader.GetPageN(page);
PdfDictionary pageDico = currentPage.GetAsDict(PdfName.RESOURCES);
PdfDictionary objectDico = pageDico.GetAsDict(PdfName.XOBJECT);
foreach (var item in objectDico)
{
PdfName imgRef = item.Key;
PRStream stream = (PRStream)objectDico.GetAsStream(imgRef);
PdfName subType = stream.GetAsName(PdfName.SUBTYPE);
PdfName coords = stream.GetAsName(PdfName.COORDS);
PdfName width = stream.GetAsName(PdfName.WIDTH);
PdfName xyz = stream.GetAsName(PdfName.XYZ);
}
}
all PdfNames except SUBTYPE return a null value.
Is it possible to do get X and Y position of an xObject ? I've tryed with ABCPdf also, but i have the same result.
thanks for reading,