docstudio/render

Resolved tree to HTML and CSS. API reference in the DocStudio developer reference.

The renderer turns a resolved document tree into HTML and CSS. It is pure and synchronous, uses no DOM or Node API and is byte-deterministic.

import { render } from 'docstudio/render';

Targets

Target Output
screen One sheet with the header and footer inside, for the screen
print A document with @page rules and repeated header and footer for browser printing
pdf The body document plus header and footer templates for the PDF service (result.pdf)

Safety

All text and attributes are escaped, styles are emitted as classes (never inline) and only whitelisted properties are serialized. Images become data: URIs or allowed https addresses. See Security.

Reference

The sections below are generated from the exported source. Detailed behavior: Renderer.