How do I delete all internal links in a PDF document?

Q: I have a pdf document with links in it. I would like to delete all
internal links of the document using PDFNet; what is the best and
easiest way to do it?
A: You could traverse all annotation is a PDF document (as shown on
Annotation sample project -
Whenever you encounter an annotation of type 'Annot.Type.e_Link' and
link action of type GOTO (annot.GetLinkAction()==Action.Type.e_GoTo)
you could either rest the link or erase the annotation object
(page.AnnotRemove(annot) - because AnnotRemove() changes the size of
the annotation array you will probably want to traverse the
annotations in the reverse order [i.e. from last to first]).

In case you would also like to delete all internal links from the
outline/bookmark tree, you can traverse then as shown in Bookmark
sample project -
The logic here is very similar. Whenever you encounter a bookmark item
with action type 'Action.Type.e_GoTo' you can delete the bookmark (or
remove the link destination).