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
bozotheclownbozotheclown 

Accessing a PDF via a Commandbutton

Hello.  I am trying to create a commandbutton on a VF page that will open a PDF in a separate browser.  I know that I have to upload the PDF to the Documents object - but I am not sure what to do beyond that.  Any suggestions?

Thanks in advance.
Ramu_SFDCRamu_SFDC
The following two articles might help

http://stackoverflow.com/questions/12534067/visualforce-display-link-to-a-document-in-the-documents-folder

http://www.mindfiresolutions.com/Uploading-a-Document-into-Salesforce-using-Visualforce-Page-1593.php
PrasanntaPrasannta (Salesforce Developers) 
Hi,

After putting the pfd on document folder, on onclick event of <apex:commandButton>  use window.open method and give the path of the docmunet folder where the pdf is stored.

For example-

<apex:commandButton value="Convert to PDF"  onClick="window.open('/apex/orderReportPDF?id={!Opportunity.Id}');" />

Hope this helps.