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. Commented Feb 12, 2019 at 14:31
  • 1
    @ScottMorrison, I don't think you can change that behavior programatically, but if you have a Visualforce page rendered as a PDF you can set 'content-disposition' header on the Visualforce page to determine what the browser does with it and there are also settings under "Setup" > "Security" > "File Upload and Download Security" to change how certain file extensions are handled by default within Salesforce (ex. ".pdf => download" or ".mp4 => execute in browser")
    – nbrown
    Commented May 13, 2020 at 23:33
  • Though the hardcoded URL method works, it isn't officially supported. So i would request you upvote this idea https://trailblazer.salesforce.com/ideaView?id=0874V000000PiVqQAK and share it as well. Direct access to the images will be really helpful for use in custom applications and components. Commented Aug 1, 2020 at 19:18
  • 1
    Please beware that servlet.shepherd has problems with special characters: In case the file name contains special characters (e.g. äüö) a files name is changed to the Id of the ContentDocument/ContentVersion . Commented Sep 23, 2020 at 10:24

3 Answers 3


You can also download multiple files as a zip

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



more details on my blog


Looks like there are some changes recently. I am seeing below pattern with API version 48

For authenticated users


For communities


ID in the URL being content document ID.

  • Thank you a ton. I didn't realize the communities url was prefixed now. Commented Jun 26, 2020 at 18:58

I came here because i have problem with displaying images on community site in incognito mode ( on the external user). Normally i can display when I'm login by my salesforce user using this src img:


I showed up here that for communities i should try with this :


But it still did not work. What can be problem? What should I check more over ?

  • SFSE is a Questions & Answers site, not a threaded forum. Please see the various pertinent/relevant notes in Why and how are some answers deleted?, and be aware that your "answer" will likely be deleted. You could ask a new question, and in it you can link to this question or one of its other answers for reference, if relevant and helpful.
    – Moonpie
    Commented Dec 4, 2022 at 22:02
  • If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review
    – Derek F
    Commented Dec 4, 2022 at 23:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .