How to provide downloadable PDF files on a Community Page?
Hi Michael,
You can check my post (http://salesforceprofs.com/how-to-download-files-in-salesforce-community/), where I explain how you can create the download link in APEX.
String fileDownloadUrl = URL.getSalesforceBaseUrl().toExternalForm() + '/sfc/servlet.shepherd/document/download/' + contentDocument.Id + '?operationContext=S1';You need also check, that you file is shared with community user. If not, you need share by APEX code, because you cannot share documents manually with community users.
ContentDocumentLink contentDocumentLink = new ContentDocumentLink( LinkedEntityId = recordIdWithWhichYouWantToShareFile, ContentDocumentId = contentDocumentIdWhichYouWantShare, shareType = 'V', Visibility = 'AllUsers' ); insert contentDocumentLink ;Feel free to ask!
Regards,
Piotr
0 thoughts to “Download page as pdf salesforce community”