Links, outline & metadata
Clickable hyperlinks, bookmarks, and document properties.
Hyperlinks
Anchors with an href become clickable link annotations. They appear on every page that their box touches:
<>
Pay online at < ="https://example.com/pay/1042">example.com/pay/1042</>.
</>,
Inline anchors annotate each text run. A link that wraps across lines stays clickable on both lines. Block-level anchors annotate their entire box.
Outline
Set outline: true to build PDF bookmarks from h1–h6 headings. Deeper headings nest under the previous shallower heading. This matches an HTML document outline:
const = await (, { : true });Clicking a bookmark jumps to the page and position of its heading.
Document metadata
metadata fills the PDF document properties. lang also sets the metadata language:
const = await (, {
: "en",
: {
: "Annual report 2026",
: "Consolidated results for fiscal year 2026",
: ["Acme Inc."],
: ["annual report", "2026"],
: "acme-reporting",
},
});All fields are optional. Omitting metadata writes no document properties. This keeps output byte-identical across runs for golden testing.
Last updated on