Professional Documents
Culture Documents
Justme
Justme
Components
Dear Community,
I am new to Lightning experience,i have some knowledge about lightning.i tried to
generate the pdf for Account or any standard or custom object.i wrote the some logic
the pfd is generated with empty sheet,i want all the fields of the perticular object which
is i mentioned.i think i missed some logic in my components/controllers.
can any one suggest where i did mistake and also can tell me how to generate the pdf
for perticular object either custom or standard
my code is
Apex class:
public class DataDisplayController {
public String PDFData{get;set;}
public DataDisplayController(){
PDFData = '';
}
public PageReference downloadPDF(){
System.PageReference pageRef = new
System.PageReference('/apex/PDFGenerator');
//ensure pdf downloads and is assigned with defined name
pageRef.getHeaders().put('content-disposition', 'attachment;
filename=TestPDF.pdf');
return pageRef;
}
}
Component:
<aura:component >
<aura:attribute name = "sendData" type = "Account"/>
<lightning:button label = "Download Document" onclick = "{!c.downloadDocument}"
/>
</aura:component>
client-side controller.js
({
downloadDocument : function(component, event, helper){
App:
<aura:application extends = "ltng:outApp" >
<c:DataProcessor />
</aura:application>
thanks in advance