Reference
Document
Root of a PDF document: the paper, the margins and what the file says about itself.
Document(page_size: Enum, size: String, landscape: Bool, …) { … }
Before 5.0
page_size
A4
A3
A5
Letter
Legal
landscape
No preview for this one: the example below shows how it is written.
Example
Document(size: "A4", margin: 56, title: "Invoice INV-2041", author: "Northwind Ltd",
subject: "Invoice", keywords: "invoice, november", lang: "en") {
Header { Text("Northwind Ltd · Invoice INV-2041").muted.sm.right }
Footer { Text("Northwind Ltd · 12 Harbour Street · Bristol").muted.sm.center }
Heading("Invoice INV-2041").h1
Text("Issued 17 November 2026 · Due in 30 days").muted
Table(caption: "Items") {
Table.Head { Table.Row { Table.Cell("Item") Table.Cell("Amount") } }
Table.Body {
Table.Row { Table.Cell("Design review") Table.Cell("€1,200.00") }
Table.Row { Table.Cell("Hosting, November") Table.Cell("€90.00") }
}
}
Text("Total: €1,290.00").bold.right
}
Landscape Letter, by flag
Document(title: "Quarterly figures").Letter.landscape {
Heading("Quarterly figures").h1
}
Props
| Prop | Type | Unset | Meaning |
|---|---|---|---|
page_size: | one of its cases |
| The paper, as a case (also written
|
size: | String |
| The paper: |
landscape: | Bool | false | Turn the paper on its side, its longer edge across; |
margin: | Number or String | 72pt each | The page margins: one length, or two to four as CSS writes them ( |
title: | String | the page's | The file's title, shown by a reader in place of its name |
author: | String | none | The file's author; several separated by commas |
subject: | String | none | What the document is about: the file's description |
keywords: | String | none | Comma-separated keywords |
lang: | String |
| The document's language ( |
Attribute families: global, aria, data. Plus the 22 universal props every element takes: animate:, exit:, speed:, duration:, delay:, easing:, stagger:, on:, count:, shared:, class:, ref:, drag:, dragGroup:, dropValue:, dropAxis:, dropInside:, roving:, trapFocus:, mount:, update:, cleanup:.
Flags and cases
A flag is written after the parentheses with a dot: a Bool prop, or a case of one of the element's enum props. A case the enum lacks is an error with a hint.
.A4
.A3
.A5
.Letter
.Legal
.landscape
Events
Every element also takes the props, the events and the attribute families listed on every element.
Slots
children
Renders with the class wf-document, stable across releases, so a stylesheet may target it.
Codes this can raise
These controls list the props' cases; the example below shows them written.