We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Check existance of hyperlinks in PDf


Is there a way to detect if a document contains hyperlink in a pdf document.


Hi Rajeev,

Thanks for contacting support.

In order to accomplish your requirements, please try using following code snippet.


//Open document<o:p></o:p>

com.aspose.pdf.Document document = new com.aspose.pdf.Document("c:/pdftest/update_Service_Work_Order.pdf");

//Extract actions

Page page = document.getPages().get_Item(1);

com.aspose.pdf.AnnotationSelector selector = new com.aspose.pdf.AnnotationSelector(new com.aspose.pdf.LinkAnnotation(page, com.aspose.pdf.Rectangle.getTrivial()));


List list = selector.getSelected();

// Iterate through individual item inside list

if (list.size() == 0)

System.out.println("No Hyperlinks found..");



// Loop through all the bookmarks

for(com.aspose.pdf.LinkAnnotation annot : (Iterable)list)


// Print the destination URL

Destination: "
+ ((com.aspose.pdf.GoToURIAction)annot.getAction()).getURI()+ "


end else