import pymupdf
# Open the PDF file
doc = pymupdf.open("f1040.pdf")
for page in doc:
print(f"--- Page {page.number} ---")
# Iterate over all form fields (widgets) on the page
for field in page.widgets():
# Access field properties
name = field.field_name # The internal name of the field
value = field.field_value # The data currently in the field
f_type = field.field_type # Integer representing the field type
print(f"Field Name: {name}")
print(f"Field Value: {value}")
print(f"Field Type: {f_type}")
print("-" * 20)
doc.close()
Description of the bug
Testcase: f1040.pdf.
script:
How to reproduce the bug
see above
PyMuPDF version
1.27.2.2
Operating system
Other
Python version
3.11