Print Barcode Code using x++ :
void clicked()
{
//AIFD_PrintBarcode
AI_PrintBarcodeController aiBarcode = new AI_PrintBarcodeController();
AI_PrintBarcodeContract aiContract = new AI_PrintBarcodeContract();
ProdJournalProd prodJournalProdLoc;
SRSPrintDestinationSettings printSettings = new SRSPrintDestinationSettings();
PrintJobSettings printJobSettings = new PrintJobSettings();
Dialog dialog = new Dialog();
DialogField dialogFileName;
str adobeExe;
str adobeParm;
str fileName;
int fileCount;
//AIFD
InteropPermission permission;
str errorMessage;
//END
real WeightInreal;
permission = new InteropPermission(InteropKind::ClrInterop);
permission.assert();
super();
try
{
prodJournalProdLoc = ProdJournalProd_ds.getFirst(true);
while (prodJournalProdLoc)
{
fileCount++;
aiBarcode.parmReportName(ssrsReportStr(AI_PrintBarcoderReport,Report));
aiBarcode.parmShowDialog(false);
aiContract.parmRecordId(prodJournalProdLoc.RecId);
aiContract.parmDocumentTitle("x");
//printSettings = aiBarcode.parmReportContract().parmPrintSettings();
printSettings.printMediumType(SRSPrintMediumType::File);
//printSettings.landscape(false);
//printSettings.printerPageSettings('KRRLabelBarcode');
//info(strFmt("%1",printSettings.printerPageSettings()));
fileName = strFmt("D:\\barcode%1.pdf",fileCount);
printSettings.fileFormat(SRSReportFileFormat::PDF);
printSettings.fileName(fileName);
printSettings.printerName("TOSHIBA B-SA4TP TS");
printSettings.landscape(false);
printSettings.overwriteFile(true);
aiBarcode.parmReportContract().parmRdpContract(aiContract);
aiBarcode.parmReportContract().parmPrintSettings(printSettings);
aiBarcode.startOperation();
WeightInReal = sleep(500);
//printJobSettings.printerSettings('SysPrintForm');
printJobSettings.setTarget(PrintMedium::Printer);
printJobSettings.preferredTarget(PrintMedium::Printer);
adobeExe = WinAPI::findExecutable(fileName);
adobeParm = strFmt(' /t "%1" "%2" "%3" "%4"',
fileName,
"TOSHIBA B-SA4TP TS",
printJobSettings.printerDriverName(),
printJobSettings.printerPortName());
winAPI::shellExecute(adobeExe, adobeParm);
WeightInReal = sleep(500);
prodJournalProdLoc = ProdJournalProd_ds.getNext();
}
CodeAccessPermission::revertAssert();
}
catch(Exception::CLRError)
{
errorMessage = AifUtil::getClrErrorMessage();
CodeAccessPermission::revertAssert();
throw error(errorMessage);
}
//END
}
void clicked()
{
//AIFD_PrintBarcode
AI_PrintBarcodeController aiBarcode = new AI_PrintBarcodeController();
AI_PrintBarcodeContract aiContract = new AI_PrintBarcodeContract();
ProdJournalProd prodJournalProdLoc;
SRSPrintDestinationSettings printSettings = new SRSPrintDestinationSettings();
PrintJobSettings printJobSettings = new PrintJobSettings();
Dialog dialog = new Dialog();
DialogField dialogFileName;
str adobeExe;
str adobeParm;
str fileName;
int fileCount;
//AIFD
InteropPermission permission;
str errorMessage;
//END
real WeightInreal;
permission = new InteropPermission(InteropKind::ClrInterop);
permission.assert();
super();
try
{
prodJournalProdLoc = ProdJournalProd_ds.getFirst(true);
while (prodJournalProdLoc)
{
fileCount++;
aiBarcode.parmReportName(ssrsReportStr(AI_PrintBarcoderReport,Report));
aiBarcode.parmShowDialog(false);
aiContract.parmRecordId(prodJournalProdLoc.RecId);
aiContract.parmDocumentTitle("x");
//printSettings = aiBarcode.parmReportContract().parmPrintSettings();
printSettings.printMediumType(SRSPrintMediumType::File);
//printSettings.landscape(false);
//printSettings.printerPageSettings('KRRLabelBarcode');
//info(strFmt("%1",printSettings.printerPageSettings()));
fileName = strFmt("D:\\barcode%1.pdf",fileCount);
printSettings.fileFormat(SRSReportFileFormat::PDF);
printSettings.fileName(fileName);
printSettings.printerName("TOSHIBA B-SA4TP TS");
printSettings.landscape(false);
printSettings.overwriteFile(true);
aiBarcode.parmReportContract().parmRdpContract(aiContract);
aiBarcode.parmReportContract().parmPrintSettings(printSettings);
aiBarcode.startOperation();
WeightInReal = sleep(500);
//printJobSettings.printerSettings('SysPrintForm');
printJobSettings.setTarget(PrintMedium::Printer);
printJobSettings.preferredTarget(PrintMedium::Printer);
adobeExe = WinAPI::findExecutable(fileName);
adobeParm = strFmt(' /t "%1" "%2" "%3" "%4"',
fileName,
"TOSHIBA B-SA4TP TS",
printJobSettings.printerDriverName(),
printJobSettings.printerPortName());
winAPI::shellExecute(adobeExe, adobeParm);
WeightInReal = sleep(500);
prodJournalProdLoc = ProdJournalProd_ds.getNext();
}
CodeAccessPermission::revertAssert();
}
catch(Exception::CLRError)
{
errorMessage = AifUtil::getClrErrorMessage();
CodeAccessPermission::revertAssert();
throw error(errorMessage);
}
//END
}
0 comments:
Post a Comment