function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFNewbie2k11SFNewbie2k11 

Adding image of product to Quotes PDF visual force page

Hi all, 

 

I have been asked to investigate how to help our client who wants a pdf quote document with the image of the product attached to it. We have our own built in quote system for products and was wondering if there was someway using rich text html to attach an image or if there is any other way to attach an image.

 

Thanks for all your help in advance!

 

-SFNewbie

Felipe FernandesFelipe Fernandes

You can use this code:

 

 

<apex:image value="{!line.PricebookEntry.Product2.Picture}" width="120" height="120"/>

 

 

In my case "Picture" is the URL field that i created in Products. The only issue i have is: I can't show external images, only images uploaded on sales force.

 

I'm asking for help too, if someone knows how can i show external images.

 

Thanks!!

 

Felipe.

Juan SpagnoliJuan Spagnoli

When you render the page as HTML, all the links to images are resolved locally by your browser. When you use the PDF rendering, is Salesforce who have to resolve images, so it needs access to the image's hosting, if it doesn't have access, the image is broken.

 

You need to modify your "Security Controls > Remote Site Settings" and add the site host of your images to the allowed sites list. 

 

Regards

Balamurugan ThanapalBalamurugan Thanapal
Good day,

Here is the code from a Visualforce page which let to generate PDF quote: 

<td ><center><apex:image rendered="{!if((right(line.PricebookEntry.Product2.Product_URL__c,7)=="file=NA" || line.PricebookEntry.Product2.Product_URL__c==""),"false","true")}" value="{!line.PricebookEntry.Product2.Product_URL__c}" width="90px"/></center> <!--<apex:image rendered="{!if((right(line.PricebookEntry.Product2.Product_URL2__c,7)=="file=NA" || line.PricebookEntry.Product2.Product_URL2__c==""),"false","true")}" value="{!line.PricebookEntry.Product2.Product_URL2__c}" height="70" />--> </td>

Where "Product_URL__c" is the name of the URL field in "Documents" with a link to an image uploaded to Salesforce. Here is an example of such link: https://c.ap2.content.force.com/sfc/servlet.shepherd/version/download/06828000008DjKT?asPdf=false&operationContext=CHATTER

However, 3 days ago it stopped work as it should be and now none images are available in just generated PDF quotes. 

Before we got this problem, I never paid attention on image availability, was it ticked as "externally available image" or not. Now I check and found that all of our images are not ticked as externally available. So, I made some of them externally available, but still nothing changed, they are not available in just generated PDF quote. 

Really have no idea where else can I try to look for a possible solution...

Thank you very much for your time and kind help,

Bala