Skip to content
Inkoxide

Search covers every page and heading of the docs. Use ↑ ↓ and ↵.

Links, bookmarks and metadata

Edit this page

The code on this page is React’s. How Vue writes it
ReactVue
ClassesclassName="p-4"class="p-4"
PropsheaderRows={1}:header-rows="1" or :headerRows="1"
A prop that is truehyphenatehyphenate
Content per pagerender={({ pageNumber }) => …}<template #render="{ pageNumber, totalPages }">…</template>
The page, deeper downusePage()usePage() (it injects the page)
What to render<Invoice invoice={invoice} />h(Invoice, { invoice })
A template for generateTemplate: ComponentType<{ data }>Template: a component with the prop data

The rest, and Vue’s own API, is in the Vue guide.

The code on this page is React’s. How Svelte writes it
ReactSvelte
ClassesclassName="p-4"class="p-4" (a list or an object of flags too)
Content per pagerender={({ pageNumber }) => …}{#snippet render(page)}{page.pageNumber}{/snippet} inside the Text or View
The page, deeper downusePage()usePage(), while the component is created
What to render<Invoice invoice={invoice} />{ component: Invoice, props: { invoice } }
A template for generateTemplate: ComponentType<{ data }>Template: a component with the prop data

The rest, and Svelte’s own API, is in the Svelte guide.

The code on this page is React’s. How Angular writes it
ReactAngular
Components<View>, <Path>, <TextField><ink-view>, <ink-path>, <ink-text-field>: ink- and the name in kebab case
ClassesclassName="p-4"class="p-4", [class]="…"
PropsheaderRows={1}, size="A4"[headerRows]="1", size="A4" (an attribute is a string: bind numbers)
A prop that is truehyphenatehyphenate
Stylestyle={{ padding: 20 }}[style]="{ padding: 20 }"; [inkStyle] for @media blocks and lists of styles
Content per pagerender={({ pageNumber }) => …}[render]="footer" with <ng-template #footer let-page>{{ page.pageNumber }}</ng-template>
The page, deeper downusePage()injectPage()
What to render<Invoice invoice={invoice} />{ component: Invoice, inputs: { invoice } }
A template for generateTemplate: ComponentType<{ data }>Template: a component with the input data

The rest, and Angular’s own API, is in the Angular guide.

<Document title="Annual report" author="ACME" lang="en-US">
  <Page>
    <Text href="#results" className="text-blue-700 underline">Jump to results</Text>
    <Text href="https://example.com">Website</Text>
    <Text>
      Read the <Link href="https://example.com/terms" className="underline">terms</Link>.
    </Text>
    <Text id="results" bookmark="Results" className="text-xl font-bold">Results</Text>
    <Text bookmark={{ title: 'Revenue', level: 2 }}>Revenue</Text>
  </Page>
</Document>

href on a Text or View makes the whole element a link, and <Link> does the same as a component: inside a Text it is a linked run, elsewhere a box like a View. A link takes the style it is given and adds no colour or underline of its own. href="#id" jumps to the element with that id.

Bookmarks become the PDF outline in the viewer's sidebar. A bookmark is a title, or { title, level, expanded, zoom }: level nests it under the nearest earlier bookmark of a lower level (default 1), expanded: false starts it closed, its children hidden until it is opened, and zoom is how the viewer shows the element. By default the viewer goes to the element's top-left corner and keeps its zoom; a number is a scale (1.5 is 150%, at most 64), 'page' fits the whole page and 'width' the page's width, from the element's top:

<Text bookmark={{ title: 'Appendix', expanded: false }}>Appendix</Text>
<Image src={chart} bookmark={{ title: 'Chart', level: 2, zoom: 'page' }} />

Table of contents

<PageRef to="#id" /> shows the number of the page the element with that id starts on, so a table of contents is a list of links, each with the page of what it links to:

const sections = [
  { id: 'summary', title: 'Summary' },
  { id: 'results', title: 'Results' },
  { id: 'outlook', title: 'Outlook' },
];

<View role="toc" className="gap-1">
  {sections.map((s) => (
    <Link key={s.id} role="tocItem" href={`#${s.id}`}>
      <Text>
        {s.title}
        <Leader />
        <PageRef to={`#${s.id}`} />
      </Text>
    </Link>
  ))}
</View>
<PageBreak />
{sections.map((s) => (
  <Text key={s.id} id={s.id} bookmark={s.title} role="h1" className="text-xl font-bold">
    {s.title}
  </Text>
))}

<Leader /> fills the room the line has left with dots, so the number ends at the right edge. It repeats its pattern ('. ' by default; '.', '_' or ' ·' are others, of 1 to 8 characters) in the font, size and colour of the Text around it. The patterns are whole and on a grid from the right edge of the line, so the dots of every entry line up. A leader takes no room when the lines are broken and stays on the line of what follows it: a title too long for one line wraps, and the dots and the number end its last line. In a Text only as wide as its words (in a flex-row, say) there is no room to fill; give it flex-1 or a width. Several leaders on a line share the room, so left<Leader pattern=" " />right sets two words at the two edges.

PageRef works in any Text ("see page <PageRef to="#results" />"), takes the style of the text around it, and names an element as a #id link does: an id no element of the page body has is an error (UNKNOWN_ANCHOR). The table of contents may come before or after what it lists, and may itself push the sections to later pages: the numbers are the ones of the finished document. In text painted on every page (a fixed element, a table's header rows) a PageRef keeps the room of three digits, as PageNumber does there.

Document writes title, author, subject, keywords, creator (the application that made the file) and producer (the software that wrote the PDF, by default Inkoxide <version>) into the PDF's properties. creationDate (an RFC 3339 timestamp, "2026-10-12T09:30:00Z") dates it, as the creationDate option does; without either, the same input gives byte-identical output.

pageMode and pageLayout say how the viewer opens the PDF:

<Document pageMode="useThumbs" pageLayout="twoPageRight">…</Document>

pageMode is 'useNone' (no side panel), 'useOutlines' (the bookmarks), 'useThumbs' (page thumbnails) or 'fullScreen'. The default shows the bookmarks when there are any. pageLayout is 'singlePage', 'oneColumn' (continuous scrolling), 'twoColumnLeft' or 'twoColumnRight' (two scrolling columns, odd pages on the left or right), or 'twoPageLeft' or 'twoPageRight' (two pages at a time); without it, the viewer uses its own setting.

fallbackFonts lists the fonts tried, in order, for characters a run's font lacks. The default is ['NotoSans-Regular']. The entries are font ids: the bundled Inter-Regular, Inter-Italic, Inter-Bold, InterDisplay-Bold, NotoSans-Regular and RobotoMono-Regular, or a face added with Font.register, whose id is its family with spaces as hyphens, its weight (or a variable face's range, Inter-Var-100-900), its width when not 100% (-75%, or a range, -75-100%), and -italic for an italic face:

Font.register({ family: 'Noto Sans Arabic', src: './fonts/NotoSansArabic-Regular.ttf' });

<Document fallbackFonts={['NotoSans-Regular', 'Noto-Sans-Arabic-400']}>…</Document>

An id that is not registered is skipped, and fallbackFonts={[]} turns the fallback off.

PDF/A

conformance makes the file PDF/A, for archiving, and so does the pdfA render option, which wins over it:

<Document title="Invoice 2026-0815" conformance="PDF/A-2b">…</Document>
conformancepdfAWrites
'PDF/A-2b' or 'PDF/A-2'true or '2b'PDF/A-2b
'PDF/A-3b' or 'PDF/A-3''3b'PDF/A-3b, as 2b, with attachments (an e-invoice's XML)
'PDF/A-1b' or 'PDF/A-1''1b'PDF/A-1b, the oldest level, for archives that require it
'PDF/A-2a''2a'PDF/A-2a: 2b, tagged (accessible)
'PDF/A-3a''3a'PDF/A-3a: 3b, tagged, with attachments

PDF/A-1b has no transparency, so a render fails with ENGINE_REJECTED (engineCode PDFA_CONFLICT) and the component at fault for a colour with alpha below 1 (a transparent background is fine: it draws nothing), an opacity between 0 and 1, an image with partial alpha such as most PNG logos, an SVG drawn with opacity, a mask or a blend mode, or debug. PDF/A-2b and 3b allow all of these. An image whose alpha is only clear or opaque, such as a GIF's, is drawn with a stencil mask, which PDF/A-1b allows. flattenAlpha (a <Document> prop and a render option, which wins over it) draws images with partial alpha on white instead:

<Document conformance="PDF/A-1b" flattenAlpha>…</Document>

A flattened image is opaque: on a coloured background it shows a white box where it was transparent. The u levels ('PDF/A-2u') and PDF/A-1a are not supported: they fail with TEMPLATE_ERROR.

conformance and flattenAlpha are not part of the document tree: to render a stored result.document again at the same level, pass pdfA (and flattenAlpha) to renderDocument, from @inkoxide/react/templates.

Passwords and permissions

userPassword encrypts the PDF (AES-256, which Acrobat X and later, pdf.js, Chrome and Preview open): the file opens only with that password. ownerPassword lifts permissions, what a reader without it may do:

<Document
  userPassword="open-sesame"
  ownerPassword={process.env.PDF_OWNER_PASSWORD}
  permissions={{ printing: 'highResolution', copying: false }}
>
  …
</Document>
PermissionDefaultAllows
printingnot allowed'lowResolution' or 'highResolution' printing
modifyingfalsechanges other than annotations and form fields
copyingfalsecopying text and images
annotatingfalseadding annotations and filling in fields
fillingFormsfalsefilling in fields
contentAccessibilitytrueextracting text for screen readers
documentAssemblyfalseinserting, rotating and deleting pages
  • A password is any text SASLprep (RFC 4013) accepts, as PDF 2.0 asks: letters of any script, but no control or private-use characters, and not right-to-left and left-to-right letters together. Once prepared, it is at most 127 bytes of UTF-8. With only ownerPassword, anyone opens the file and the permissions apply; with only userPassword, it is also the owner password, so permissions need an ownerPassword other than userPassword.
  • The encryption render option ({ userPassword, ownerPassword, permissions, entropy }) replaces the four props as a whole, for passwords that come from the request rather than the template.
  • Encryption and PDF/A do not go together: PDF/A forbids encryption.
  • A bad value fails with ENGINE_REJECTED at its path (options.encryption.userPassword, …). No error shows a password, and the passwords are not part of result.document or of the tree's JSON.
  • Readers enforce the permissions; the file cannot. Encryption hides the text and images, not the page count or sizes. Field values are hidden, but not which checkboxes are checked, nor the positions of the chosen radio button and list box options.
  • The same document and passwords give the same bytes, as unencrypted output does, so whoever can have a document of their choosing encrypted with your password can tell whether another file is the same document. entropy (<Document entropy> or encryption.entropy) mixes random bytes into the keys so that each render differs: true draws 32 for each render, or pass 16 to 256 bytes of your own.

Synced from packages/react/GUIDE.md in the inkoxide repository.