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

Image Issue On Sites When Rendering As Pdf

Hi all,


We are working on a sites project and we need to show images on a pdf file. We could see the images on visualforce pages actually. But in sites, we can't see what we expect. Is there a specific way to handle this in sites?




Need some info

  • Where are some images stored ?
  • Attachment or Documents or Static resources ?

Images are stored as Attachments under Accounts right now but we can change them as Documents if it'd be necessary.


So few things I would like you to test

  • Remove the renderAs and check if images appear ?
  • Does the image appear in internal VF pages ?
  • Do you have given access to account for the Site Guest User ?
  • Yes, image appears when removed renderAs
  • Yes, image appears in internal VF pages
  • No, we are using Authenticated Website (Customer Portal SiteLogin mechanism). Guest users can not enter the site but they can register as new user.
What is the image url that you are using in the image tag ?

Something like that:


and this the method that we wrote in controller:


public String getGetLogo() {
        Attachment att = null;
            att = [Select id From Attachment Where parentid=:eg.account_id__c AND name='logo.png'];
        }catch(Exception e){return '';}

        return '' +;


Can you use a relative URL something like "/servlet/servlet.FileDownload?file=00Pb0000000vqDM"

I tried but images didn't appear.


I think I'm going to give up this idea and try to find a new perspective for my output pdf file.






There is a possibility that this is a bug.  Please review the following post and see if it applies to your site.  If so, it is a known issue and you should add yourself as an affected user.  Unfortunately, if it is a bug, there is no workaround yet.
 site that uses custom web address setup does not load static resource CSS when renders a VF page as PDF


Last updated Yesterday ·Reference W-1594833 ·Reported By 2 users

In Review

Unable to render a static resource or image if a VF page is rendered as PDF. The VF page is invoked from a custom web address that has a CNAME for site.

- Use renderAs="PDF" in <apex:page> which includes static resource components.
- Exposed the page to the Site.
- Create a Custom Web Address for the Site.
- Try to access the page from the custom web address.
- The static resource does not render in the pdf

- N/A



Thanks for reply Michael,


Instead of image tag, I used outputTextField to show image for now. Firstly, I added image as a new rich text custom field. The current problem is that I can't resize image file with css. Actually, it resizes the image on VF page but