chinapandaman / PyPDFForm

:fire: The Python library for PDF forms.
https://chinapandaman.github.io/PyPDFForm/
MIT License
438 stars 19 forks source link

Checkbox built as radio widget #683

Closed bi1yeu closed 4 months ago

bi1yeu commented 4 months ago

Version

PyPDFForm=1.4.18

Issue Description

I noticed that when I create a fillable PDF from https://www.sejda.com/, the checkbox fields are treated as radio buttons inside of PyPDFForm. Attached is an otherwise blank PDF with a single checkbox generated at that site.

I suspect it's doing something nonstandard, but the text fields seem to work fine, and other PDF software (e.g. Preview on macos) renders the checkbox as a checkbox and lets me check it.

Code Snippet

In [1]: from PyPDFForm import PdfWrapper

In [2]: pdf = PdfWrapper("new_document.pdf")

In [3]: pdf.widgets
Out[3]: {'test_checkbox': <PyPDFForm.middleware.radio.Radio at 0x10db8c370>}

In [4]: pdf.schema
Out[4]:
{'type': 'object',
 'properties': {'test_checkbox': {'type': 'integer', 'maximum': 0}}}

PDF Form Template

new_document.pdf

Screenshots (if applicable)

chinapandaman commented 4 months ago

Hey thanks for posting.

I made a fix for this. Give v1.4.30 a try and let me know.

bi1yeu commented 4 months ago

worked great, thanks for the quick turnaround and for the library!