// 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); |