From c48b41d76e8203b92a7f2f144c72d5e2d01176d7 Mon Sep 17 00:00:00 2001 From: Bryce Willey Date: Tue, 3 Oct 2023 17:50:38 -0400 Subject: [PATCH] check system version before trying to replace font --- docassemble_base/docassemble/base/pdftk.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docassemble_base/docassemble/base/pdftk.py b/docassemble_base/docassemble/base/pdftk.py index 3243d534d..1ba298fce 100644 --- a/docassemble_base/docassemble/base/pdftk.py +++ b/docassemble_base/docassemble/base/pdftk.py @@ -6,6 +6,7 @@ import string import codecs import logging +import packaging from io import BytesIO from xfdfgen import Xfdf import pikepdf @@ -238,6 +239,11 @@ def fill_template(template, data_strings=None, data_names=None, hidden=None, rea font_arguments = ['replacement_font', replacement_font] else: font_arguments = DEFAULT_FONT_ARGUMENTS + system_version = daconfig.get('system version', 'Unknown') + if system_version == 'Unknown' or packaging.version.parse(system_version) < packaging.version.parse("1.4.73"): + if replacement_font: + logmessage("Warning: the `replacement_font` argument isn't supported without a system docassemble of 1.4.73 or above") + font_arguments = [] subprocess_arguments = [PDFTK_PATH, template, 'fill_form', fdf_file.name, 'output', pdf_file.name] + font_arguments # logmessage("Arguments are " + str(subprocess_arguments)) if len(images) > 0: