vcl-dxpdfviewer-dot-tdxpdfcustomviewer-3188a373.md
Enables you to track the search progress within the loaded PDF document.
property OnSearchProgress: TdxPDFDocumentTextSearchProgressEvent read; write;
Handle this event to track the search progress within the document accessible via the Sender parameter. The OnSearchProgress event is fired every time the PDF Viewer’s search engine begins processing a new document page. To identify the last processed page by its zero-based index, use the APageIndex parameter. The APercent parameter returns a percentage value calculated as the ratio between the number of processed pages and the Document.PageCount property value multiplied by 100.
The OnSearchProgress event is not raised if:
The search operation is restarted with identical search string and settings;
An end-user navigates between text string matches in the highlighted results mode by clicking the Previous or Next button on the Find panel or pressing the Enter/F3 key.
The APercent parameter value is particularly useful if you need to visualize the progress of a time-consuming text search operation by using a progress bar. The following code example displays the current search position via the TcxProgressBar component:
cxProgressBar1: TcxProgressBar; // The progress bar control
//...
TMyForm.dxPDFViewer1SearchProgress(Sender: TdxPDFDocument; APageIndex, APercent: Integer);
begin
cxProgressBar1.Position := APercent;
end;
TcxProgressBar *cxProgressBar1; // The progress bar control
//...
void __fastcall TMyForm::dxPDFViewer1SearchProgress(TdxPDFDocument* Sender, int APageIndex, int APercent)
{
cxProgressBar1->Position = APercent;
}
See Also