FZPure suite
FZPureDOCX
DOCX and PDF documents from Word templates.
A small PHP server that fills Word templates, replacing placeholders with text, HTML, tables and checkboxes, and returns DOCX or PDF.
Projects · FZPure suite
HTML to PDF in pure PHP. Write your document in HTML with the bundled stylesheet, call one function, get the PDF. Two files to copy to your server.
Try the demo Code on GitHub Download the latest release
HTML-to-PDF converters usually try to understand all of CSS, and the result is a surprise. They often need a headless browser or heavy libraries on the server, too.
FZPureHTML does the opposite: it ships one stylesheet containing only what the converter renders well. The browser uses it for the preview, the converter reads the very same stylesheet to produce the PDF. What you see on screen and what you get in the PDF match, line breaks included.
require 'FZPureHTML.php';
$pdf = FZPureHTML::convertFile('document.html');
FZPureHTML::output($pdf, 'inline', 'document.pdf');
Requirements: PHP 8.1+ with dom, mbstring, zlib. TrueType fonts (e.g. Liberation).
Full example: Sample HTML document · Generated PDF
Installation, configuration and the full reference are in the README on GitHub.
FZPureHTML is free and open source. If you find it useful, you can buy me a coffee: it is a simple way to support its development.
FZPure suite
DOCX and PDF documents from Word templates.
A small PHP server that fills Word templates, replacing placeholders with text, HTML, tables and checkboxes, and returns DOCX or PDF.
New releases, development notes and what I learn along the way.