Delete (Remove) of highlighted annotation from PDF #2825
-
Hi, I am tryin to delete annotations (highlight marker) from PDF document. But the following code does not work.
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Your code would only delete the responses to an annotation. These are things like PopUp annotation and any thread of text annotations marked as "IRT" ("in response to"). Your intention seems to be the following: annot = page.first_annot
while annot:
if annot.type[0] == fitz.PDF_ANNOT_HGIGHLIGHT:
annot = page.delete_annot(annot)
else:
annot = annot.next |
Beta Was this translation helpful? Give feedback.
-
Thank you so much for quick support ! I changed the typo to Thank you. |
Beta Was this translation helpful? Give feedback.
-
If anyone gets the following error when trying to delete annotations:
I believe this is related to #2484 (point 2) and also in the documentation appendix which makes it necessary to make the assignment |
Beta Was this translation helpful? Give feedback.
Your code would only delete the responses to an annotation. These are things like PopUp annotation and any thread of text annotations marked as "IRT" ("in response to"). Your intention seems to be the following: