Write the following code in the main method of the controller class for AX SSRS report.
Send AX SSRS
Report directly to Printer
public static void main(Args _args)
{
SrsReportRunController controller = new
SrsReportRunController();
SRSPrintDestinationSettings printSettings;
// set report name
controller.parmReportName(ssrsReportStr(LedgerBalanceControl, Report));
controller.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::Printer);
controller.parmReportContract().parmPrintSettings().printerName("Send
To OneNote 2010"); // specify your printer name
//controller.parmReportContract().parmPrintSettings().printLandscape(true);
// print in landscape orientation
controller.parmReportContract().parmPrintSettings().numberOfCopies(1); // print 2 copies
//controller.parmReportContract().parmPrintSettings().setPaperTray(1);
// print to paper tray with index = 1
//controller.parmReportContract().parmPrintSettings().collate(true); // collate printed copies
// suppress the parameter
dialog to send directly to printer
//controller.parmReportContract().parmPrintSettings().parmShowDialog(false);
// start operation
controller.startOperation();
}
Save AX SSRS
Report as PDF or any other available file format
public static void main(Args _args)
{
controller.parmArgs(_args);
controller.parmReportName(ssrsReportStr(LedgerBalanceControl, Report));
controller.parmShowDialog(false);
controller.parmShowReportViewerParameters(false);
controller.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::File);
controller.parmReportContract().parmPrintSettings().overwriteFile(true);
controller.parmReportContract().parmPrintSettings().fileFormat(SRSReportFileFormat::PDF);
controller.parmReportContract().parmPrintSettings().fileName("C:\\Reports\\ReportTest.pdf");
controller.startOperation();
}
Hi, did you try to set the Tray before?
ReplyDeletecontroller.parmReportContract().parmPrintSettings().setPaperTray(1);
I'm not able to print to paper from the specific tray in AX2012 R3.
did you find the way to print on tray, facing same issue
Delete