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
WhyserWhyser 

VisualForce RenderAs PDF Not Rending External Image from Production Static Resource

i'm running into an issue using Visualforce trying to reference a static resource imageon my Salesforce Production instance from my Salesforce Sandbox instance. 

The Static Resource has it's cache control set to Public.

I'm aware that referencing external images require that the Remote site settings are set on my Salesforce Sandbox instance 

Remote Site Name: test
Remote Site URL: https://images.metropuzzle.com

Remote Site Name: Salesforce_Production
Remote Site URL: https://[mydomain].my.salesforce.com/

And with the following code
<apex:image value="https://images.metropuzzle.com/tmp/rgb-HP1361-3D2-1000px-300dpi_medium.jpeg" />

<apex:image value="https://[mydomain].my.salesforce.com/resource/XXXXXXXXX/Logo" />



I get the following results:
User-added image

What am I doing wrong?
VinayVinay (Salesforce Developers) 
Hi Whyser,

You can try below steps and see if that works.
  • Modify your user/s profile and enable "Create delivery content" under administrative permissions
  • Create new contentDistribution object, associating your contentVersionId on the related field (same name)
  • Once created, this object will have fields with a public URL where you can access your file ("ContentDownloadUrl" and/or "DistributionPublicUrl")
Please mark as Best Answer if above information was helpful.

Thanks,
WhyserWhyser
Just trying to understand, why do I need to create a new custom object to achieve this? I thought I could use Salesforce Files (with a public link) or Static Resources to accomplish this? Will the URL to the static resource be different than the one that I can reference directly from the static resource?
Arun Kumar 1141Arun Kumar 1141

Hi Whyser,
You must open any file in file and click the button labelled "public link" to obtain a public link that you can share with another user.User-added image
User-added image
User-added image
then right click on the image and click on "open image in new tab" then copy the url then put that url in the vf page then it will wotk

User-added image
Please mark as Best Answer if above information was helpful.