Document build system
Branded sales PDFs built from source like code, with a build that fails before a broken page ships. 25 documents so far.
- Role
- Sole developer
- When
- 2026
The problem
Sales collateral at a small firm usually lives in design files only one person can edit, and it drifts: wrong prices, text running off the page, English and Spanish versions that no longer match. I wanted one-pagers, guides and flyers that anyone could update by editing text, with the build catching layout mistakes before a customer sees them.
What I built
A build system that turns each document's content into a branded PDF. Each page is an HTML and CSS template, and Playwright prints it to PDF in headless Chromium. One shared brand module holds the masthead, colors, fonts, call-to-action box and page helpers. Each document is a short build script on top of it, and the bilingual ones render English and Spanish in the same run.
It started on ReportLab, drawing every page in Python. On November 6, 2026 I moved it to HTML and Playwright, so layout is handled by a browser engine instead of hand-placed coordinates.
How it works
- The brand lives in one module, so a color, the phone number or the logo changes in one place and every document picks it up on the next build.
- Each build script is self-contained and resolves its own paths, so any document can be rebuilt from anywhere with one command.
- The build fails instead of shipping a broken page: if content overflows the page, if the intro runs past 3 lines, the call to action past 2 or the disclaimer past 4, or if the button text is wider than the 268pt button.
- In the ReportLab version, layout was solved, not hardcoded: the tier flyer picked the largest line spacing between 11.5 and 14pt that still cleared the call to action, then spent the leftover space on padding.
- QR codes are generated at build time from each document's target URL.
- The flyer takes its item names and prices word for word from the detailed tier guides, so the two documents agree.
What broke and how I caught it
In the ReportLab version, a page came out with its text clipped at the bottom. ReportLab doesn't complain when content runs off the page; it just draws it where nobody can see it, so the PDF looked finished. I caught it reviewing the output before it went to anyone.
That's why overflow is now a build failure instead of something to spot by eye. Every document checks that its content fits, and the tight layouts check line counts too, so a longer sentence or a Spanish translation that runs longer than the English stops the build with the reason instead of shipping clipped.
Result
- 25 PDFs from 22 build scripts: one-pagers, service guides, flyers, a cold-call sheet and an investor summary, several in both English and Spanish.
- A price change used to take hours of editing each design file by hand. Now it's one edit and a rebuild, a few minutes.
Built with
Built with Python, HTML/CSS, Playwright, QR codes, Build-time checks