- Chrome writes synthesised bold text into PDFs as Type 3 fonts, where every glyph is a small drawing.
- Ghostscript redraws those glyphs at 100× scale. In PDF/A-1 mode it then clamps rectangles to the format’s limit of 32,767, so an “l” shrinks to a dot.
- Ghostscript exits with code 0. The only sign is a warning in the log.
- PDF/A-2 has no such limit and converts the file cleanly, but notarial documents have to be archived as PDF/A-1b.
- Our fix converts twice and grafts the intact glyphs from the PDF/A-2 output into the PDF/A-1 file, rescaled to fit the limit. A pixel comparison before signing alerts us to whatever we have not thought of.
The symptom
In August a document came out of our pipeline reading “Qua.ifizierte Beg.aubigungen”. The original said “Qualifizierte Beglaubigungen”. Every lowercase “l” and every capital “I” in the bold text had become a dot, and the dashes had shrunk to specks. Regular-weight text on the same page was fine.


This was not a cosmetic bug. Before a document is signed in swipesign, we convert it to PDF/A, the archival flavour of PDF, and the signer is shown and signs the converted file. So a person could have been asked to put a qualified electronic signature under a deed whose text we had damaged. Nothing in our logs said so: the conversion had succeeded.
The first theory was wrong
The affected files all came from browsers, and browser-made PDFs embed font subsets in a way PDF/A-1 does not like. Our first ticket therefore blamed font re-encoding: Ghostscript has to rebuild those fonts for the older format, and we assumed glyphs were landing in the wrong slots.
That did not fit what we saw. A wrong slot gives you a wrong letter. We were getting the right letter in the right place, squashed. The shape was damaged, not the mapping. And only bold text was affected, never regular text in the same font.
What actually happens
Three things have to line up.
1. Chrome writes synthesised bold as Type 3 fonts. When a page asks for bold and the browser has no bold face to embed, it thickens the regular one itself. In the PDF that text does not use a normal embedded font. It uses Type 3 fonts, in which each glyph is a short drawing program. Our test file has five of them. The glyph for “l” is one filled rectangle:
126 -1522 244 1554 re
f2. Ghostscript redraws Type 3 glyphs at 100× scale. When Ghostscript rewrites the file, it captures each glyph again and stores it in hundredths of a unit, with a scale factor in front:
0.01 0 0 0.01 0 0 cm
12600 -152200 24400 155400 re
fSame shape, numbers 100 times larger.
3. PDF/A-1 caps numbers at 32,767. PDF/A-1 is built on PDF 1.4 and turns that version’s implementation limits into rules. One of them: no real number may exceed 32,767 in absolute value. PDF/A-2 dropped that cap. In PDF/A-1 mode Ghostscript enforces it on rectangles by clamping:
0.01 0 0 0.01 0 0 cm
12600 -32766 24400 32766 re
fA stroke that was 1,554 units tall is now 328 units tall and sits on the baseline: a dot.
That also explains which characters break. Ghostscript clamps the operands of the rectangle operator. Letters made of curves keep their coordinates and survive. An “l”, an “I” and a dash in a sans-serif face are plain rectangles, so they are exactly the four glyphs that die in our test file.
Ghostscript does say something. For each clamped glyph it prints:
Required co-ordinate outside valid range for PDF/A-1, clamping to valid range, output may be incorrect.Then it exits with code 0 and a file that opens without complaint.
There is a second problem behind the first. We ran the clamped file through veraPDF, the reference validator, and it fails PDF/A-1b: 846 violations of the very same rule (ISO 19005-1, clause 6.1.12), because the curve coordinates of the other glyphs are still above the limit. So the output was visibly damaged and not even conformant.
Two ways out, both closed
Convert to PDF/A-2 instead. One flag, -dPDFA=2. The same file converts with no warnings, renders identically and passes veraPDF. But the archive format required of notarial documents is PDF/A-1b, and a notarial deed is not the place to argue that a newer standard is better.
Fix the source. We could make sure our own pages never trigger synthesised bold. That would have fixed our own documents and none of our customers’. People upload whatever their browser, word processor or practice software produces, and we do not get to choose.
So the output had to stay PDF/A-1b, for any input.
The fix: borrow the glyphs
The PDF/A-2 output contains what we need: every glyph, intact. The PDF/A-1 output has everything else right. So we now do both.
- 1
Convert to PDF/A-1 as before and read Ghostscript’s log.
- 2
If the clamping warning is in it, convert the same input again as PDF/A-2.
- 3
Match the Type 3 fonts of the two outputs by their glyph names, bounding box and font matrix. If two fonts share that signature the match is ambiguous, and we leave them alone.
- 4
For each matched font, take every glyph from the PDF/A-2 file, multiply its path coordinates by the scale factor and drop the scale instruction. The rectangle is
126 -1522 244 1554 reagain: the same drawing, in numbers far below the limit. - 5
Write the glyphs into the PDF/A-1 file without touching its metadata, so the PDF/A identification stays in sync.
The rescaling only handles glyphs that are a plain filled path under a uniform scale. Anything else is skipped, and the font is left as it was. If any step fails, we use the clamped output. A few damaged glyphs that the signer can see are bad; a signing that cannot start at all is worse. The next section is about noticing when that happens.
The repaired file passes veraPDF as PDF/A-1b, which the clamped one never did, because folding the scale into the coordinates also brings the curves under the limit. The whole repair is 149 lines of Python on top of the PDF library we already use for signing. Documents that convert cleanly, which is nearly all of them, still take a single pass.
The safety net
The repair fixes the one failure we understand. The lesson of this bug is that a converter can return success and a damaged file, so we stopped trusting the exit code.
When a signing starts, we now render the original and the converted file at 72 dpi in greyscale and compare them pixel by pixel. Two rules keep it from crying wolf: a pixel only counts if it differs by more than 64 grey levels from everything around it in the other render, which absorbs colour-conversion drift and sub-pixel shifts, and a lone differing pixel is ignored as aliasing.
On our test file the line that lost its glyphs differs in 0.025% of the page’s pixels. A page that PDF/A-1 forced into an image differs in 0.005%. A faithful conversion scores zero. The threshold sits at 0.01%, between the two.
Today a mismatch raises a warning for us with the page numbers; it does not block the signing, because a false alarm must never stop someone from signing. It is also a coarse instrument: damage to one small glyph stays below the threshold. It is there so that a conversion which drops or mangles content in a way nobody has predicted reaches an engineer the same day, not a customer.
What we took from it
- Exit code 0 is not a result. Read the tool’s warnings, and treat “output may be incorrect” as a failure until proven otherwise.
- Validate the output, not the flag. Passing
-dPDFA=1does not make a file PDF/A-1. Only a validator can tell you that, and ours said no. - Compare what a person will see. For a signing product, the rendered page is the thing that matters. A pixel comparison is crude, and it would have flagged this on day one.
- Old limits are still in force. A 16-bit cap from a 2001 file format decided how a letter was drawn in 2026, because an archive rule still points at that format.
Reproduce it
gs -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -dPDFA=1 \
-dPDFACompatibilityPolicy=1 -sProcessColorModel=DeviceCMYK \
-sColorConversionStrategy=UseDeviceIndependentColor \
-sOutputFile=out.pdf input.pdf
verapdf -f 1b --format text out.pdfTested with Ghostscript 10.05.1 and 10.07.0.
Sign with QES or AES, verifiable by anyone.
swipesign signs in the open PAdES standard with a qualified timestamp, so any validator can confirm your documents, today and, with the timestamp renewed in time, decades from now.