tags:

views:

321

answers:

1

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
Please ask a separate question or comment on the original question. This is not an answer.
NickAldwin
sorry.. Will do that..
Gayathri