How to generate pdf from aura lightning component -- w3web.net

How to generate pdf from aura lightning component and send pdf file to (Notes & Attachments) Using Blob apex to generate pdf file in Salesforce | How to generate/view PDF using Lightning Components and send to “Notes & Attachments” using Apex Bolb to generate pdf in Salesforce

233 views

Hey guys, today in this post we are going to learn about How to generate/view PDF using Lightning Components and send to “Notes & Attachments” using Apex Bolb to generate pdf in Salesforce.

There are two methods to show a PDF in Lightning Component. First, you can create a Visualforce page and embed it in the Lightning component. Second is, usage of PDF. JS library to directly use lightning component to display the PDF. To know more about generate pdf from aura component, Click Here.

Files we used to generate pdf in Lightning Component →

SalesAccountOrderFormPDF.cmp Lightning Component It is used to display spinner loading on the page.
SalesAccountOrderFormPDFController.js JavaScript Controller It is hold Javascript doInit function to connect javascript controller to helper function.
SalesAccountOrderFormPDFHelper.js JavaScript Controller Helper It is hold Javascript SendOrderPdfHelper function to generate the pdf file from lightning component.
SendOrderPdfCtrl.apxc Apex Class Controller It is used for generate pdf using Bolb Apex in lightning component.
SalesAccountOrderFormPDFVfp.vfp Visualforce Page It is render as pdf from visualforce page.
SalesAccountOrderForm_Controller.apxc Apex Class Controller It is used for get get the current record of Account.

 

Final Output →

generate pdf from lightning component -- w3web.net

 

Other related post that would you like to learn in Salesforce

 

  • Find the below steps ▾

 

Create Lightning Component

Step 1:- Create Lightning Component : SalesAccountOrderFormPDF.cmp

From Developer Console >> File >> New >> Lightning Component

SalesAccountOrderFormPDF.cmp [Lightning Component File]

 

Create JavaScript Controller

Step 2:- Create Lightning Component : SalesAccountOrderFormPDFController.js

From Developer Console >> File >> New >> Lightning Component >> JavaScript Controller

SalesAccountOrderFormPDFController.js [JavaScript Controller]

 

Create JavaScript Helper

Step 3:- Create Lightning Component : SalesAccountOrderFormPDFHelper.js

From Developer Console >> File >> New >> Lightning Component >> JavaScript Helper

SalesAccountOrderFormPDFHelper.js [JavaScript Helper File]

 

Create Apex Class Controller

Step 4:- Create Apex Class : SendOrderPdfCtrl.apxc

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

SendOrderPdfCtrl.apxc [Apex Class Controller]

 

Create Visualforce Page

Step 5:- Create Visualforce Page :
SalesAccountOrderFormPDFVfp.vfp

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

SalesAccountOrderFormPDFVfp.vfp [Visualforce Page]

 

Create Apex Class Controller

Step 6:- Create Apex Class : SalesAccountOrderForm_Controller.apxc

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

SalesAccountOrderForm_Controller.apxc [Apex Class Controller]

 

Further post that would you like to learn in Salesforce

 

 

FAQ (Frequently Asked Questions)

How do I render a VF page as a PDF?

We can render any page as pdf by adding renderAs attribute to and specifying “pdf” as value. renderAs value is name of any supported content converter. Currently PDF is the only supported content converter.

Can we generate PDF in aura?

You cannt generated PDF by using lightning component direcly .. use need to use the visualforce page and call its from the lightning exp. There are two methods to show a PDF in Lightning Component. First, you can create a Visualforce page and embed it in the Lightning component.

Can we render aura component as PDF?

Displaying the aura component in a separate tab then letting the user just download the page contents using regular browser functionality. Displaying the aura component in separate tab then using an external library to take screenshot of the page, then exporting as downloadable PDF.

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