-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
After performing the write, I opened it in Adobe Acrobat Pro DC, and saw the edits are applied. However, when I try to close the file, I am promoted to save the file. If I click no, I would be prompted every time I open and close the file. However, when I try to attach the file in an email and preview it, the edits are no longer visible. This is solved by clicking yes on the save dialog instead, and I noticed that the file size increases after that.
Environment
Which environment were you using when you encountered the problem?
$ python -m platform
Windows-10-10.0.19044-SP0
$ python -c "import pypdf;print(pypdf.__version__)"
3.10.0Code + PDF
This is a minimal, complete example that shows the issue:
from pypdf import PdfReader, PdfWriter
reader = PdfReader("1.pdf")
writer = PdfWriter()
page = reader.pages[0]
fields = reader.get_fields()
writer.append(reader)
writer.update_page_form_field_values(
writer.pages[0], {
"Given Name Text Box": "asdf",
"Family Name Text Box": "fam",
"Address 1 Text Box": "add1",
"House nr Text Box": "2",
"Address 2 Text Box": "add2",
"Postcode Text Box": "123456",
"City Text Box": "city",
"Country Combo Box": "Belgium",
"Gender List Box": "Man",
"Height Formatted Field": "30",
"Driving License Check Box": "city",
"Favourite Colour List Box": "Black",
"Language 1 Check Box": "/Yes",
"Language 2 Check Box": "/Off",
}
)
# write "output" to pypdf-output.pdf
with open("filled-out.pdf", "wb") as output_stream:
writer.write(output_stream)Share here the PDF file(s) that cause the issue. The smaller they are, the
better. Let us know if we may add them to our tests!
http://foersom.com/net/HowTo/data/OoPdfFormExample.pdf
Traceback
This is the complete Traceback I see:
No traceback