Articles in this section
Category / Section

How to insert hyperlinked image in PDF?

1 min read

You can achieve the hyperlinked image in PDF using PdfUriAnnotation. You can add the annotation in PdfPage and draw the image in PdfPage at the same bounds of annotation using PdfGraphics.

Refer to the following code example to draw the image at specified url annotation bounds.


// Create a new instance of 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 = "";
url2.Border = new PdfAnnotationBorder(0, 0, 0);
//Add the color
url2.Color = new PdfColor(Color.White);
//Add the annotation

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