FlowTemplate
Defined in: packages/sdk/src/builder.ts:342
A laminapdf.document/1 template: a FlowDocument, with the same keys, in which a value
can be a placeholder that Builder.flow fills from options.data.
{ $data: "/invoice/number" }takes a value from the data, by JSON Pointer.{ $each: "/items", do: … }, in a list, addsdoonce per item of a list in the data; inside it,{ $item: "/name" }takes a value from the current item.{ $if: "/paid", do: … }, in a list, addsdoonly when the value is there and isn’tfalseornull.
Placeholders nest. type, schema and profiles take none: profiles is read before filling,
for new Builder({ profiles }).
Example
Section titled “Example”const template: FlowTemplate = { schema: "laminapdf.document/1", styles: { body: { font: "Helvetica", size: 11 } }, blocks: [ { type: "heading", level: 1, text: { $data: "/title" } }, { $each: "/lines", do: { type: "paragraph", text: { $item: "/text" } } }, ],};const data = { title: "Invoice 42", lines: [{ text: "Paper, 2 reams" }] };builder.flow(template, { data });0.2.0