Articles in this section
Category / Section

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

2 mins read


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:                                                                                                                                                                             

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment