How to Show Form PDF Fields - pymupdf/PyMuPDF GitHub Wiki
Enhancement in v1.13.2
For PDF documents, check the bool doc.isFormPDF.
It is True if an object of type /AcroForm and at least one form field exist.
Form fields are a special Annotation object type: "Widget". Scan through the annotations of a Page like this:
for page in doc:
annot = page.firstAnnot
while annot:
if annot.type[0] != fitz.ANNOT_WIDGET: # form field type is (19, 'Widget')
annot = annot.next # last annot has no "next"
continue
print(annot.widget_type, annot.widget_name, annot.widget_text)
annot = annot.next
In this version, only text form field (annot.widget_type == (3, 'Tx')) content is shown. In later versions we will also detect checked buttons, selected dropdown items, etc.