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
Raghavendra M 13Raghavendra M 13 

How to save PDF attachment using Lightning Component?

When clicking on a lightning button displaying a visual force pdf page , how can i insert that pdf attachment in notes and attachments
Pradeep SinghPradeep Singh
Hi,
please refer 
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_lightning_fileUpload.htm

If this solves your problem, mark it as solved.
Raghavendra M 13Raghavendra M 13
The following is my scenario:
When clicking on a lightning button displaying a visual force pdf page , how can i insert that pdf attachment in notes and attachments
 
Pradeep SinghPradeep Singh

You can use 2 VF pages for that.One page contains button to save PDF as attachments and contains 2nd page(rendered as PDF) in iFrame.
When clicking on save button run a controller method to save the PDF as attachment. 

Use something like this your method. 

currentid = Apexpages.currentPage().getParameters().get('Id');
PageReference pageRef = new PageReference('/apex/newinvoice?id='+currentid);
pageRef.setRedirect(true);
Blob pdfBlob = pageRef.getContentAsPDF();  
Attachment att = new Attachment();                    
att.Name = 'Pradeep'+'_'+ string.valueOf(System.today())+'.pdf'; 
att.ParentId = currentid;
att.Body = pdfBlob;