Skip to main content
github.com



//github.com/skuid/SamplePages/tree/master/Salesforce_Advanced/Content_Document








I added “PDF” as an option, but it does not preview the uploaded PDF. See attached.


How can this be done?



PDF won’t work as a direct Image link, but never fear. I looked into this a while ago. Salesforce automatically creates a few ThumbNail “Renditions” of content document files. (See this stack exhange post ).


Change the URL in the modal as follows and I think Image files and PDF files will show a thumbnail. (And maybe other files as well…)


<img src="/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB240BY180&amp;versionId={{{LatestPublishedVersion.Id}}}&amp;operationContext=CHATTER&amp;contentId={{{Id}}}"/>


The options for rendition include:


  • THUMB120BY90

  • THUMB240BY180

  • THUMB720BY480

Use the size that works for you.


I think I updated that sample page about a month ago - but probably only updated the “Content Library” tab.


Thanks, Rob. I want to confirm that I am replacing the following:


renditionDownload?rendition=ORIGINAL_Png&versionId={{{ContentDocument.LatestPublishedVersion.Id}}}&operationContext=CHATTER&contentId={{{ContentDocumentId}}}


With this


``


`renditionDownload?rendition=THUMB240BY180&versionId={{{LatestPublishedVersion.Id}}}&operationContext=CHATTER&contentId={{{Id}}}```


``


`It looks like there were some other changes.```


``


`Cheers,```


Bill Fox


Hrmm… somthing happend with your image preview… Can you try again?


Try again. I want to confirm that I am replacing the following:


<img src="/sfc/servlet.shepherd/version/renditionDownload?rendition=
Hrmm... somthing happend with your image preview.... Can you try again?


&amp;versionId={{{ContentDocument.LatestPublishedVersion.Id}}}&amp;operationContext=CHATTER&amp;contentId={{{ContentDocumentId}}}" />

With this


<img src="/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB240BY180&amp;versionId={{{LatestPublishedVersion.Id}}}&amp;operationContext=CHATTER&amp;contentId={{{Id}}}"/>

It looks like there were some other changes.


Cheers,


Bill Fox


I’m not sure if this is helpful, but we view PDFs, images, anything really, using the following code, where {{{Id}}} is the Id of a Salesforce file attachment:


<embed src="/servlet/servlet.FileDownload?file={{{Id}}}" width="100%" height="800px"/>

Reply