[SalesForce] Image not showing in render as pdf..

I have created a VF page as render as PDF..I am creating PDF from Opportunity and showing all products and total price in PDF..Everything is coming fine except the product image which is coming from Product.

I have a formula field on Opportunity Product

ProductImage__c

IF(PricebookEntry.Product2.DefaultImageId__c == null, 
IMAGE("/resource/defaultProductImage", "No Product Image", 75, 75), 
IMAGE("/servlet/servlet.FileDownload?file=" + PricebookEntry.Product2.DefaultImageId__c, "Image", 75, 75))

In DefaultImageId__c i have image recordid.

VF Page

  <apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line">
      <tr>
         <td>{!line.PricebookEntry.Name}</td>
         <td>{!line.Description}</td>
         <td ALIGN="center">

        **<img src='{!line.ProductImage__c}'/>**

          </td>            
         <td>{!line.Quantity}</td>
         <td><apex:OutputField value="{!line.UnitPrice}"/></td>
         <td><apex:OutputField value="{!line.TotalPrice}"/></td>
      </tr>
   </apex:repeat>  

My image in PDF is broken.Can someone please hemp me out why image link is broken.

I will really appreciate any help…

Best Answer

I got the solution

 <apex:outputText value="{!line.ProductImage__c}" escape="false"/>

I have used this and its working perfectly.

Thanks

Related Topic