简体   繁体   中英

How do I make hyperlinks in a PDF open in AdobeReader rather than web browser?

I have implemented functionality to interlink a bunch of PDFs by adding hyperlinks in each PDF using PDFBox.
Here is the code:

PDAnnotationLink txtLink = new PDAnnotationLink();
PDActionURI action = new PDActionURI();
Uri fileUri = new Uri(filePath);
action.setURI(fileUri.ToString());
txtLink.setAction(action);

But the problem is that when I click on a hyperlink in a PDF, it opens in a web browser rather in another instance of Adobe Acrobat reader.

So, how do I make the PDF open in the default program selected for PDFs rather that in the browser.

Edit: The hyperlinks path are like

file:///C:/Users/Administrator/Desktop/Oliver%20Unlinked%20set%20-%20Copy/A8.1%20-%20INTERIOR%20ELEVATIONS.pdf

PDF paths must be in something they call device-independent form. See example below. Also, by including the protocol in your link (file://), you are actually telling Acrobat to open it in a browser.

/c/Program Files/Adobe/Acrobat DC/Help/AcroHelp.pdf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM