2

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...

3
  • 2
    Does the image appear correctly in the Visualforce page if you don't render it as a PDF? Jun 8, 2014 at 19:24
  • No..it is not appearing in VF page and render as pdf..I don't know why..?
    – miku
    Jun 8, 2014 at 19:32
  • 1
    If it isn't appearing in the HTML version of the Visualforce page I'd check the URL that is being returned in the img tag. Is it referencing a valid URL and image? Jun 8, 2014 at 19:35

1 Answer 1

1

I got the solution

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

I have used this and its working perfectly.

Thanks

You must log in to answer this question.

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