Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't remove PDF_FIELD_IS_READ_ONLY from widget #1257

Closed
gregersn opened this issue Sep 12, 2021 · 2 comments
Closed

Can't remove PDF_FIELD_IS_READ_ONLY from widget #1257

gregersn opened this issue Sep 12, 2021 · 2 comments
Assignees
Labels

Comments

@gregersn
Copy link

Trying to loop through all widgets in a PDF, and make fields that are previously marked as read only, editable.

I have a hard time making an actual sample, both because I am not sure what should have worked, and because I am fumbling in the dark here.

But, I read in a PDF with read-only fields, I have tried things like

for page in pdf:
        widgets: Iterable[fitz.Widget] = page.widgets()
        for field in widgets:
            if fitz.PDF_FIELD_IS_READ_ONLY & field.field_flags:
                print("Field is readonly")
                field.field_flags = field.field_flags - fitz.PDF_FIELD_IS_READ_ONLY
            field.update()
pdf.save("filename.pdf")

When I then reopen the PDF, the fields are still read only.
If I try the opposite, to set all fields read only, that works.

PyMuPDF==1.18.15

@JorjMcKie
Copy link
Collaborator

Error confirmed! Will be corrected in next version.

@JorjMcKie
Copy link
Collaborator

new version 1.18.18 now on PyPI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants