PDF Preview of File

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:

With this

``

````

``

`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=[quote="Rob_Hatch, post:4, topic:13426, full:true"]
Hrmm...  somthing happend with your image preview....   Can you try again?
[/quote]

&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"/>