Search code examples
c#itext

itextsharp image with hyperlink


I have created a pdf with an image in it using itextsharp library and c#. Now i need to have a hyperlink on that image so that when clicked on it, it goes to a specific site. How do i do it? I was trying to find a property linked to the image object but couldn't.


Solution

  • You must use an Anchor

    Chunk cImage = new Chunk(yourImage, 0, 0, false); 
    Anchor anchor = new Anchor(cImage); 
    anchor.Reference = "www.yourAddress.com"; 
    document.Add(anchor);