-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Checkboxes, update_page_form_field_values, encoding and german characters. #2021
Copy link
Copy link
Closed
Labels
workflow-formsFrom a users perspective, forms is the affected feature/workflowFrom a users perspective, forms is the affected feature/workflow
Description
I am filling a form with text and checkbox fields. Text values may contain german characters.
If a checkbox is programmatically selected then subsequent fields are corrupted.
It might not be a pypdf fault, see viewers comparison in caveats below.
Caveats:
-
if the corrupted field gets focus the displayed text is correct ( back to incorrect when the focus is lost):

-
case reproduced in Adobe Acrobat Reader
-
Firefox viewer shows incorrect characters (even in the first field) regardless of checkbox:

Environment
Which environment were you using when you encountered the problem?
$ python -m platform
Windows-10-10.0.19045-SP0
$ python -c "import pypdf;print(pypdf.__version__)"
3.12.2Code + PDF
This is a minimal, complete example that shows the issue:
from pypdf import PdfWriter
writer = PdfWriter()
writer.append("./visa-form.pdf")
writer.update_page_form_field_values(
writer.pages[0],
{
'1 Surname': 'Zürich',
# 'Check Box 9.1': '/Ja', # skip or not
'9': 'Zürich'
}
)
with open("./zurich-test.pdf", "wb") as output_stream:
writer.write(output_stream)
output_stream.close()visa-form.pdf
zurich-test-no-checkbox.pdf
zurich-test-with-checkbox.pdf
Traceback
TODO
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
workflow-formsFrom a users perspective, forms is the affected feature/workflowFrom a users perspective, forms is the affected feature/workflow


