pymupdf / PyMuPDF

PyMuPDF is a high performance Python library for data extraction, analysis, conversion & manipulation of PDF (and other) documents.
https://pymupdf.readthedocs.io
GNU Affero General Public License v3.0
4.49k stars 443 forks source link

Why does PyMuPDF print checkmarks instead of 'X' for checkboxes. #3618

Closed ahussain3 closed 5 days ago

ahussain3 commented 5 days ago

For the same PDF document, I noticed that when I fill in a checkbox using Apple Preview, or Adobe Acrobat, selected checkboxes are shown as [X]. Whereas, when I check a checkbox using PyMuPDF, the checkbox shows as [✓].

Apple Preview

Screenshot 2024-06-25 at 3 57 25 PM

Adobe Acrobat

Screenshot 2024-06-25 at 3 57 37 PM

PyMuPDF

if widget.field_type == PDF_WIDGET_TYPE_CHECKBOX:
    widget.field_value = True

Screenshot 2024-06-25 at 3 57 57 PM

Is this configurable? I have tried setting widget.text_font and widget.text_fontsize, but with no success.

My main concern is that the screen readers / scanners that read the printed form will misread the checkboxes if they are selected in this non-standardized way.

JorjMcKie commented 5 days ago

No, this behavior is based on MuPDF's appearance stream creation and cannot be changed.