Print Report to PDF in axapta
static void printToPDF(Args _args)
{
Args args;
ReportRun rr;
str reportName = 'ReportName1';
;
args = new Args(reportName);
rr = new ReportRun(args,'');
rr.setTarget(Printmedium::File);
rr.printJobSettings().format(PrintFormat::PDF);
rr.printJobSettings().fileName("C:\\Cust_ReportRange.pdf");
rr.printJobSettings().allPages(false);
rr.printJobSettings().from(2);
rr.printJobSettings().to(4);
// Disables forms that enable users to modify
// the report query and print settings.
rr.query().interactive(false);
rr.report().interactive(false);
rr.run();
}