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
Chris HeathChris Heath 

PDF rendered page not displaying image

This is my third time trying to post this question... Third time's the charm?

Hello all,

I'm having an issue trying to display an image in a PDF rendered Visualforce Page. The image's URL is stored in a field on the object controlling the page.

I've tried using <apex:image...> and <img src...>. Using the actual URL works just fine and displays the image. Removing the renderAs="pdf" displays all images correctly.

Any help would be much appreciated.

Thank you!

Code snippet:

<apex:page standardController="Order__c" showheader="false" standardStylesheets="true" renderAs="PDF">

<apex:pageBlock >
<apex:image value="ImageStoredAsDocument" width="98%"/> <!-- this displays fine -->

        <img src="{!Order__c.CustomField_URL__c}" /> <!-- this does not display when rendered as PDF -->
        <img src="ActualURL" /> <!-- this displays fine -->

Best Answer chosen by Chris Heath
Can you view the source and double check the URL is showing as expected?

All Answers

Have you tried 

<apex:image value="{!Order__c.CustomField_URL__c}" width="98%"/>
Chris HeathChris Heath
logontokartik, yes, I have tried that with the same results of the image not showing up corrcetly.

Thank you for response!
Bhawani SharmaBhawani Sharma
Can you please make sure, you have Order id in URL when rendering as PDF?
Chris HeathChris Heath
Bhawani Sharma, I do - I am using many other fields from this object on the rest of the page.

Thank you!
Can you view the source and double check the URL is showing as expected?
This was selected as the best answer
Chris HeathChris Heath
Gigi.Ochoa, thank you. I thought I had checked the source URL to be showing up as expected, but apparently didn't look close enough. I tweaked the formula field holding the URL a bit and was able to get the image to display.

Thanks again!
Glad you were able to get it to work!