I am using ItextSharp for searching internal links in a PDF file. This is already done with External Links.
You've already done most of the work.
In iText 7 for Java your code will be the following:
As you see, you don’t need to get the array of annotations yourself and convert annotation object to the
PdfDictionary, as it was done in iText 5. Just use built-in methods.
Please take a look at the following screen shot:
You see the
/Annots array of a page. You are already parsing that array in your code
and you skip all annotations that aren't of the
/Link or don't have an
/A key, which is excellent.
Currently you're only looking for values of
/S that are of type
You say you're already done with external links, but that's not true:
you should also look for entries where
/GoToR (remote goto).
If you want internal links, you need to look for
/S values equal to
and (in the future)
/GoToDp. Maybe you also want to remove the
because they can also be used to jump to a specific page.
Click this link if you want to see how to answer this question in iText 5.