-
Notifications
You must be signed in to change notification settings - Fork 521
How to Show Form PDF Fields
Jorj X. McKie edited this page May 3, 2018
·
1 revision
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.
HOWTO Button annots with JavaScript
HOWTO work with PDF embedded files
HOWTO extract text from inside rectangles
HOWTO extract text in natural reading order
HOWTO create or extract graphics
HOWTO create your own PDF Drawing
Rectangle inclusion & intersection
Metadata & bookmark maintenance