Skip to content

Commit 1a6787d

Browse files
tests/: added test_4965(), seems to pass ok without crash.
1 parent 17916d6 commit 1a6787d

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

tests/resources/test_4965.pdf

215 KB
Binary file not shown.

tests/test_widgets.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,3 +430,20 @@ def test_4055():
430430
# Round 5: final check: setting to "Yes" also does work
431431
for w in page.widgets(types=[2]):
432432
assert w.field_value == w.on_state()
433+
434+
435+
def test_4965():
436+
path = os.path.normpath(f'{__file__}/../../tests/resources/test_4965.pdf')
437+
with pymupdf.open(path) as document:
438+
for page in document:
439+
print(f'test_4965(): {page.number=}')
440+
# Iterate over all form fields (widgets) on the page
441+
for widget_i, field in enumerate(page.widgets()):
442+
# Access field properties
443+
name = field.field_name # The internal name of the field
444+
value = field.field_value # The data currently in the field
445+
f_type = field.field_type # Integer representing the field type
446+
print(f' {widget_i=}')
447+
print(f' {name=}')
448+
print(f' {value=}')
449+
print(f' {f_type=}')

0 commit comments

Comments
 (0)