Error processing SSI file
LEADTOOLS Leadtools.Documents.UI (Leadtools.Documents.UI assembly)

Find Method

Show in webframe
Example 
Data that contains the text to find.
true to perform a "find" operation, otherwise, continues searching for either next or previous text.
true to perform a "find next" operation; otherwise, false to perform a "find previous" operation.
Performs a "find", "find next" or "find previous" search operation on the text of the document.
Syntax
 function Leadtools.Documents.UI.DocumentViewerText.find( 
   findText ,
   isFirst ,
   findNext 
)

Parameters

ParameterTypeDescription
findTextDocumentViewerFindTextData that contains the text to find.
isFirstbooltrue to perform a "find" operation, otherwise, continues searching for either next or previous text.
findNextbooltrue to perform a "find next" operation; otherwise, false to perform a "find previous" operation.

Return Value

TypeDescription
List A list of the text items found, or null if no next was found with this operation.
Remarks

Find and LastFindText are used together to perform "find", "find next" and "find previous" text search operations.

Typical applications that perform text search contain a menu item for "Find", "Find Next" and "Find Previous". The following explains how to use Find and LastFindText to perform these operations.

The LEADTOOLS Document Viewer demo uses the above to perform text search operations. Refer to the demo source code for a full example.

Calling Find required obtaining the text of the page(s) using DocumentPage.GetText, the viewer can automatically perform this when the value of AutoGetText is true.

Find performs the action of selecting text in the page or document by calling SetSelectedTextItems.

Example

Start with the example created in DocumentViewer, remove all the code in the Example function and add the code below.

When the user clicks the Example button, we will try to find the word "LEAD" in the current page, and continue with finding next occurance until we reach the end of the page.

var text = this._documentViewer.text;

// First check if we have text for this page
var pageNumber = this._documentViewer.currentPageNumber;
if (!text.hasDocumentPageText(pageNumber)) {
   // Get the text
   text.getDocumentPageText(pageNumber);
}

// Find the first occurance of the word "LEAD" ignoring the case
var findText = new lt.Documents.UI.DocumentViewerFindText();
// The text
findText.text = "LEAD";
// Ignore case
findText.matchCase = false;
// Any word that contains the phrase
findText.wholeWordsOnly = false;
// In this page only
findText.pageNumber = this._documentViewer.currentPageNumber;
findText.gotoNextPage = false;
// Do not go back to the beginning of the page
findText.recursive = false;
// Select the text if found
findText.autoSelect = true;
// Make sure we pan to it if the location is not in the current view
findText.autoEnsureVisible = true;

// Find it
if (text.find(findText, true, true) != null) {
   do {
      alert("Found");

      // Find next, using the same info so it continues from
      // last location
   } while (text.find(text.lastFindText, false, true) != null);
}

alert("Reached the end of the page");
See Also

Reference

DocumentViewerText Object
DocumentViewerText Members

Error processing SSI file
  Leadtools.Documents.UI requires a Document or Medical toolkit license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features