pdfrx_web
    Preparing search index...

    Function usePdfSearch

    • Full-text search over the document, with highlights painted by the viewer.

      There is one searcher per viewer — the provider owns it — so several components can call this hook and stay in sync. It is reset automatically when a different document is opened.

      Returns PdfSearch

      The current pdf search state and actions.

      const { query, setQuery, currentIndex, matchCount, goToNext } = usePdfSearch();
      return (
      <>
      <input value={query} onChange={(e) => setQuery(e.target.value)} />
      <span>{(currentIndex ?? -1) + 1} / {matchCount}</span>
      <button onClick={() => void goToNext()}>Next</button>
      </>
      );