+ Start a Discussion
Administrator 88Administrator 88 

Image is not rendering into PDF file

Hi all,

I am very new to the Visual Force Page, 

this is the code i am using to print image on to pdf, 
 
<apex:page standardController="Quotation__c" renderAs="pdf">

<html>
<body>
  
<table>
 <tr>
  <th>Forms</th>
  <th>
  <img src="https://na6.salesforce.com/servlet/servlet.ImageServer?
id=01580000001J0Gv&oid=00D80000000M4RR" height="50" width="250"/>
  </th>
  <td>price</td>
</tr>
</table>

</body>
</html>

</apex:page>

 
Best Answer chosen by Administrator 88
Arunkumar RArunkumar R
Hi,

Hope you are referring the Image from Document object. Your URL Seems to be wrong, to get exact image URL do the following steps,

Go to Document Tab --> Click the Document name that contains image --> Right click on that image --> Copy image URL --> Paste this URL in Code.
User-added image

This will solve your problem. If this solution helpful, mark this as a best answer.

Thanks.
 

All Answers

Arunkumar RArunkumar R
Hi,

Hope you are referring the Image from Document object. Your URL Seems to be wrong, to get exact image URL do the following steps,

Go to Document Tab --> Click the Document name that contains image --> Right click on that image --> Copy image URL --> Paste this URL in Code.
User-added image

This will solve your problem. If this solution helpful, mark this as a best answer.

Thanks.
 
This was selected as the best answer
Sai Ram ASai Ram A
Hi

Use this below Code, Few Best Practices for rendering as PDF
http://www.salesforce.com/docs/developer/pages/Content/pages_compref_additional_render_pdf.htm
http://www.salesforce.com/docs/developer/pages/Content/pages_quick_start_renderas_pdf.htm
 
<apex:page standardController="Quotation__c" renderAs="pdf">
<table>
 <tr>
  <th>Forms</th>
  <th>
  <apex:image value="{!URLFOR($Resource.pdfresource, 'logo.gif')}"/> <!--Suggestable-->
  <apex:image value="/servlet/servlet.ImageServer?id=01580000001J0Gv&oid=00D80000000M4RR"/> <!--Suggestable-->
  <!--<img src="https://na6.salesforce.com/servlet/servlet.ImageServer?id=01580000001J0Gv&oid=00D80000000M4RR" />  -->
  </th>
  <td>price</td>
</tr>
</table>
</apex:page>

User-added image

P.S.  If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.

Thank you
BLearn - Sai