Skip to content

Poppler warns 'Unknown font tag ZaDb' for every active checkbox and radio button #59

Description

@jakejackson1

Summary

Rendering any document with an active checkbox or radio button through poppler prints Syntax Error: Unknown font tag 'ZaDb' once per widget. The output itself is fine. mPDF writes /NeedAppearances true on the AcroForm, which tells viewers to regenerate field appearances, and poppler regenerates check-box appearances with the ZapfDingbats tag /ZaDb, which it then looks up in the form's default resources. mPDF's /DR only lists the document fonts, so the lookup fails and poppler warns.

Found while building the forms snapshot document for #38; harmless there, but it is noise in every pdftotext and pdftoppm run over a document with a checkbox, and any viewer that regenerates appearances the same way will draw the check with a fallback font. Same on gravitypdf.

Try it

$mpdf = new \Mpdf\Mpdf();
$mpdf->useActiveForms = true;
$mpdf->WriteHTML('<input type="checkbox" name="c" value="on" checked="checked" />');
$mpdf->Output('checkbox.pdf', 'F');
$ pdftotext checkbox.pdf /dev/null
Syntax Error: Unknown font tag 'ZaDb'

The file contains no ZaDb of its own: the widget's /DA names a document font and its /AP carries mPDF's own appearance streams; /DR is << /Font << /F1 ... >> >>.

Fix

Add a ZapfDingbats entry to the AcroForm default resources when the document has a checkbox or radio button, as Acrobat-generated forms do:

/DR << /Font << ... /ZaDb << /Type /Font /Subtype /Type1 /BaseFont /ZapfDingbats >> >> >>

Form::_putFormsCatalog() (or wherever /DR is written) already knows whether any button fields exist. Alternatively, write /NeedAppearances false when every field carries an appearance stream, which stops viewers regenerating in the first place; that is a broader change and worth checking against how text fields render in Acrobat.

Test plan

  • A unit case asserting /ZaDb appears in /DR when the document has a checkbox, and not otherwise.
  • pdftotext over tests/data/snapshots/page-break-avoid-forms.pdf printing nothing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions