Monday, February 10, 2014

Export Report to PDF from Code

Hi Guys,

Below is the code to Export Report to PDF from Code in Ax

Create the Instance of the SrsReportRun class

SRSReportRun rr = new SRSReportRun("ReportName");
rr. init();

//change the report printing destination as follow

// print to file

           rr.printDestinationSettings().printMediumType(SRSPrintMediumType::File);
// file type
            rr.printDestinationSettings().fileFormat(SRSReportFileFormat::PDF);
// overwrite the file or not
            rr.printDestinationSettings().overwriteFile(true);
// give the file name
            rr.printDestinationSettings().fileName(filePath);
// if u want to print all the pages set to true else false
            rr.printDestinationSettings().printAllPages(false);
// if u want to print specified pages set the page ranges
            rr.printDestinationSettings().fromPage(PageNo);
            rr.printDestinationSettings().toPage(PageNo);
// run the report
rr.run();

No comments:

Post a Comment