+ Start a Discussion
Sascha DeinertSascha Deinert 

PDF File preview

in Salesforce lightning in files or Notes/Attachments of a contact or account you can see a preview of the first page from a stored pdf.
How is that possible?

Here is the code which I extract from the page.
<img src="https://DOMAIN.content.force.com/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB120BY90&amp;versionId=0688E00000091mE&amp;operationContext=CHATTER&amp;contentId=05T8E0000009v54" class="thumbnailImg medium" alt="PDF">

User-added image

Mustafa JhabuawalaMustafa Jhabuawala

Behind the scenes lightning framework does this work while uploading the file, some code creates a thumbnail while uploading the file which can be done using some javascript.

There are multiple javascript & jquery plugin available to perform such operations. I cannot say that which plugin or code is used by lightning behind the scenes but this is possible using scripting.

Here is a jQuery plugin for an example (http://www.phpgang.com/how-to-show-image-thumbnail-before-upload-with-jquery_573.html

Hope you find this helpful.