vpdf_BeginSearch(hVPDF As Long, szSearchText As String, dwPageNumber As Integer) as Boolean
Description
Begins a text search for the specified text on the specified page. Please see the code sample below for usage.
Parameters
Long |
hVPDF |
Handle to the Vector PDF object. |
String |
szSearchText |
The text to search for. |
Integer |
dwPageNumber |
0-based index of the page to search on. |
Return value
TRUE on success, otherwise FALSE.
Code sample
// Open the PDF file.
long hVPDF = BiPDF.vpdf_OpenVectorPDFFile(szFileName, szPassword, 0);
int nPages = BiPDF.vpdf_GetNumberOfPages(hVPDF);
// Iterate through all pages.
for (int iPage = 0; iPage < nPages; iPage++)
{
// Retrieve the page size in Points (1/72 inches)
double dWidth = 0.0, dHeight = 0.0;
BiPDF.vpdf_GetPageSize(hVPDF, iPage, ref dWidth, ref dHeight);
// Start the search on the page.
BiPDF.vpdf_BeginSearch(hVPDF, szSearchPhrase, iPage);
// Iterate through all search results.
while (BiPDF.vpdf_GetNextSearchResult(hVPDF))
{
// One search result may consist of multiple rectangles,
// iterate through the rectangles.
int nRect = BiPDF.vpdf_GetSearchResultRectangleCount(hVPDF);
for (int iRect = 0; iRect < nRect; iRect++)
{
double dLeft=0.0, dTop=0.0, dRight=0.0, dBottom=0.0;
if (BiPDF.vpdf_GetSearchResultRectangle(hVPDF, iRect,
ref dLeft, ref dTop, ref dRight, ref dBottom))
{
// Process the results.
// Coordinates are in Points (1/72 inches),
// relative to the bottom left corner of the page.
...
}
}
}
// Finish the search
BiPDF.vpdf_EndSearch(hVPDF);
}
// Close the file.
BiPDF.vpdf_CloseVectorPDF(hVPDF);