Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check system version before trying to replace font #698

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docassemble_base/docassemble/base/pdftk.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import string
import codecs
import logging
import packaging
from io import BytesIO
from xfdfgen import Xfdf
import pikepdf
Expand Down Expand Up @@ -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:
Expand Down