Hello,

I'm creating a C# console app that goes through a template pdf containing
tags. These tags need to be replaced by images. The problem I have now is
that I need to know the position of the tag in question so that I can tell
my image where it should go.
I've gone through the PrintTextLocations example but I just can't seem to
figure out where the actual position extracting happens. What i'm trying to
do right now is this:

                //load the document we want to convert and extract its list
of pages.
                PDDocument doc = PDDocument.load(docToParse);
                java.util.List pagelist =
doc.getDocumentCatalog().getAllPages();

                //start a text stripper and start going through the text on
the pages one page at the time.
                PDPage page = new PDPage();

                for(int i = 0; i<pagelist.size(); i++)
                {
                    page = (PDPage)pagelist.get(i);

                    //pseudo code
                    /* foreach(string line in page.textLines())
                     * {
                     *      if(line.Contains(tag))
                     *      {
                     *          insertImage(img.jpg, line.position);
                     *          removeLine();
                     *      }
                     * }
                     **/
                }

Can anyone tell me what I need to do to get this to work? I've been trying
to tear down this brickwall with my forehead for too long now :P.
Thx

Reply via email to