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
SkiesnPiesSkiesnPies 

getContentaspdf with Attached Images

Hi, I have a problem with images not rendering correctly in my PDF's if I use getContentAsPDF . They they render fine if I view them in the VF page directly in the browser though (so I know the URL works fine for my image). 

My VF page has an image tag like this : 
<apex:image url="https://c.na11.visual.force.com/servlet/servlet.FileDownload?file={!AttachmentID}"/>    

Note : I hard coded the full instance name as a test - I have tried also using just a relative path

When I open my page and pass in the attachment ID, the image renderes fine but when running from my my VF controller using getContentAsPDF (I am wanting to attach the PDF as an attachment to a custom object) , the image displays broken like this : 

Broken Image

I had read that it was possible to do what I am doing, and I read you needed to set up remote site settings - which I did (see screen shot below) 

Remote site settings
Did I get my remote site settings wrong? Is what I am trying to do actually possible? Did I do something dumb? It seems a viable way to do things but I am stumped as to why it won't now work....

Any ideas? 
SkiesnPiesSkiesnPies
Update : I just noticed, if I view my content in the browser as HTML it renders fine, but if I switch the VF page to RenderAs="PDF" the images break then too.