LayerLast updated on
Last updated on
Rendering output specification for artifacts
A Layer defines how an artifact can be rendered into a specific format. Layers enable artifacts to have multiple output representations (PDF, HTML, Markdown, etc.).
type Layer = InlineLayer | FileLayerMIME types
The layer's mimeType selects its renderer.
| MIME type | Layer kind | Rendered by |
|---|---|---|
text/markdown, text/html, text/plain | inline or file | Built-in text renderer |
application/pdf | file | Built-in PDF renderer, using bindings |
application/vnd.openxmlformats-officedocument.wordprocessingml.document | file | Built-in DOCX renderer |
text/tsx, text/jsx | file only, forms only | A renderer you register, such as reactLayerRenderers() from @paradoc/react-pdf |
Any other MIME type needs a renderer passed in the renderers option of render(), keyed by MIME type.
A text/tsx or text/jsx layer names a React composition module by path, so it must be a file layer. An inline layer with either MIME type fails validation. The check ignores case, so TEXT/TSX is rejected too. Only a form can declare a React layer: a composition renders a form and its data, so a document or checklist with one fails validation.
Layer Types
InlineLayer
Inline layer with embedded text content. Used when content is stored directly in the artifact definition.
FileLayer
File-backed layer with external file reference. Used when content is stored in a separate file.
Bindings
Only a PDF file layer takes bindings and bindingsFrom. Each key of bindings is a fully qualified AcroForm field name, as paradoc inspect prints it, and each value is the Paradoc path that fills it, such as fields.name or parties.buyer.name. A text, Markdown, HTML or DOCX template names each value directly as {{fields.fieldName}}. Validation rejects bindings or bindingsFrom on any other layer.
{
"kind": "file",
"mimeType": "application/pdf",
"path": "w-9.pdf",
"bindings": {
"topmostSubform[0].Page1[0].f1_01[0]": "parties.taxpayer.name",
"topmostSubform[0].Page1[0].f1_02[0]": "fields.businessName"
}
}SignatureSlot
A signature slot declares one signing field on a layer. Each slot binds a party to a placement; the seal pipeline resolves every slot to concrete PDF coordinates.
type SignatureSlotPlacement =
| 'flow'
| { page: number; x: number; y: number; width: number; height: number }
| {
anchor: { text: string; offsetX?: number; offsetY?: number; occurrence?: number }
width: number
height: number
}signatures is the only place a layer declares signing fields. To update an
artifact from an older schema version that uses signatureBlocks or anchorBlocks, run paradoc migrate.
Examples
layers:
# Inline layer with markdown content
markdown:
kind: inline
mimeType: text/markdown
title: Markdown Version
text: |
# Welcome
This is the content of the document with {{ fields.name }} placeholder.
# File layer referencing external PDF
pdf:
kind: file
mimeType: application/pdf
path: /templates/contract.pdf
title: PDF Version
bindings:
client_name: clientName
contract_date: contractDate
# File layer pointing at a React composition module
composition:
kind: file
mimeType: text/tsx
path: ./contract.tsx
title: React Version