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

Free Support Forum - aspose.com

Aspose PDF Java Open hyperlink in new browser window

Hi Sir,

I am embedding a hyperlink in the existing pdf document. When opening pdf in normal pdf reader ,the hyperlink is open fine in the browser. But when PDF is opened in browser window then hyperlink is opened in the same window taking over the opened pdf. Is there any way so that hyperlink opens in a new window?. I am using Aspose PDF java version 11.5.0.
Here is the code am using:

Document doc = new Document(inputStream);
doc.setOpenAction(new GoToURIAction(trackingUrl));

Please give me some solution. Thanks


Please note, Adobe Acrobat does not support opening hyperlink in the new browser window. There is a similar question about opening a new browser window from a PDF link: Hyperlinks to open in new browser window. One way round is to add the JavaScript as narrated in the PDF link. Aspose.Pdf for Java API has support of adding JavaScript code, please refer to this help topic: Adding JavaScript