-
Notifications
You must be signed in to change notification settings - Fork 572
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
Setting RadioButton values to 'Off' doesn't set them to off after the file is saved #3314
Comments
I have also confirmed similar behavior in PyMuPDF v1.24.0 The only difference now is that both of my RadioButtons are checked, even after I set them both to 'Off'. |
This works: the two buttons are being toggled 2 times and then show the correct values. import fitz
doc = fitz.open("ROI-General.pdf")
page = doc[0]
btn1 = page.load_widget(66)
btn2 = page.load_widget(69)
print(f"btn1={btn1.field_value}, btn2={btn2.field_value} - {doc.name=}")
btn1.field_value = False
btn1.update()
btn2.field_value = True
btn2.update()
doc.save("x.pdf")
doc = fitz.open("x.pdf")
page = doc[0]
btn1 = page.load_widget(66)
btn2 = page.load_widget(69)
print(f"btn1={btn1.field_value}, btn2={btn2.field_value} - {doc.name=}")
btn1.field_value = True
btn1.update()
btn2.field_value = False
btn2.update()
doc.save("y.pdf")
doc = fitz.open("y.pdf")
page = doc[0]
btn1 = page.load_widget(66)
btn2 = page.load_widget(69)
print(f"btn1={btn1.field_value}, btn2={btn2.field_value} - {doc.name=}") |
Sorry for having the two spots of discussion, I replied in #2333 (reply in thread) |
False alarm, my bad. I may have been working with a corrupted file at some point, but the takeaway is to specifically use |
Moving my reply from #2333 because this seems like a regression according to #711.
I have 2 in a document, and I can change almost any other property of the radio buttons without issue and see those changes reflected after a
doc.save(path, garbage=1)
. The only change I am unable to affect is the value of the radios.System info:
I have 2 radio buttons in a group, the only 2 on the page. Here is their info according to PyMuPDF:
This is how they read when I first export from LibreOffice Draw. Then I do the following:
It appears to be off. However, when I save the file and open in any PDF viewer,
btn2
is always selected. This is whether I set both values toOff
,False
,True
, anything. No matter the combination I've tried to turn both of them off, or at least checkbtn1
instead ofbtn2
, it never actually changes in the saved PDF even though PyMuPDF is reporting that the value has changed just before saving.Attaching the PDF in question as it has been exported from LibreOffice, before I run my PyMuPDF script on it:
ROI - General.pdf
PDF viewers I've tested with: Firefox, Chrome, Edge, LaTeX/PDF viewer extenson in VSCodium, Adobe Acrobat Pro, Okular
Originally posted by @ag-gaphp in #2333 (comment)
The text was updated successfully, but these errors were encountered: