HTML & SVG Rendering
phpdftk ships a full HTML/CSS rendering engine targeting browser print-stylesheet parity, plus an SVG-to-PDF translator. Both consume a shared CSS + text-shaping substrate.
This section documents:
- HTML to PDF — render HTML + CSS to PDF
- SVG to PDF — render SVG to PDF
phpdftk/css— CSS Syntax 3 / Values 4 / Selectors 4 / Cascade 5 implementationphpdftk/text— UAX #14 line breaking, UAX #9 bidi, OpenType shapingphpdftk/html— WHATWG HTML5 parser with DOMphpdftk/svg— SVG 2 parser
Status
Section titled “Status”Phase 1 of the rendering roadmap is in development. See the roadmap for the current sub-phase status.
What’s in scope
Section titled “What’s in scope”- CSS 2.1 visual formatting (block-and-inline, tables, lists)
- CSS Paged Media 3 (
@page, page boxes, named pages, margin boxes) - CSS Fragmentation 4 (
break-before/after/inside, orphans/widows) - CSS Multi-column Layout 1
- CSS Flexible Box Layout 1
- CSS Grid Layout 2
- CSS Transforms 2 (2D; 3D flattened to 2D)
- Filter Effects 1 (raster filters)
- CSS Custom Properties for Cascading Variables 1
- CSS Writing Modes 4
- Full Declarative Shadow DOM (slot distribution,
:host/::slotted/::part/::theme)
What’s not in scope
Section titled “What’s not in scope”- JavaScript execution.
<script>is parsed but never run. Event handlers (onclick, etc.) are dropped. The Custom Elements registry,MutationObserver/IntersectionObserverand similar runtime APIs are not implemented at any phase. Use headless Chromium (Puppeteer, Playwright) if you need scripted rendering. - Imperative
Element.attachShadow()from author script (declarative<template shadowrootmode>is supported). - Interactive features (forms, links to JavaScript, animations).