in URL to download PDF files from ContentVersion in a public site.

Is there anyway to get a PDF file to open in a browser instead of Downloading it after clicking the URL.

  • Where does this url come from? Commented Jan 5, 2017 at 13:41
  • For example: myDomain.force.com/mySite/sfc/servlet.shepherd/version/download/… The download link works just fine, the problem is that browser downloads the file straight away. I need it to be opened in browser instead.
    – G Takei
    Commented Jan 5, 2017 at 14:10
  • It depends on the browser you use. With Google Chrome, the pdf is opened in the browser, not downloaded. If you want to show it on the browser, you can use an iframe like this: stackoverflow.com/questions/4853898/… Commented Jan 5, 2017 at 14:14
  • The problem is that the file comes from Salesforce servlet and it's not a straight link to the file like something.pdf. Somehow I guess I should catch first whatever comes from the download link and if it's a pdf then show it like in the example you showed.
    – G Takei
    Commented Jan 9, 2017 at 7:19

1 Answer 1


This was actually solved by setting the pdf filetype to 'Execute in Browser' from Setup -> Security -> File Upload and Download Security

  • Thank you sir!!
    – umithuckan
    Commented Jul 13, 2021 at 18:16

You must log in to answer this question.

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