Skip to content
Inkoxide

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

Document

The PDF itself: its metadata, language, fallback fonts, PDF/A and encryption.

Edit this page

Import them from @inkoxide/react, @inkoxide/vue or @inkoxide/svelte; an Angular template writes them as <ink-document>. Examples, and how these components work together, are in the guide.

Document

The PDF: title, author, subject, keywords, creator, producer, lang ("en-US"), creationDate, pageMode, pageLayout and fallbackFonts (metadata); conformance and flattenAlpha (PDF/A), userPassword, ownerPassword, permissions and entropy (passwords), tagged and pdfUA (accessibility), attachments and xmpExtensions (attachments).

import { Document, Page, Text } from '@inkoxide/react';

export default function Example() {
  return (
    <Document title="Quarterly report" author="Ada Lovelace" lang="en-US">
      <Page size={[320, 140]} className="p-6">
        <Text className="text-lg font-bold">Quarterly report</Text>
        <Text className="mt-1 text-gray-500">Its title, author and language are in the file’s properties.</Text>
      </Page>
    </Document>
  );
}
<script setup lang="ts">
import { Document, Page, Text } from '@inkoxide/vue';
</script>

<template>
  <Document title="Quarterly report" author="Ada Lovelace" lang="en-US">
    <Page :size="[320, 140]" class="p-6">
      <Text class="text-lg font-bold">Quarterly report</Text>
      <Text class="mt-1 text-gray-500">Its title, author and language are in the file’s properties.</Text>
    </Page>
  </Document>
</template>
<script lang="ts">
  import { Document, Page, Text } from '@inkoxide/svelte';
</script>

<Document title="Quarterly report" author="Ada Lovelace" lang="en-US">
  <Page size={[320, 140]} class="p-6">
    <Text class="text-lg font-bold">Quarterly report</Text>
    <Text class="mt-1 text-gray-500">Its title, author and language are in the file’s properties.</Text>
  </Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';

@Component({
  selector: 'app-example',
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  template: `
    <ink-document title="Quarterly report" author="Ada Lovelace" lang="en-US">
      <ink-page [size]="[320, 140]" class="p-6">
        <ink-text class="text-lg font-bold">Quarterly report</ink-text>
        <ink-text class="mt-1 text-gray-500">Its title, author and language are in the file’s properties.</ink-text>
      </ink-page>
    </ink-document>
  `,
})
export class Example {}
The PDF this example renders.
PropTypeDefaultDescription
titlestring
authorstring
subjectstring
keywordsstring
creatorstring
producerstringInkoxide <version>The PDF producer.
langstringBCP-47 language of the document ("en-US"); also selects hyphenation patterns.
creationDatestringRFC 3339 timestamp written to the PDF. Omit it for deterministic output.
pageModeMeta['pageMode']What the viewer shows when it opens the PDF: no panel, the bookmarks, page thumbnails or the pages full screen. Default: 'useOutlines' when there are bookmarks, else 'useNone'.
pageLayoutMeta['pageLayout']How the viewer lays out the pages: one at a time, one scrolling column, two columns or two pages side by side (odd pages on the left or the right). Default: the viewer's setting.
fallbackFontsstring[]['NotoSans-Regular']Font ids tried for characters missing from a run's font, at most 256; an id listed again is skipped.
debugbooleanOutlines the boxes of every element on every page (debug on each <Page>).
conformanceConformanceWrite PDF/A, for archiving: 'PDF/A-2b' (or 'PDF/A-2'), 'PDF/A-3b', 'PDF/A-1b', or 'PDF/A-2a' and 'PDF/A-3a', which are tagged. PDF/A-1b has no transparency: a render fails with PDFA_CONFLICT at the first colour with alpha, opacity, image with partial alpha (see flattenAlpha) or debug outline; an image whose alpha is only clear or opaque, such as a GIF's, is drawn with a stencil mask. The render option pdfA wins over this prop. Default: plain PDF.
flattenAlphabooleanAt PDF/A-1b, draw images whose alpha is partial on white instead of failing with PDFA_CONFLICT. Other levels and plain PDF keep the alpha. The render option flattenAlpha wins over this prop.
userPasswordstringEncrypts the PDF (AES-256): the password that opens it. Any text SASLprep (RFC 4013) accepts, at most 127 bytes of UTF-8 once prepared. Not part of the document tree, and never in the render result. The render option encryption replaces these four props.
ownerPasswordstringThe password that lifts permissions. Default: the user password.
permissionsPermissionsWhat a reader without the owner password may do; needs an ownerPassword other than userPassword.
entropyboolean | Uint8ArrayRandom bytes (16 to 256) mixed into the encryption keys, so each render of the same document gets other keys; true: 32 drawn for each render. Default: none, and the same document and passwords give the same file.
taggedbooleanWrite tagged PDF: a structure tree with the reading order (the order of the template) and what each element is (headings, paragraphs, figures with their alt, tables, lists), for screen readers and reflow. pdfUA and 'PDF/A-2a' or 'PDF/A-3a' imply it.
pdfUAboolean | PdfUaPartWrite PDF/UA, the standard for accessible PDF: tagged, with a title, a lang, alt on every image that is not decoration and label on every field; without them the render fails with UA_CONFLICT. true or '1' writes PDF/UA-1, on PDF 1.7; '2' writes PDF/UA-2, on PDF 2.0, which does not combine with conformance.
attachmentsreadonly AttachmentFile[]Files the PDF carries, listed in the viewer's attachments panel; <Attachment file> shows an icon that opens one. Under PDF/A, only 'PDF/A-3b' and 'PDF/A-3a' allow them.
xmpExtensionsMeta['xmpExtensions']XMP schemas the PDF/A metadata declares and fills in, such as facturX()'s for an e-invoice. Needs PDF/A: conformance, or the render option pdfA.

Synced from components/document.md in the inkoxide repository.