ZitePdf.renderHtml from a backend workflow and you get back a permanent hosted URL to store, email, or return to the frontend.
Worked example: an invoice
renderHtml returns { url, filename }, where url is a permanent, public HTTPS download link.
HTML authoring rules
- One self-contained document.
<!doctype html>, a<head>, one<style>block. Avoid external<link>s (CSS / font CDNs); they time out in headless Chromium. - Set page size and margins at the top of the stylesheet:
@page { size: letter; margin: 0.75in; }(size: a4only for metric paper). - Escape user input and coerce numbers (
Number.isFinite(...) ? … : 0) before.toFixed(). - Variable-length sections.
array.map(...)returning row HTML strings,.join('')into the table body. font-variant-numeric: tabular-numson tables of numbers so columns align.
Constraints
- Max output 25 MB. Paginate with
@pageor split large reports. - No JS execution in the rendered HTML. Keep everything static.
- No private-network URLs (RFC1918 /
file:/// metadata IPs). The renderer refuses them.