Skip to main content

Interface: TemplateDocumentOptions

Top-level options for rendering template blocks into a complete document.

Properties

PropertyTypeDescription
autoOutline?boolean | TemplateAutoOutlineOptionsWhen set, auto-generates a bookmarks/outline tree from heading blocks. true uses defaults (maxLevel=3, collapsed); pass an object to customise.
blocksreadonly TemplateBlock[]Child template blocks to render.
fonts?Record<string, FontFamilyInput>Named font families to register before rendering. Keys are family names; values are the faces that make up each family. Each face may be a built-in FontName, a handle from PdfDocument.embedTrueTypeFont, or raw TrueType/OpenType bytes (embedded automatically under the family name). Registered families are available by name in template blocks, styles, and the defaultFont option. doc.renderTemplate({ blocks: [...], fonts: { Inter: { regular: interRegularBytes, bold: interBoldBytes } } });
footer?(context) => readonly TemplateBlock[]Callback that returns footer blocks for each page.
header?(context) => readonly TemplateBlock[]Callback that returns header blocks for each page.
info?DocumentInfoDocument information dictionary values.
page?TemplatePageOptionsPage.
pageNumber?TemplatePageNumberOptionsOne-based page number currently being rendered.
strictLayout?boolean | TemplateStrictLayoutOptionsEnables strict layout checks for fixed templates. When true, oversized content that would overflow a fresh page/column throws instead of being force-placed.
styles?TemplateStylesheetReusable named styles merged beneath each block's inline options. See TemplateStylesheet for the selector and cascade rules.
title?stringDocument title applied to the information dictionary, structured XMP metadata, and display-title viewer preference.
xmpMetadata?XmpMetadataInputXMP metadata packet or structured XMP metadata input.