When I use the method to delete all widgets from a PDF I lose all the text inside it, or when I use the widget.field_flags = fitz.PDF_FIELD_IS_READ_ONLY if I open the fields again they are editable.
To Reproduce (mandatory)
On read only fields, i save with this method:
for widget in widgets:
... logic to change the field value
widget.field_flags = fitz.PDF_FIELD_IS_READ_ONLY
widget.update()
and to delete it:
for widget in widgets:
widget.field_value = fields[widget.field_name] # type: ignore
widget.field_flags = fitz.PDF_FIELD_IS_READ_ONLY
widget.update()
page.delete_widget(widget)
Expected behavior (optional)
I expect text within a widget to be saved and the widget disappears or with the field flag when I reopen the PDF it's fields shouldn't be editable.
Your configuration (mandatory)
- Windows 10 and arch linux
- Python 3.11
- PyMuPDF 1.22.5, installation method by pyproyect.toml.
When I use the method to delete all widgets from a PDF I lose all the text inside it, or when I use the widget.field_flags = fitz.PDF_FIELD_IS_READ_ONLY if I open the fields again they are editable.
To Reproduce (mandatory)
On read only fields, i save with this method:
for widget in widgets:
... logic to change the field value
widget.field_flags = fitz.PDF_FIELD_IS_READ_ONLY
widget.update()
and to delete it:
for widget in widgets:
widget.field_value = fields[widget.field_name] # type: ignore
widget.field_flags = fitz.PDF_FIELD_IS_READ_ONLY
widget.update()
page.delete_widget(widget)
Expected behavior (optional)
I expect text within a widget to be saved and the widget disappears or with the field flag when I reopen the PDF it's fields shouldn't be editable.
Your configuration (mandatory)