sempdf
sempdf v1.9.1Interfaces

Interface: TemplateDocumentOptions

sempdf v1.9.1


sempdf / TemplateDocumentOptions

Defined in: src/types.ts:2369

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

Properties

PropertyTypeDescriptionDefined in
autoOutline?boolean | TemplateAutoOutlineOptionsWhen set, auto-generates a bookmarks/outline tree from heading blocks. true uses defaults (maxLevel=3, collapsed); pass an object to customise.src/types.ts:2442
background?(context) => readonly TemplateBlock[]Callback that returns master-page background blocks for each page (e.g. a full-bleed tint, rule, or logo). Rendered as a flow from the top content edge and drawn behind all other content. Tag background blocks as "Artifact" to keep them out of the reading order. For a centered text watermark prefer TemplateDocumentOptions.watermark.src/types.ts:2425
blocksreadonly TemplateBlock[]Child template blocks to render.src/types.ts:2379
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 } } });src/types.ts:2400
footer?(context) => readonly TemplateBlock[]Callback that returns footer blocks for each page.src/types.ts:2433
header?(context) => readonly TemplateBlock[]Callback that returns header blocks for each page.src/types.ts:2429
info?DocumentInfoDocument information dictionary values.src/types.ts:2373
page?TemplatePageOptionsPage.src/types.ts:2377
pageBackground?ColorInputFills every page with a solid background color, drawn behind all other content (including the watermark and background blocks). Emitted as an artifact so it stays out of the reading order.src/types.ts:2411
pageNumber?TemplatePageNumberOptionsOne-based page number currently being rendered.src/types.ts:2437
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.src/types.ts:2448
styles?TemplateStylesheetReusable named styles merged beneath each block's inline options. See TemplateStylesheet for the selector and cascade rules.src/types.ts:2405
title?stringDocument title applied to the information dictionary, structured XMP metadata, and display-title viewer preference.src/types.ts:2371
watermark?string | TemplateWatermarkOptionsA diagonal watermark drawn centered behind every page's content (e.g. "DRAFT", "CONFIDENTIAL"). Pass a string for defaults, or an options object to control size, color, opacity, and rotation. Always tagged as an artifact.src/types.ts:2417
xmpMetadata?XmpMetadataInputXMP metadata packet or structured XMP metadata input.src/types.ts:2375

On this page