Case study: pdfmake committed the broken PDF three times

· Nathan Broadbent

pdfmake builds PDFs from a JSON description of the document, in Node and in the browser. Its repository has an examples folder: about 30 scripts that each write a PDF, from basic text to tables, columns and SVG. The PDFs are committed to the repository too, in examples/pdfs/.

That's most of a visual test suite already. What's missing is the comparison.

The bug

On 20 February 2026, d4aed28 ("Implement snaking columns") added a long-requested feature: text that flows from one column into the next, like a newspaper. It changed how pdfmake decides where content goes on the page, and with it, how tables with cells that span several rows are laid out when the spanning cell is in the last column. The rows after it were pushed down, and a cell spanning three rows and three columns came apart from the rows it was meant to cover.

It shipped in 0.3.5 on 22 February and in 0.3.6, 0.3.7 and 0.3.8. A user reported it in April. It was fixed on 23 May by 1c803c4 ("fixed table rowSpan cell height in last column"), released in 0.3.9: four releases, three months.

Page 9 of the tables example with pdfmake 0.3.4, 0.3.5 and 0.3.9

The PDF that showed it

The bug is in pdfmake's own tables example, on pages 3, 9 and 10. While it was live, the example PDFs were regenerated and committed three times: on 10 March, 17 March and 6 May ("refresh pdf examples"). We rendered page 9 of each of those committed files: all three are pixel for pixel the broken layout. The evidence sat in the repository for months. Nobody compared the new file with the old one, because nothing does that for PDFs in a code review: GitHub shows a binary file changed, and that's all.

The replay

In our fork (visualci-com/pdfmake), a GitHub Actions job builds pdfmake from the commit, runs every example, and sends the PDFs to VisualCI. We pushed d4aed28's parent as the baseline and opened a pull request with d4aed28 on top.

VisualCI's build for that pull request, build #3:

  • tables.pdf changed, on pages 3, 9 and 10, with each changed region marked. On pages 3 and 10 the text diff also shows the extra line the broken layout adds.
  • snaking_columns.pdf added: the commit's own new example, which is the feature working.
  • 29 unchanged: every other example.

A reviewer sees the new feature and, next to it, the one thing it broke. We rejected the build with the reason attached.

Before building the story on it, we checked the cause by rendering, not by reading the code: built from source, d4aed28's parent renders the tables example exactly as 0.3.4 does, and d4aed28 exactly as the broken 0.3.5. The fix commit does the reverse.

Page 3 of the tables example with pdfmake 0.3.4, 0.3.5 and 0.3.9

What it takes

pdfmake already had everything but the comparison: the examples, a script per document, even the committed PDFs. The VisualCI setup is one shell script (build, run the examples, collect the PDFs) and one workflow step. It runs in about two minutes on GitHub's free runners.

Try it

If your project writes PDFs in its tests or examples, that's your test suite. See PDFs and GitHub Actions.