From 357713e3a1b6f01e7f2f169f6f4828ad84178557 Mon Sep 17 00:00:00 2001 From: geisserml Date: Tue, 30 May 2023 13:20:14 +0200 Subject: [PATCH] init_forms: use lean config if not V8 --- src/pypdfium2/_helpers/document.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pypdfium2/_helpers/document.py b/src/pypdfium2/_helpers/document.py index b7dd03f09..07bd2c427 100644 --- a/src/pypdfium2/_helpers/document.py +++ b/src/pypdfium2/_helpers/document.py @@ -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: