I spend hours to find a way to control download behavior of pdf-files (when to download and when to show inline) and did not find anything.

What I got so far:

the main thing that do all files magic is

/sfc/servlet.shepherd/ ....

  1. We can download file by:

    • ContentVersion Id - /sfc/servlet.shepherd/version/download/<VERSION>
    • ContentDocument Id - /sfc/servlet.shepherd/document/download/<DOCUMENT>
    • Zip archive by Ids separated by slash - /sfc/servlet.shepherd/version/download/<VERSION 1>/<VERSION 2>?
  2. For some reason in salesforce download links we can find the following parameter operationContext=S1 OR operationContext=CHATER, which seems do nothing

  3. Also servlet.shepherd can show preview image of pdf /sfc/servlet.shepherd/version/renditionDownload?rendition=SVGZ&versionId=<VERSION>, where ?rendition= can be:

    • SVGZ
    • THUMB120BY90
    • THUMB240BY180
    • THUMB720BY480

All these options are not covered by official documentation and I feel there could be much more features. Does anybody know other options? Is there any documentation explaining all possible options?

UPD: Added option with multiple files download as a zip provided by @cropredy

  • I would love to know if we can force inline behavior vs download, for pdfs I want it to open in browser window but it seems to just download the document and then the user has to click the download to open it. – Scott Morrison Feb 12 '19 at 14:31

You can also download multiple files as a zip

{!URLFOR('/sfc/servlet.shepherd/version/download/' & delimitedSelectedIdList &'?')}



more details on my blog

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.