Skip to content

Each radio button widget is written with a duplicate /AP key #450

Closed

Description

@jakejackson1

Each active radio button widget is written with /AP twice in the same dictionary. veraPDF warns "duplicated key /AP". ISO 32000-1 §7.3.7 says a dictionary's keys shall be unique, so it is up to each reader which of the two entries it keeps.

$mpdf = new \Mpdf\Mpdf(['compress' => false, 'useActiveForms' => true]);
$mpdf->WriteHTML('<form><input type="radio" name="r" value="a" checked="checked" /> A <input type="radio" name="r" value="b" /> B</form>');

On feature/pdfa-2-conformance (656219b), each radio widget reads:

/Parent 11 0 R
...
/AP << /N << /a 6 0 R /Off 7 0 R >> >>
/V /a
/DV /a
/AS /a
/AP << /N << /a 6 0 R /Off 7 0 R >> >>

The same happens with PDF/A and PDFAauto on.

Cause. In Form::_putform_bt()'s radio branch, the /AP line is written before the /V//DV//AS block and again after it (src/Form.php:1791 and :1800 at 656219b). The checkbox branch writes it once (:1761).

This predates #387. gravitypdf (src/Form.php:1522 and :1531) and mpdf/mpdf development (src/Form.php:1520 and :1529) write the same pair.

Expected. One /AP per radio widget. Add a unit test that counts the /AP keys in each widget dictionary for checkbox and radio, under an ordinary document and PDF/A-2b.

Worth checking at the same time. The kid widgets also carry /V and /DV. Those belong to the field, which is the group's parent. #443's agent separately noted that the radio group parent itself is written as a zero-size /Type /Annot /Subtype /Widget although it never appears in /Annots. PR #447 writes its new button-group parents as plain field dictionaries, and the radio parent could follow.

Activity

  1. added
    bug
    and removed on Sep 23, 2026
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

    bugcreate-upstream-pr

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions