-
Hi Jorj - I am trying to get a form pdf filled and saved. import fitz doc = fitz.open('form.pdf') for field in page.widgets(): pdfbytes = doc.convert_to_pdf() |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I guess I would need an example. The following at least works fine. This the demo PDF: import fitz
doc=fitz.open("widgettest.pdf")
page=doc[0]
w=page.first_widget
w
'Text' widget on page 0 of widgettest.pdf
w.field_value
'Times-Roman'
w.field_value="some new text"
w.field_value
'some new text'
w.update()
pdfbytes=doc.convert_to_pdf()
new=fitz.open("pdf",pdfbytes)
new.save("x.pdf")
doc.close()
new.close()
new=fitz.open("x.pdf")
new.is_form_pdf # the resulting PDF has no fields anymore!
False |
Beta Was this translation helpful? Give feedback.
-
Just realized it: |
Beta Was this translation helpful? Give feedback.
Just realized it:
You must use
.field_value
, not just.value
!