SDK Samples

Linked Exhibits

Navigate a set of related documents through link annotations. Pick a document from the list, then click any highlighted cross-reference inside it to open that document in the same viewer.

How this works

A contract cites its exhibits, and each exhibit cites the contract. This sample turns those citations into working navigation. On load it runs instance.search() for each other document's reference phrase and creates a LinkAnnotation carrying a URIAction over every match — using the search rects, so nothing is pinned to hardcoded coordinates.

Clicking one fires annotations.press. The handler calls preventDefault(), matches the URI's filename against an allow-list of the four documents, and swaps the document in place. That allow-list matters: the URI selects a manifest entry and is never fetched directly.

Links can target a specific page. Each link URI carries a #page= fragment — the open parameter the SDK defines for the URL of a page hosting the viewer. Rather than re-implement that format, the sample hands the fragment to the SDK's own viewStateFromOpenParameters() and passes the result as initialViewState. So the citation to “Exhibit B” opens the fee schedule at page 1, while “Section B.1” opens the same document at the rate card on page 2. Note the numbering difference: #page= is 1-based, while currentPageIndex is 0-based, and an out-of-range page falls back to page 1 rather than failing.

Two details worth knowing. The SDK renders a link annotation as a real <a target="_blank"> anchor, so without interception a click would open the raw PDF in a new tab and leave the viewer behind; preventDefault() is what suppresses that, and the configuration sets onOpenURI: () => false as a backstop. And the PDF action built for exactly this purpose, GoToRemoteAction, is documented by the SDK as “not implemented yet” — so a URI action plus interception is the working approach today.

Loading document viewer...