About Syncfusion Angular PDF Viewer Text Search

14 Aug 20261 minute to read

The Angular PDF Viewer provides an integrated text search experience that supports both interactive UI search and programmatic searches. Enable the feature by importing TextSearch and injecting it into the viewer services and by setting enableTextSearch as needed. To retrieve the bounding rectangles for each match occurrence, use the findText and findTextAsync methods.

The extractText API can be used to retrieve plain text from pages or structured text items with their positional bounds, allowing you to index document content, perform precise programmatic highlighting, map search results to coordinates, and create custom overlays or annotations; it can return full-page text or itemized fragments with bounding rectangles for each extracted element, enabling integration with search, analytics, and downstream processing workflows.

Key capabilities

  • Text search UI: real-time suggestions while typing, selectable suggestions from the popup, match-case and “match any word” options, and search navigation controls.
  • Text search programmatic APIs: mirror UI behavior with searchText, searchNext, searchPrevious, and cancelTextSearch; query match locations with findText and findTextAsync which return bounding rectangles for matches.
  • Text extraction: use extractText to retrieve page text and, optionally, positional bounds for extracted items (useful for indexing, custom highlighting, and annotations).
  • Text search events: respond to textSearchStart, textSearchHighlight, and textSearchComplete for UI sync, analytics, and custom overlays.

When to use which API

  • Use the toolbar/search panel for typical interactive searches and navigation.
  • Use searchText / searchNext / searchPrevious when driving search programmatically but keeping behavior consistent with the UI.
  • Use findText / findTextAsync when you need match coordinates (bounding rectangles) for a page or the whole document.
  • Use extractText when you need plain page text or structured text items with bounds.

Further reading