Link to External PDF in Html2PDF

Is there any specific HTML tag or notation by which the generated pdf will have a link to external pdf which will be opened with installed acrobat reader application.

For the following html I have tried to convert to PDF, and when i am trying to Click on Sample External Link, the pdf is getting opened in browser.

`

Site
Sample External Link Screened

`


But my requirement is to open the pdf in acrobat reader.

Could you please suggest any way to resolve this.

Regards,
Chinmaya

Hello Chinmaya,

Thank you for posting this question. It looks like this is not directly supported by HTML2PDF at this time. All links created by HTML2PDF go through the web browser.

However, it is possible to modify the PDF in question to launch in a PDF viewer instead of through the browser. At issue is the “Action” associated with each link annotation. Actions are used to determine how a link should be handled by a PDF viewer. HTML2PDF inserts “URI” actions, which tell the viewer to go through a web browser. What you want are “Launch” actions, which tell the viewer to launch files based on however the operating system launches that file type.

The annotation sample at http://www.pdftron.com/pdfnet/samplecode.html#Annotation shows how to loop over all the annotations of a PDF document. It shows how to find all Link annotations with URI actions. You would want to get the existing URI string for each annotation’s action, as the sample shows, and to strip out any unwanted information from that string (such as the “file:///”). Then use Action.CreateLaunch to create a new action with the file name, and Link.SetAction to associate it with the link annotation.

Please let us know if you run into any problems.