Skip to end of metadata
Go to start of metadata

Links are represented as annotations in a PDF file and they can be added, updated or deleted. Aspose.PDF for Java also supports getting the destination (URL) of hyperlink in a PDF file.

To get a link's URL:

  1. Create a Document object.
  2. Get the Page you want to extract links from.
  3. Use the AnnotationSelector class to extract all the LinkAnnotation objects from the specified page.
  4. Pass the AnnotationSelector object to accept(..) method of Page instance.
  5. Get all the selected link annotations into an List object using the AnnotationSelector object's getSelected(..) method.
  6. Finally extract the LinkAnnotation as GoToURIAction.

The following code snippet shows how to get hyperlink destinations (URL) from a PDF file.

Labels
  • No labels