FindTextAsync examples?

153 views
Skip to first unread message

Andrew roden

unread,
Dec 23, 2013, 2:45:57 PM12/23/13
to pdfne...@googlegroups.com
Are there any examples of implementing the FindTextAsync in 6.1?

Aaron Gravesdale

unread,
Mar 12, 2014, 5:30:57 PM3/12/14
to
Hello Andrew,

Thank you for posting this question.  What you should do first is call SetFindTextHandler:

http://www.pdftron.com/pdfnet/PDFNetC/da/dca/classpdftron_1_1_p_d_f_1_1_p_d_f_view_ctrl.html#a73681f68b6ad7a98ab02d7faa64d8805

This takes in a FindTextAsyncHandler:

http://www.pdftron.com/pdfnet/PDFNetC/da/dca/classpdftron_1_1_p_d_f_1_1_p_d_f_view_ctrl.html#aad0f4972e7780f416e5c794eb02735ab

Then when you call FindTextAsync, that FindTextAsyncHandler delegate will be called:

http://www.pdftron.com/pdfnet/PDFNetC/da/dca/classpdftron_1_1_p_d_f_1_1_p_d_f_view_ctrl.html#a8e44e443d5b214cdb7ceeec5934606d3

For example, code to search for the string "and" and select the first result would look something like:


void  MyFindTextHandler(bool success, Selection select, void *custom_data)
{
    if (success)
    {
        PDF::PDFViewCtrl* view = (PDF::PDFViewCtrl*)custom_data;
        view->Select(select);
    }
}

...

PDF::PDFViewCtrl *view = ...
view->SetFindTextHandler(MyFindTextHandler, (void*)view);
view->FindTextAsync("and", false, false, false, false);



Reply all
Reply to author
Forward
0 new messages