-
Notifications
You must be signed in to change notification settings - Fork 664
Closed
Labels
Fixed in next releasebugfix developedrelease schedule to be determinedrelease schedule to be determined
Description
Description of the bug
We are trying to detect any type of widget and delete it. When we perform the operation page.delete_widget(w) it throws AttributeError: 'Annot' object has no attribute '__del__'
How to reproduce the bug
To Reproduce
PyMuPDF 1.23.25: Python bindings for the MuPDF 1.23.10 library (rebased implementation).
Python 3.11 running on darwin (64-bit).
import fitz
class ModifyPDF:
def __init__(self, input_path, outputFilePath):
self.pdfFilePath = input_path
self.outputFilePath = outputFilePath
def remove_input_fields(self):
docs = fitz.open(self.pdfFilePath)
for page in docs:
w = page.first_widget
while w:
w = page.delete_widget(w)
docs.save(self.outputFilePath, garbage=3, deflate=True, pretty=True)
docs.close()
if __name__ == "__main__":
filePath = "example_form.pdf"
outputPath = "output.pdf"
PdfFunction = ModifyPDF(filePath, outputPath)
PdfFunction.remove_input_fields()
Expected behavior
Widgets should be deleted.
Error output trace:
PyMuPDF version
1.23.25
Operating system
MacOS
Python version
3.11
Metadata
Metadata
Assignees
Labels
Fixed in next releasebugfix developedrelease schedule to be determinedrelease schedule to be determined