📝 Description
Currently, filler.py treats all PDF annotations as text fields (/Tx). It attempts to write string values directly to annot.V and refreshes the appearance with annot.AP = None.
While this works for standard text boxes, it fails for Button widgets (/Btn), such as checkboxes and radio buttons. In the PDF specification, these widgets do not display text; they rely on an Appearance State (/AS) to toggle between "On" and "Off" visual states.
💡 Rationale
[cite_start]Many official forms (like the UC Vaccine Declination statement) rely heavily on checkboxes for legal acknowledgments[cite: 1, 15, 17]. Currently, FireForm cannot "check" these boxes. Instead, it either leaves them blank or attempts to write text into a non-text field, which can lead to document corruption or invisible data.
Adding support for /Btn widgets expands the tool's utility to include virtually all standard government, medical, and legal forms.
🛠️ Proposed Solution
Modify the filling logic in src/filler.py to inspect the Field Type (/FT) of each annotation:
✅ Acceptance Criteria
📌 Additional Context
This is a foundational fix for supporting complex forms. [cite_start]I have tested this logic against a modified version of the UC Vaccine Declination form containing checkboxes for the "I am aware of the following facts" section[cite: 9, 10, 15].
📝 Description
Currently,
filler.pytreats all PDF annotations as text fields (/Tx). It attempts to write string values directly toannot.Vand refreshes the appearance withannot.AP = None.While this works for standard text boxes, it fails for Button widgets (
/Btn), such as checkboxes and radio buttons. In the PDF specification, these widgets do not display text; they rely on an Appearance State (/AS) to toggle between "On" and "Off" visual states.💡 Rationale
[cite_start]Many official forms (like the UC Vaccine Declination statement) rely heavily on checkboxes for legal acknowledgments[cite: 1, 15, 17]. Currently, FireForm cannot "check" these boxes. Instead, it either leaves them blank or attempts to write text into a non-text field, which can lead to document corruption or invisible data.
Adding support for
/Btnwidgets expands the tool's utility to include virtually all standard government, medical, and legal forms.🛠️ Proposed Solution
Modify the filling logic in
src/filler.pyto inspect the Field Type (/FT) of each annotation:If
annot.FT == '/Btn', the system should translate the LLM's boolean-like response (Yes/No, True/False) into the correct PDFPdfName.The logic must set both the Value (
/V) and the Appearance State (/AS) to the "On" value (standardized as/Yesor/On) to ensure the checkmark is visually rendered.Standard text logic should remain as the fallback for
/Txfields.Logic change in
src/filler.pyEnhancement to
add_response_to_jsoninsrc/llm.pyto handle boolean mapping.✅ Acceptance Criteria
📌 Additional Context
This is a foundational fix for supporting complex forms. [cite_start]I have tested this logic against a modified version of the UC Vaccine Declination form containing checkboxes for the "I am aware of the following facts" section[cite: 9, 10, 15].