Text Box: Black Ice PDF-417 Barcode Reader
Text Box: Page #
Text Box: April Developer Newsletter
Text Box: Drag and drop in Thumbnail browser
Text Box: words in the text will follow the actual position of the words in the PDF file, not necessarily the seen location on the display, so in the case of certain PDF files, the returned text might not be the same as what you would expect.)

The following code snippet  shows the usage of the text search module in the PDF DLL. It sets case sensitivity to false, whole word search to true. It starts  searching for the word “Reference” from page 1. First, the code gets the text of the page where it found the word for the first time then it gets the region that covers the found text. After that it continues the search.

// set case sensitivity to false

pdf.SetCaseSensitivity(false);

// set whole word searchig to true

pdf.SetWholeWordSearch(true);

// search the "Reference" word from the 1st page

pdf.SearchText(1, "Reference");

// get the index (1-based) of the page where the search found the word

int pageIdx = pdf.GetPageIdxOfFoundText();

// get text of the page

char buffer[1024];

int requiredBufferSize;

if( !(requiredBufferSize = pdf.GetTextOfPage(buffer)) ){

        AfxMessageBox("Buffer is too small!");

}

// get the region that covers the found word

CClientDC dc(this);

CRgn rgn;

pdf.GetRegion(dc, rgn);

rgn.DeleteObject();

 

// search the second occurence of the "Reference" word

pdf.ContinueTextSearch();

pageIdx = pdf.GetPageIdxOfFoundText();

pdf.GetRegion(dc, rgn);