I am using iTextSharp and the reader.GetPageContent method to pull the text out of a PDF. I need to find the rectangle/position for each word found in the document. Is there any way to get the rectangle/position of a word in a PDF using iTextSharp?
A:
I'm also looking to get the absolute position of an image. I have added the Image like this
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream("pdffile.pdf", FileMode.Create)); document.Open(); iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance("vehicle.png"); img.ScaleAbsolute(80, 40); cell = new PdfPCell(new Phrase(new Chunk(img, 0, 0))); hTable.AddCell(cell); document.Add(hTable);
I then need to retrieve the position of the image to draw a circle near it. I do it like this.
PdfContentByte cb = writer.DirectContent; cb.SetLineWidth(1f); cb.Circle(img.AbsoluteX, img.AbsoluteY, 15f); cb.stroke();
but img.AbsolutX gives NaN.
Please let me know how to get the Absolute position of the image.
Gayathri
2010-06-17 18:44:51
Please ask a separate question or comment on the original question. This is not an answer.
NickAldwin
2010-06-17 19:01:44
sorry.. Will do that..
Gayathri
2010-07-06 15:55:25