We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to relink hyperlinks in the HTML to PDF Converter file?

Platform: ASP.NET Web Forms (Classic) |
Control: PDF


To relink hyperlinks from HTML to PDF, convert the HTML to PDF by using the HtmlToPdfResult and then append the PDF file that has to be navigated.  Hyperlinks are converted to the PdfDocumentLinkAnnotation in PDF.  So, the file can be loaded and added to the page in the PdfDestination by using the PdfDocumentLinkAnnotation.

The following code example displays the same.

  1. HTML TO PDF Conversion.


using (HtmlConverter htmlConverter = new HtmlConverter())
htmlConverter.EnableHyperlinks = true;
//Converts HTML to PDF.
using (HtmlToPdfResult result = htmlConverter.Convert(path, ImageType.Metafile,
(int)width, -1, Syncfusion.HtmlConverter.AspectRatio.None))
if (result.RenderedImage == null)
// Draws metafile in the PdfPage.
result.Render(page, metafileFormat);


  1. Append the Document and Relink by using the PdfDocumentLinkAnnotation.


//Loads the document to be appended.
PdfLoadedDocument document = new PdfLoadedDocument (Bookmark.pdf"));
//Adds the Document Link.
for (int i = 0; i < pdfDoc.Pages[0].Annotations.Count; i++)
PdfDocumentLinkAnnotation annotation = pdfDoc.Pages[0].Annotations[i] as
annotation.Destination = new PdfDestination(pdfDoc.Pages[i]);

Sample Link:     https://www.syncfusion.com/downloads/support/directtrac/general/RelinkHtmltoPdf1294067253.zip                                                                                                                                                                             

You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile