Black Ice Software
October Developer News
Volume 12, Issue 10 - September, 2007
The BLACK ICE NEWSLETTER is published by Black Ice Software, LLC. The contents of this newsletter in its entirety are Copyright © 2007 by Black Ice Software, LLC. 292 Route 101, Salzburg Square, Amherst, NH 03031, USA. Black Ice Software, LLC. does hereby give permission to reproduce material contained in this newsletter, provided credit is given to the source, and a copy of the publication that the material appears in is sent to Black Ice Software at the above address. Phone: (603) 673-1019 Fax: (603) 672-4112 sales@blackice.com www.blackice.com

THREAD-BASED TEXT SEARCH IN PDF DOCUMENTS

 

New features have been added to the interface of the PDF Reader Library. The previous Text Search solution could search the text on the PDF document, but you could not stop the search during the process. This is not a problem in a non-interactive application, but it could be a problem if a user searches for text that doesn’t exist in a 1000-page document. Now, there is another tool for searching, the thread-based text search.

 

How to use this tool

 

You can start a thread for text searching by calling the StartTextSearchThread member function of a CPDF object. During text searching the thread sends messages at the following events:

Found text

End of the page

End of the text search

Finished the text search

In the client application you can get these messages with parameters (TextSearchInfo structure) and handle the events. The TextSearchInfo structure contains the following information:

“eventType”
(ET_ENDPAGE, ET_FOUNDTEXT, ET_ENDDOCUMENT, ET_FINISHED, ET_DEFAULT) that define the type of the event

“page”
that contains the current page during the text search

“pos”
that contains the position of the found text

“pPDF”
that is a pointer to the CPDF object that started the text search thread

The PDF Reader Demo Sample Application already uses this feature.

 

If any text is found the thread stops. If you want to continue searching, you can call one of the following functions:

“ContinueTextSearchThread”
continue the searching of the original text in the original direction

“ContinueTextSearchThreadForward”
continue forward the searching of the original text

“ContinueTextSearchThreadBackward”
continue backward the searching of the original text

 

One can stop the search by calling the StopTextSearchThread member function. It is used for example when the user wants to interrupt the process (the sample uses it when user clicks on the STOP button on the Text Searching dialog).

With this tool it is easy to develop an interactive text search in PDF documents.

For more information please read the PDF SDK online manual in the following place:

http://www.blackice.com/Help/Tools/PDF SDK webhelp/WebHelp/Black_Ice_PDF_SDK_Help.htm