v0.3.0 - CHOICE field type (dropdowns and list boxes)
CHOICE field type (dropdowns and list boxes)
Adds FieldType.CHOICE, covering the full PDF /Ch family - all four variants are cross-viewer verified (the selected value renders in both pdfium and pdf.js):
- Dropdown (combo box)
- Editable dropdown (accepts free-typed text)
- Single-select list box
- Multi-select list box
read_fields now recovers existing /Ch fields into CHOICE specs (options as plain strings or (export, label) pairs, plus list_box / multi_select / editable flags), round-tripping with build. fill validates values against the field's options.
import acroforge as af
from acroforge import FieldSpec, FieldType
fields = [FieldSpec(type=FieldType.CHOICE, page=0, rect=(200, 620, 360, 640),
name="state", options=["CA", "NY", "TX"])]
fillable = af.build(flat_pdf, fields)
filled = af.fill(fillable, {"state": "NY"})Validated on the IRS W-9. Install: pip install acroforge==0.3.0