I have tried to pass the parameter via the vf page from @AuraEnabled method to generate pdf. It does not call the vf page constructor. How can we pass a parameter via the vf page from @AuraEnabled (static)method to normal class?
@AuraEnabled
public static void genearatePDF(List<String> lstOppId) {
PageReference pdf = Page.GenerateOPPPDF;
pdf.getParameters().put('wrapperclass', System.JSON.serialize(wcf));
pdf.setRedirect(true);
system.debug('!!!pdf'+pdf);
}
Apex class:
public class GenerateOPPPDF {
public String headings {get;set;}
public GenerateOPPPDF() {
List<string> lstId = new List<String>();
headings =Apexpages.CurrentPage().getParameters().get('wrapperclass');
system.debug('!!!headings-'+headings);
}
}
VF Page:
<apex:page controller="GenerateOPPPDF" renderAs="pdf"
showHeader="false" sidebar="false" standardStylesheets="false" applyBodyTag="false" applyHtmlTag="false">
Generate PDF-{!headings}
</apex:page>