-
Notifications
You must be signed in to change notification settings - Fork 1.6k
update_page_form_field_values not updating already filled form fields #2034
Copy link
Copy link
Closed
Description
Hi
I'm trying to populate a PDF form, but when i call update_page_form_field_values it is not updating already filled form fields, see code below.
If i though run update_page_form_field_values with flags=1 (update_page_form_field_values(writer.pages[idx], form_fields, flags=1)) then the fields gets updated, but they become read only which is not usable in my case.
any help is appreciated
Environment
$ python -m platform
Linux-6.2.12-arch1-1-x86_64-with-glibc2.37
$ python -c "import PyPDF2;print(PyPDF2.__version__)"
3.0.1Code
from PyPDF2 import PdfWriter
dst_file = "test_output.pdf"
writer = PdfWriter()
writer.append("test.pdf")
form_fields = {"Text Box 1":"test1"}
for idx,page in enumerate(writer.pages):
writer.update_page_form_field_values(writer.pages[idx], form_fields)
with open(dst_file, "wb") as output_stream:
writer.write(output_stream)
writer.close()
Traceback
no traceback
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels