Exporting sales invoice report as pdf

I am using ax 2012 R3.

static void LearningPDF(Args _args)
{
    args args = new args();
    CustInvoiceJour custInvoiceJour;
    SRSPrintDestinationSettings printSettings;
    SalesInvoiceController controller = new SalesInvoiceController();
    SalesInvoiceContract        salesInvoiceContract;

    select firstOnly custInvoiceJour;
    args.record(custInvoiceJour);
   
    controller.parmReportName(ssrsReportStr(SalesInvoice, ReportEE));
    
    printSettings = controller.parmReportContract().parmPrintSettings();

    printSettings.printMediumType(SRSPrintMediumType::File);
    printSettings.fileFormat(SRSReportFileFormat::PDF);
    printSettings.overwriteFile(true);
    printSettings.fileName('C:\\Users\\vigneshwars\\Desktop\\New folder\\a.pdf');

    controller.DEVparmLockDestinationProperties(true);
    
    controller.parmShowDialog(false);
    controller.parmArgs(args);
   
    controller.startOperation();
    info('done');
}

I used this code to export sales invoice as pdf file but I am getting this runtime error - Error executing code: Wrong argument types in variable assignment. From the below line

if(DEVLockDestinationProperties)
DEVfixedprintSettings = this.parmReportContract().parmPrintSettings();

I referred this link and I changed the class SrsPrintMgmtFormLetterController methods as given in the link.

Any leads will be appreciated.

Thanks in advance.

Sorry for not attaching the link here is the link from which i referred and change my class method
daxldsoft.blogspot.in/…/print-salesinvoice-packingslip-or.html

Try Compile forward on \Classes\SrsPrintMgmtFormLetterController

Thanks a lot. It worked :slight_smile: