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
System Admin 949System Admin 949 

Generating the Pdf using Lightning Components

Hi All,
I am trying to create the pdf form for using  Quote/any object details in salesforce.for this i am using lightning components.I am new to the lightning components.can any one provide the lightning material to learn lightning components perfectly.can provide the some sample code to create the lighting components to generate the Pdf for Quote object.
thanks in advance
Raj VakatiRaj Vakati


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. 
Second is, usage of PDF.JS library to directly use lightning component to display the PDF.

refer this links

https://medium.com/@ToAnshulVerma/salesforce-lightning-generate-pdf-from-lightning-components-with-in-memory-data-cd5dffe0fe25
https://salesforce.stackexchange.com/questions/205065/how-to-generate-view-pdf-using-lightning-components/205227
http://www.vermanshul.com/2017/07/lightning-generate-pdf-from-lightning.html
Bhargavi TunuguntlaBhargavi Tunuguntla
Hi 

You cannot directly generate PDF as we do in Visual force page using 'renderAs' But instead you can embed the visual force page in lightning component which inturns does the funtionality required.Please refer the below link:

https://salesforce.stackexchange.com/questions/205065/how-to-generate-view-pdf-using-lightning-components/205227

http://www.vermanshul.com/2017/07/lightning-generate-pdf-from-lightning.html


Hope this will be useful.

Thanks 
Bhargavi.
amrita h 7amrita h 7
As of now i dont think thaere is feature exist to generate Pdf from lighting component. Here is an idea posted for the same. please upvote and help to get it done in the next releases.

https://success.salesforce.com/ideaView?id=0873A000000U3GIQA0 
Dhanik L SahniDhanik L Sahni
Hello,

You can try below code for PDF generation  (https://salesforcecodex.com/salesforce/send-email-template-as-pdf-attachment-using-salesforce-apex/)

Thank You,
Dhanik