Skip to content
Discussion options

You must be logged in to vote

Link, annotations and fields are handled as 3 different object types by MuPDF - although PDF uses the same technical basis for all of them.
So links and fields will not occur in iterator page.annots(). Similarly, only fields will occur in page.widgets().
Your example has a link and a (text) annotation. The link will not be returned in neither page.annots() nor page.delete_annot().
You could simply modify your above while statement: while annot and annot.type[0] in (... applicable numeric annot types):.

Or do this:

alist = [a for a in page.annots(types=(...))]
for a in alist:
    page.delete_annot(a)

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by qwertynik
Comment options

You must be logged in to vote
3 replies
@JorjMcKie
Comment options

@JorjMcKie
Comment options

@qwertynik
Comment options

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