pdfrx_web
    Preparing search index...

    Function usePdfOutline

    • The document's outline (bookmarks), reloaded whenever the document changes.

      viewer.loadOutline() does not cache its result: it reads the worker's physical outline, or returns the document's staged logical outline when one is pending. This hook holds the result for you. Activate a node with usePdfNavigation().goToDest(node.dest).

      Returns PdfOutlineState

      The current pdf outline state and actions.

      const { outline, isLoading } = usePdfOutline();
      const { goToDest } = usePdfNavigation();
      if (isLoading) return <p>Loading…</p>;
      return outline?.map((n) => <button key={n.title} onClick={() => goToDest(n.dest)}>{n.title}</button>);