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:
Internal view of the PDF
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
/URI. 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
/GoToE, and (in the future)
/GoToDp. Maybe you also want to remove the
Click this link if you want to see how to answer this question in iText 5.