Documentation
Headers & Footers
Dynamic page header and footer injection.
Headers and footers in PaperCast are special nodes that exist outside the main flow of the document AST, but are injected dynamically onto every page during the rendering phase.
Schema Definition
In the root DocumentSchema, headers and footers are stored in dictionaries:
{
"headers": {
"main-header": {
"condition": "all",
"node": {
"type": "row",
"children": [/* ... */]
}
},
"first-page-header": {
"condition": "first",
"node": {
"type": "text",
"content": "Cover Page Header"
}
}
},
"headerDefaultId": "main-header"
}
Injection via DocumentPreview
When PaginationEngine.ts spits out PageData[], each page object contains a headerId and footerId (resolved by resolver.ts).
The DocumentPreview.tsx component then looks up those IDs in the root document dictionary and renders them above and below the main bodyNodes for that specific page.
Fixed Heights
Because headers and footers take up physical space on the printed page, their
height is subtracted from the availableHeight when paginating the main body
content.