The rendering pipeline

Migrate, validate, configure, expand, bind, render. Package architecture in the DocStudio developer reference.

Targets

The HTML renderer takes an RDT and a target:

  • screen: designer canvas and host previews.
  • print: browser print fallback. Repeated header and footer through fixed positioning.
  • pdf: Chromium PDF. Header and footer as self-contained templates, page numbers through Chromium's page number classes.

Pagination

Pagination is Chromium's. The renderer emits @page size and margins, thead as a repeating table header group, break-inside and break-before/after from node settings, and orphans and widows defaults. Phase 0 gate G1 verifies the behaviour; Paged.js is the pre-evaluated fallback if the gate fails.

PDF service

The server module drives Playwright with one long-lived Chromium, a new context per job, a concurrency limit, a bounded queue, per-job timeouts and periodic recycling. The render page uses a restrictive Content Security Policy and request interception. Fonts are bundled and declared with @font-face; no system fonts are used. The service writes no files and does not log document content.

The pdf target passes the header and footer subtrees to Chromium as self-contained HTML templates with embedded fonts; every font family used there is also preloaded in the main document. The print target repeats header and footer content with an in-flow thead and tfoot and uses @page margin boxes for page numbers where supported. See ADR 0003.

Right to left

Direction is carried on page, section and node. The renderer uses logical CSS properties (margin-inline-start, text-align: start) and wraps bound values in <bdi>. Arabic and Urdu fonts are bundled; Naskh is the default Urdu font and Nastaliq is opt-in with a line-height of at least 2.0. The PDF text layer for Arabic script is lossy (visual order, presentation forms). See ADR 0004.

Parity

The designer preview and PDF use the same renderer, CSS and fonts. Parity means identical line breaks and block positions within one CSS pixel; regression compares PDF rasters from the same rasterizer. See ADR 0003.