ELSEIF
Your brief EB
234 stories from 71 feeds 47 clusters Refreshed 6 minutes ago next pull 12:20

TECH Signal 403

Tests for a PDF ·

A developer added automated tests to verify that their PDF resume contains extractable text and examined whether disabling ligatures affects that extraction.

WHY IT MATTERS

Engineers who produce documents for machine parsing need to confirm that the output is actually readable by downstream tools, not just visually correct. The example shows that defensive typographic choices can have hidden costs and that test suites can give false confidence if they are misconfigured. It also illustrates how a simple text-extraction check can catch problems that visual inspection misses.

Written by elseif from the cluster below · every claim links back to a source

The three things worth knowing

01

The test suite checks the PDF header, metadata, page count, and that pdftotext yields at least 200 characters.

02

Disabling ligatures in Typst does not change the extracted text because the PDF includes a ToUnicode CMap that maps glyphs back to Unicode.

03

The test for author name never ran because the expected filename in the test dictionary did not match the actual output file.

THE READ

What elseif makes of it.

ORIGINAL ANALYSIS

The test suite runs four inexpensive checks on every PDF produced by the build. First it verifies the file starts with the bytes %PDF-. Second it uses pdfinfo to confirm that the Author and Title fields are non-empty. Third it ensures the document has at least one page. Fourth it runs pdftotext and requires at least 200 characters of output, which is intended to catch cases where the PDF is merely an image of text.

To investigate the common advice to disable ligatures for ATS friendliness, the author created two PDFs that differed only in the ligatures setting. Both PDFs contained the same Unicode text, and pdftotext extracted identical strings from each. The reason is that Typst writes a ToUnicode CMap that maps each glyph back to its underlying Unicode characters, so the extraction works regardless of whether ligatures are present.

Although the extraction was identical, the author kept the ligature-off setting as a defensive measure against hypothetical parsers that might ignore the ToUnicode table or against PDF producers that do not include one. The cost of this defense is that the normal em dash ligature (---) is disabled, forcing the use of an explicit symbol function (sym.dash.em) whenever a date range is written.

While reviewing the test code, the author discovered that the dictionary used to validate author and title was keyed on an outdated filename (dist/resume/main.pdf). After renaming the output to a more recruiter-friendly name, the condition relative in EXPECTED was always false, so the author check never executed. Changing the expected author to a different name still resulted in a passing test, revealing that the suite would not detect a mismatch.

The episode highlights three practical lessons for engineers: validate the actual output that downstream systems will consume, be aware that defensive choices can introduce non-obvious workflow overhead, and regularly verify that test expectations match the artifacts they are meant to check.

Written by elseif from the cluster below · checked for specifics the sources never contained

THE CLUSTER

Same story, 1 feed.

ORDERED BY FIRST SEEN
Lobsters Tests for a PDF · Open ↗