I am trying to create hyperlink in PDF using visualforce renderAs = "pdf". Actually I don't want the simple link i.e. text link, instead of text link I want image icon and on click of that icon/image the site should open browser.

<apex:outputLink value="https://www.xyz.com">
    <apex:image value="{!$Resource.icon}" alt="icon"/>

Using above code, the icon is properly visible in PDF but does not act as a hyperlink. Is it even possible? Please help.

  • 1
    did you try wrapping it in an <a href="..........><apex:image......../></a>
    – Eric
    Aug 22, 2015 at 13:53
  • 1
    Yes I tried that, but didn't work. Aug 22, 2015 at 13:54

1 Answer 1


I got it to work on my system by going with pure html:

<a href="https://www.xyz.com">
    <img src="{!$Resource.icon}" alt="icon"/>
  • Thanks for your help. It works perfectly for me. Actually conclusion is <apex:image> tag is not working with anchor tag Aug 22, 2015 at 14:56
  • Interesting. <apex: outputlink> and <apex:image> are on the list of Components That Are Safe When Rendering as PDF. Glad you got it sorted. By chance, was this an HTML5 page or was there anything else unique about it, such as a class applied to the image/link?
    – crmprogdev
    Aug 22, 2015 at 15:07
  • 1
    @crmprogdev I was surprised too, but I was able to reproduce the problem just by putting the <apex:outputLink> and <apex:image> in a <apex:page renderas="pdf"> tag without doing anything else. Using an <apex:outputLink> and a <img> tag didn't work for me either, I was only able to get it to work with the pure html version.
    – martin
    Aug 23, 2015 at 4:56
  • I can't help but wonder if it has something to do with the type of image being an icon as opposed to a jpg or png. Very curious behavior. Thanks for reporting back. Good info to share.
    – crmprogdev
    Aug 23, 2015 at 6:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .