Skip to content

Removal of widgets, text is lost #2572

@AndresEV22

Description

@AndresEV22

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions