Skip to content

Commit

Permalink
init_forms: use lean config if not V8
Browse files Browse the repository at this point in the history
  • Loading branch information
mara004 committed May 30, 2023
1 parent 5991174 commit 357713e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/pypdfium2/_helpers/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,11 @@ def init_forms(self, config=None):
if V_PDFIUM_IS_V8 and V_BUILDNAME == "pdfium-binaries" and int(V_LIBPDFIUM) <= 5677:
raise RuntimeError("V8 enabled pdfium-binaries builds <= 5677 crash on init_forms().")

js_platform = pdfium_c.IPDF_JSPLATFORM(version=3)
config = pdfium_c.FPDF_FORMFILLINFO(version=2, xfa_disabled=False, jsPlatform=js_platform)
if V_PDFIUM_IS_V8:
js_platform = pdfium_c.IPDF_JSPLATFORM(version=3)
config = pdfium_c.FPDF_FORMFILLINFO(version=2, xfa_disabled=False, jsPlatform=js_platform)
else:
config = pdfium_c.FPDF_FORMFILLINFO(version=2)

raw = pdfium_c.FPDFDOC_InitFormFillEnvironment(self, config)
if not raw:
Expand Down

0 comments on commit 357713e

Please sign in to comment.