Is it possible to use images in Visualforce generated PDFs which are not static resources?

I’m trying to generate a Visualforce PDF (renderAs) with a variety of images from different sources includes Salesforce Attachments and Documents, as well as third party sites. So far I’ve only been able to display images stored as static resources, or stored in zipped static resources.

Is it possible to use images which are not stored as static resources in Visualforce-generated PDFs?


This should be possible: we do this in FinancialForce Accounting via the servlet.fileDownload URL that salesforce provides for downloading documents to include company logos on PDF financial documents.

The trick is that any external URLs you want salesforce to make a HTTP(s) call to need to be defined under Setup > Security Controls > Remote Site Settings. Make sure the protocol (HTTP vs HTTPS) matches the image link!

A followup edit that it appears that the older PDF rendering engine (pre APIv24?) does not pass a session ID when requesting images from salesforce documents. I made the image externally available and it worked – note that this changes the URL from servlet.FileDownload to servlet.ImageServer as well. V25 seems to pass the session ID as expected so far.

Source : Link , Question Author : paul , Answer Author : ca_peterson

Leave a Comment