How to insert hyperlinked image in PDF?
You can achieve a hyperlinked image in a PDF using PdfUriAnnotation. You can add the annotation to a PdfPage and draw the image on the PdfPage at the same bounds as the annotation using PdfGraphics.
Refer to the following code example to draw the image at the specified URL annotation bounds.
C#
// Create a new instance of the PdfDocument class. PdfDocument document = new PdfDocument(); // Add the page PdfPage page = document.Pages.Add(); // Image path string imagePath = @"..\..\Data\logo.png"; // Draw Image page.Graphics.DrawImage(PdfImage.FromFile(imagePath), new RectangleF(100, 70, 390, 130)); // Create URL annotation PdfUriAnnotation url2 = new PdfUriAnnotation(new RectangleF(100, 70, 390, 130)); // Add the link url2.Uri = "http://www.syncfusion.com"; // Border url2.Border = new PdfAnnotationBorder(0, 0, 0); // Add the color url2.Color = new PdfColor(Color.White); // Add the annotation page.Annotations.Add(url2);
Sample Link
https://www.syncfusion.com/downloads/support/directtrac/general/HyperLinkImage-1945722345.zip
Note:
Starting with v16.2.0.x, if you reference Syncfusion® assemblies from a trial setup or from the NuGet feed, include a license key in your projects. Refer to the link to learn about generating and registering the Syncfusion® license key in your application to use the components without a trial message.
Conclusion
I hope you enjoyed learning about How to insert hyperlinked image in PDF.
You can refer to our PDF feature tour page to learn about its other groundbreaking feature representations. You can also explore our documentation to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums or feedback portal. We are always happy to assist you!