Printer settings in ax 2012 (Print management in ax 2012):
public client static void main(Args _args, container _con)
{
SRSPrintDestinationSettings printSettings;
SRSPrintMediumType printMediumType;
SRSReportFileFormat printFileFormat;
FilePath path;
MSRouteCardController controller = new MSRouteCardController();
controller.parmReportName(#ReportName);
printMediumType = conPeek(_con,3);
printFileFormat = conPeek(_con,21);
path = conPeek(_con,20);
controller.setRange(_args, controller.parmReportContract().parmQueryContracts().lookup(controller.getFirstQueryContractKey()));
printSettings = controller.parmReportContract().parmPrintSettings();
switch(printMediumType)
{
case SRSPrintMediumType::Archive:
case SRSPrintMediumType::Screen:
printSettings.printMediumType(printMediumType);
break;
case SRSPrintMediumType::Printer:
printSettings.printMediumType(printMediumType);
printSettings.printAllPages(true);
printSettings.fileName(@path);
printSettings.printerName(conPeek(_con,4));
break;
case SRSPrintMediumType::File:
printSettings.printMediumType(printMediumType);
printSettings.fileFormat(printFileFormat);
printSettings.overwriteFile(true);
printSettings.fileName(@path);
break;
case SRSPrintMediumType::Email:
printSettings.printMediumType(printMediumType);
printSettings.emailTo(conPeek(_con,15));
printSettings.emailCc(conPeek(_con,16));
printSettings.emailSubject(conPeek(_con,17));
printSettings.emailAttachmentFileFormat(conPeek(_con,18));
printSettings.emailAttachmentImageFileFormat(conPeek(_con,19));
break;
}
//controller.parmArgs(_args);
//controller.setRange(_args, controller.parmReportContract().parmQueryContracts().lookup(controller.getFirstQueryContractKey()));
controller.parmShowDialog(true);
controller.startOperation();
}
Note : here in container (_con) i am inserting values(print desination settings values ex :printer , email,file..etc ) in form level and passing that as parmeter to main method of controller
ex:
added a button in form level like
here setup(d) is the button. here i added clicked method of this button as
clicked method:
void clicked()
{
SRSPrintDestinationSettings printJobSettings;
;
super();
printJobSettings = new SRSPrintDestinationSettings(prodParmRelease.SetupPrintDigitopiaRoutecard);
SrsReportRunUtil::showSettingsDialog(printJobSettings);
prodParmRelease.SetupPrintDigitopiaRoutecard = printJobSettings.pack();
}
here in this prodparmRelease is my table here i added the one container field as "SetupPrintDigitopiaRoutecard "
and this field is extended from "PrintJobSettingsPacked: