I have to insert a an image in a pdf. That is, wherever I see a text \'Signature\', I have to insert an signature image there . I can do by saying absolute positions . But
Check out PdfTextExtractor and specifically the LocationTextExtractionStrategy. Create a class in your project with the exact code for the LocationTextExtractionStrategy
and put a breakpoint on the line return sb.ToString();
(line 131 in SVN) and take a look at the contents of the variable locationalResult
. You'll see pretty much exactly what you're looking for, a collection of text with start and end locations. If your search word isn't on a line by itself you might have to dig a little deeper but this should point you in the right direction.