Hey,
Iam having trouble with printing a report via AIF (http).
We use the following code (simple example):
args = new Args(reportStr(SalesInvoice));
args.record(custInvoiceJour);
args.parmEnum(PrintCopyOriginal::Original);
// need to say ReportRun not to change PrintJobSettings in fetch-method
args.parm(settings);
reportRun = new ReportRun(args);
reportRun.report().interactive(false);
reportRun.query().interactive(false);
printJobSettings = new PrintJobSettings();
printJobSettings.format(PrintFormat::PDF_EMBED_FONTS);
printJobSettings.setTarget(PrintMedium::File);
printJobSettings.warnIfFileExists(false);
printJobSettings.suppressScalingMessage(true);
printJobSettings.preferredFileFormat(PrintFormat::PDF_EMBED_FONTS);
fileName = strfmt('\\\\Test-Server\\Transfer\\Test2.pdf');
printJobSettings.fileName(fileName);
reportRun.printJobSettings(printJobSettings.packPrintJobSettings());
reportRun.init();
reportRun.run();
// send created PDF as byte stream
// Grant clrinterop permission.
new InteropPermission(InteropKind::ClrInterop).assert();
//Load the file
fi_pdfDoc = new System.IO.FileInfo(fileName);
//Initiallize the byte array by setting the length of the file
pdfDocBuffer= new System.Byte[int642int(fi_pdfDoc.get_Length())]();
// Stream the file
fs= new System.IO.FileStream(fi_pdfDoc.get_FullName(), System.IO.FileMode::Open, System.IO.FileAccess::Read);
fs.Read(pdfDocBuffer, 0, pdfDocBuffer.get_Length());
// Convert the file into a base64 string
content = System.Convert::ToBase64String(pdfDocBuffer, 0, pdfDocBuffer.get_Length());
//Revert the access
CodeAccessPermission::revertAssert();
return content;
We want to print old reports - this code works pretty well on AX 2009 - with old reports.
If Iam trying to print a SSRS-Report everything is fine. For some reson the old reposts wont work on 2012.
The following error is shoing up:
SoapFault exception: [s:Client] ClassFactory Objekt ist nicht initialisiert.
Stack-Trace
(S)\Classes\LedgerCache\getValue - line 3
(S)\Data Dictionary\Tables\Ledger\Methods\current - line 13
(S)\Data Dictionary\Tables\Currency\Methods\mstAmount - line 13
(S)\Classes\TaxInvoiceSpec\taxSpec - line 399
(S)\Reports\VendInvoiceSpec\Methods\fetch - line 33
(S)\Classes\ReportRun\Run
(S)\Jobs\
Are there any ideas? I tried different reports - I dont think the probem is the report itself.
If I run the code serverside (not via AIF) the report is printed without any problems.
Thank you very much.
*This post is locked for comments
I have the same question (0)