diff --git a/PyPDFForm/constants.py b/PyPDFForm/constants.py index 44914272..e994bca2 100644 --- a/PyPDFForm/constants.py +++ b/PyPDFForm/constants.py @@ -32,8 +32,6 @@ JS = "/JS" T = "/T" Rect = "/Rect" -Subtype = "/Subtype" -Widget = "/Widget" FT = "/FT" Parent = "/Parent" Ff = "/Ff" @@ -43,6 +41,7 @@ N = "/N" Sig = "/Sig" DA = "/DA" +DV = "/DV" Btn = "/Btn" MaxLen = "/MaxLen" Q = "/Q" diff --git a/PyPDFForm/patterns.py b/PyPDFForm/patterns.py index 08936da9..6ec900e0 100644 --- a/PyPDFForm/patterns.py +++ b/PyPDFForm/patterns.py @@ -6,7 +6,7 @@ from .constants import (AP, AS, CA, DA, FT, IMAGE_FIELD_IDENTIFIER, JS, MK, READ_ONLY, A, Btn, Ch, Ff, N, Off, Opt, Parent, Q, Sig, - Subtype, T, Tx, V, Widget, Yes) + DV, T, Tx, V, Yes) from .middleware.checkbox import Checkbox from .middleware.dropdown import Dropdown from .middleware.image import Image @@ -49,7 +49,7 @@ ( ( {Parent: {FT: Btn}}, - {Parent: {Subtype: Widget}}, + {Parent: {DV: (Yes, Off)}}, {AS: (Yes, Off)}, ), Checkbox, diff --git a/pdf_samples/scenario/issues/683.pdf b/pdf_samples/scenario/issues/683.pdf new file mode 100644 index 00000000..9dd1f3e4 Binary files /dev/null and b/pdf_samples/scenario/issues/683.pdf differ diff --git a/pdf_samples/scenario/issues/683_expected.pdf b/pdf_samples/scenario/issues/683_expected.pdf new file mode 100644 index 00000000..44bd8cce Binary files /dev/null and b/pdf_samples/scenario/issues/683_expected.pdf differ diff --git a/tests/scenario/test_issues.py b/tests/scenario/test_issues.py index 701f42bc..b66abced 100644 --- a/tests/scenario/test_issues.py +++ b/tests/scenario/test_issues.py @@ -212,3 +212,17 @@ def test_ppf_627_fill_3(issue_pdf_directory, request): expected = f.read() assert len(obj.read()) == len(expected) assert obj.read() == expected + + +def test_sejda_checkbox(issue_pdf_directory, request): + obj = PdfWrapper(os.path.join(issue_pdf_directory, "683.pdf")).fill( + {"test_checkbox": True} + ) + + expected_path = os.path.join(issue_pdf_directory, "683_expected.pdf") + request.config.results["expected_path"] = expected_path + request.config.results["stream"] = obj.read() + with open(expected_path, "rb+") as f: + expected = f.read() + assert len(obj.read()) == len(expected) + assert obj.read() == expected