Print Page | Close Window

Find a word in a PDF document and get X Y

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2636
Printed Date: 11 May 25 at 5:25PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Find a word in a PDF document and get X Y
Posted By: JMLM
Subject: Find a word in a PDF document and get X Y
Date Posted: 07 May 13 at 11:30AM
Hi,
Does it possible to find a specific word in a PDF and get it x y position ?
Thanks.
Jim



Replies:
Posted By: Ingo
Date Posted: 07 May 13 at 11:39AM
Hi Jim!
Yes. Use the text-extract functions with option 3 or 7.
You can extract the text page by page and word by word
with the position- and font-data in csv-format.
Cheers, Ingo


Posted By: JMLM
Date Posted: 08 May 13 at 9:08AM
Thanks Ingo, very interressant. 


Posted By: AndrewC
Date Posted: 08 May 13 at 1:48PM
The new TextBlocks functions will be a little easier to use as you do not need to parse the CSV string.  Here is an example bit of code using the DA functions.  QP.ExtractPageTextBlocks can be used with QP.LoadFromFile.

            int fh = QP.DAOpenFile("in.pdf", "");
            int ph = QP.DAFindPage(fh, 1);

            int textID = QP.DAExtractPageTextBlocks(fh, ph, 3);

            for (int i = 1; i <= QP.GetTextBlockCount(textID); i++)
            {
                string line = QP.GetTextBlockText(textID, i);

                OutputTxt.AppendText(line + "\n");
            }

            QP.ReleaseTextBlocks(textID);
            QP.DACloseFile(fh);

Andrew.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk