function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Soumya sri yaravaSoumya sri yarava 

how to dowload pdf from the static resource in salesforce

Hi, i have  uploaded multiple pdfs in StaticResource ,and need to download the pdf depending upon the button click ,
how can i download the file  , iam using the below apexpage , but cant able to download the file, its jst opening in the other page.,


 
<apex:page action="{!URLFOR($Resource.employepdf)}"  >
</apex:page>

Note:It is getting; open in the other page, but the thing is need to download the pdf , how can it done, please let me know 


Thanks and regards,
soumya sree.
 
VinayVinay (Salesforce Developers) 
Try below 
<apex:page standardStylesheets="true" sidebar="false"> <a href="{!URLFOR($Resource.test_pdf)}">Click Here to Download Pdf File</a> </apex:page>
Also try using 'apex:outputLink'

Hope this helps...

Thanks,
Soumya sri yaravaSoumya sri yarava
hi vinay, thanks for ur reply, but i cant download the file, its getting open in the another tab, how can i acheive it to download the pdf, when clicks the button or link need to download it, 
thanks and regards
soumya ,
RituSharmaRituSharma
Try below code:
<apex:outputLink value="{!URLFOR($Action.Attachment.Download, $Resource.test_pdf)}" target="_blank">Click Here to Download Pdf File</apex:outputLink>