Document
The PDF itself: its metadata, language, fallback fonts, PDF/A and encryption.
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 {}

| Prop | Type | Default | Description |
|---|---|---|---|
title | string | ||
author | string | ||
subject | string | ||
keywords | string | ||
creator | string | ||
producer | string | Inkoxide <version> | The PDF producer. |
lang | string | BCP-47 language of the document ("en-US"); also selects hyphenation patterns. | |
creationDate | string | RFC 3339 timestamp written to the PDF. Omit it for deterministic output. | |
pageMode | Meta['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'. | |
pageLayout | Meta['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. | |
fallbackFonts | string[] | ['NotoSans-Regular'] | Font ids tried for characters missing from a run's font, at most 256; an id listed again is skipped. |
debug | boolean | Outlines the boxes of every element on every page (debug on each <Page>). | |
conformance | Conformance | Write 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. | |
flattenAlpha | boolean | At 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. | |
userPassword | string | Encrypts 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. | |
ownerPassword | string | The password that lifts permissions. Default: the user password. | |
permissions | Permissions | What a reader without the owner password may do; needs an ownerPassword other than userPassword. | |
entropy | boolean | Uint8Array | Random 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. | |
tagged | boolean | Write 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. | |
pdfUA | boolean | PdfUaPart | Write 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. | |
attachments | readonly 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. | |
xmpExtensions | Meta['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.