Viscomsoft UWP PDF Viewer SDK

TextSearch.FindText Method

 

Searching the text start from specific page.
 
 C#

public void FindText(string text, int startPage, SearchDirection direction)

 


Parameter
text - the string of search text.

startPage - the start of page number.

direction - the search direction.

SearchDirection.SearchForward
SearchDirection.SearchBackward

Namespace: Viscomsoft.UWP.PDFViewerSDK;

No Return Value


Example

   

[C# Syntax] 
using Viscomsoft.UWP.PDFViewerSDK;
   
    DocumentFactory factory = new DocumentFactory();

    IDocument doc = factory.CreateDocument(file.Name);

    bool opened = await doc.OpenAsync(file);

   

    _pdfDisplayManager = new PDFDisplayManager();

    _pdfDisplayManager.Width = (int)Window.Current.Bounds.Width;

    _pdfDisplayManager.Height = (int)Window.Current.Bounds.Height;

    _pdfDisplayManager.Document = doc;

    _pdfDisplayManager.GotoPage(1);

    uiViewPanel.Child = createScrollViewControl();

    _pdfDisplayManager.TextSearch.TextNotFound += new EventHandler(TextSearch_TextNotFound);  

   _pdfDisplayManager.TextSearch.FindText("hello",1,SearchDirection.SearchForward);

async void TextSearch_TextNotFound(object sender, EventArgs e)
  {
   MessageDialog dlg = new MessageDialog("Text not found");
   dlg.ShowAsync();
  }