save Pdf as a attachement in salesforce -- w3web.net

Save the Attachment as PDF using Apex Class and Visualforce Page on click button in Salesforce | How to save instantly my pdf visualforcepage as a file/attachment on click button in Salesforce | Rendering a VF page as PDF and saving it as an attachement in Salesforce

1,085 views

Hey guys, today in this post we are going to learn about How to save instantly my pdf visualforcepage as a file/attachment on click button in Salesforce.

You can use the PageReference.getContentAsPDF() method in Apex to render a Visualforce page as PDF data. Then use Apex code to convert that PDF data to an email attachment, a document, a Chatter post, and so on. To know more details about Render a Visualforce Page, Click Here.

 

Files we used to Save the Attachment as PDF using Apex Class in Visualforce Page →

savePdfVfp.vfp Visualforce It’s holds “Save Attachment” and “Cancel” Button Functionality.
savePdfVp.vfp Visualforce It is render as pdf from visualforce page.
saveVfPdfCtrl.apxc Apex Class Controller It is used to generate pdf using Bolb Apex and Save file as pdf in file/attachment in Salesforce.

 

Final Output →

save Pdf as a attachement in salesforce -- w3web.net

 

Other related post that would you like to learn in Salesforce

 

  • Find the below steps ▾

 

Create Visualforce Page

Step 1:- Create Visualforce Page : savePdfVfp.vfp

From Developer Console >> File >> New >> Visualforce Page

savePdfVfp.vfp [Visualforce Page]

 

Create Visualforce Page

Step 2:- Create Visualforce Page : savePdfVp.vfp

From Developer Console >> File >> New >> Visualforce Page

savePdfVp.vfp [Visualforce Page]

 

Create Apex Class Extension Controller in Visualforce

Step 3:- Create Apex Class : saveVfPdfCtrl.apxc

From Developer Console >> File >> New >> Apex Class

saveVfPdfCtrl.apxc [Apex Class Controller]

 

Further post that would you like to learn in Salesforce

 

 

FAQ (Frequently Asked Questions)

How do I save a VF page rendered as a PDF?

If you try to render a Visualforce page as a PDF document, usually the PDF document is displayed in the browser. Place the “Render PDF” button on the Account page. If you click the button, the PDF page appears in the browser.

How do I email a VF page from Salesforce?

It is possible to send email using Visualforce by creating a custom controller to deliver the message. The Apex Messaging. SingleEmailMessage class handles the outbound email functionality available to Salesforce.

How do I convert files to attachments in Salesforce?

Switch to Attachments and Notes migrator app from App Menu . Click on “Attachments to Files” tab. range to convert the attachment to files.

Related Topics | You May Also Like

  • Your reaction of the article ▾
 

Hi, This is Vijay Kumar behind the admin and founder of w3web.net. I am a senior software developer and working in MNC company from more than 8 years. I am great fan of technology, configuration, customization & development. Apart of this, I love to write about Blogging in spare time, Working on Mobile & Web application development, Salesforce lightning, Salesforce LWC and Salesforce Integration development in full time. [Read full bio] | | The Sitemap where you can find all published post on w3web.net

Leave a Comment