Skip to content

Exception while getting hyperlink URI #52

@velpukondaramesh

Description

@velpukondaramesh

Exception in thread "main" java.lang.ClassCastException: com.aspose.pdf.LaunchAction cannot be cast to com.aspose.pdf.GoToURIAction

`Document document = new Document("C:\Users\admin.v.ramesh\Downloads\hyperlink to file.pdf");
Page page = document.getPages().get_Item(1);

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

page.accept(selector);
List list = selector.getSelected();
// Iterate through individual item inside list
if (list.size() == 0)
System.out.println("No Hyperlinks found..");
else {
// Loop through all the bookmarks
for(LinkAnnotation annot : (Iterable<com.aspose.pdf.LinkAnnotation>)list)
{
//Annotation an = (Annotation)annot;
// Print the destination URL
System.out.println("URL: " + ((com.aspose.pdf.GoToURIAction)annot.getAction()).getURI());
}
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions