Skip to content

ComboBox choice_values full of empty strings despite PDF having valid choices. #4114

Open
@sarahkittyy

Description

@sarahkittyy

Description of the bug

I am using the 940b: https://www.irs.gov/pub/irs-pdf/f940b.pdf

The PDF file has identical pages, and each page has this specific dropdown:
image

The choice_values variable is empty.

import pymupdf

pdf = pymupdf.open('f940b.pdf')

for page in pdf:
    for widget in page.widgets():
        if widget.field_type_string == 'ComboBox':
            print(widget.choice_values)
        widget.update()
pdf.save('f940b-output.pdf')

Expected output:

[' - Select One - ', '  ', 'Cincinnati, OH 45999', 'Memphis, TN 37501', 'Ogden, UT 84201', 'Philadelphia, PA 19255']
[' - Select One - ', '  ', 'Cincinnati, OH 45999', 'Memphis, TN 37501', 'Ogden, UT 84201', 'Philadelphia, PA 19255']

Actual output:

['', '', '', '', '', '']
[' - Select One - ', '  ', 'Cincinnati, OH 45999', 'Memphis, TN 37501', 'Ogden, UT 84201', 'Philadelphia, PA 19255']

This also affects the resulting f940b-output.pdf, where the first combo box is suddenly completely empty with no choices available.
image

How to reproduce the bug

See above

PyMuPDF version

1.24.13

Operating system

Linux

Python version

3.12

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions