pypdf
pypdf copied to clipboard
update_page_form_field_values prevents barcode (pdf417) from displaying correctly
Here's a description of the issue https://stackoverflow.com/questions/73533672/pypdf2-doesnt-display-barcode-pdf417-after-using-update-page-form-field-value/73535421#73535421
pdf417 barcode isn't displayed after using update_page_form_field_values()
Environment
Which environment were you using when you encountered the problem?
- Windows 10
- Visual Studio Code
- python 3.10.6
$ python -m platform
Windows-10-10.0.19043-SP0
$ python -c "import PyPDF2;print(PyPDF2.__version__)"
2.10.3
Code + PDF
This is a minimal, complete example that shows the issue:
from PyPDF2 import PdfReader, PdfWriter
reader = PdfReader("i-130.pdf", strict=True)
pager = reader.pages[0]
field_dict = {"Pt2Line4b_GivenName[0]": "Mark"}
writer = PdfWriter(strict=True)
writer.add_page(pager)
writer.update_page_form_field_values(pager, fields=field_dict)
with open("newfile.pdf", "wb") as fh:
writer.write(fh)
The PDF: https://www.uscis.gov/sites/default/files/document/forms/i-130.pdf - you can add it to the tests
The issue
It works, just doesn't work correctly