Navigator can find the text, but not Find function

3 posts, 0 answers
  1. Sean
    Sean avatar
    2 posts
    Member since:
    Dec 2014

    Posted 19 Jan 2016 Link to this post


    I am attempting to search a loaded PDF document for a specific bit of text which can be located via the navigator controls but the PdfViewerElement.Find isn't able to find it.

     I have included my code below which I got from the online documentation and you can see the pdf I am searching at this address

     Is there something I am doing wrong in my code that the PDFNavigators search function can locate text but mine cannot?


    Thank you!

    Private Sub RadForm1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim opt As New Telerik.Windows.Pdf.Documents.Fixed.Search.TextSearchOptions
        opt.CaseSensitive = False
        opt.WholeWordsOnly = False
        Dim res As Telerik.Windows.Pdf.Documents.Fixed.Search.SearchResult = DaViewer.PdfViewerElement.Find("Allen", opt)
        If res Is Telerik.Windows.Pdf.Documents.Fixed.Search.SearchResult.NotFound Then
            RadMessageBox.Show("String not found")
            RadMessageBox.Show("Result found on page " & res.Range.StartPosition.Page.PageNo)
        End If
    End Sub

  2. Sean
    Sean avatar
    2 posts
    Member since:
    Dec 2014

    Posted 19 Jan 2016 Link to this post

    Nevermind,  I forgot to wait for the document to load fully.  After it was loaded everything worked just find.  
  3. Hristo
    Hristo avatar
    1522 posts

    Posted 20 Jan 2016 Link to this post

    Hi Sean,

    Thank you for writing.

    I am glad that you have resolved the issue. The process of loading a document in RadPdfViewer is an asynchronous operation which varies in time for the different documents. 

    Before we perform any manipulation, we should make sure that the document has been loaded successfully. RadPdfViewer exposes the DocumentLoaded event for this kind of notification:

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Hristo Merdjanov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top