我通過批處理作業生成報告pdf文件時遇到了問題。它的工作原理,當一個批處理作業執行,除了罰款(有時它的工作原理,但大多數的時候我已經損壞的PDF文件):在AX 2009中通過批處理作業生成損壞的pdf文件
while(qr.next()) //loop on my quotationId with some filters
{
salesQuotation = qr.get(tablenum(salesQuotationTable));
filenamePDF = strfmt("%1%2",SalesQuotation.QuotationId,".pdf");
permissionSetPDF = new Set(Types::Class);
permissionSetPDF.add(new FileIOPermission(filenamePDF,'w'));
permissionSetPDF.add(new InteropPermission(InteropKind::ClrInterop));
CodeAccessPermission::assertMultiple(permissionSetPDF);
report = new ReportRun(new Args(ReportStr(DevisContactBusinessV2)));
report.query().interactive(false);
report.report().interactive(false);
report.args().caller(null);
report.args().parm(SalesQuotation.QuotationId);
report.printJobSettings().setTarget(PrintMedium::File);
report.printJobSettings().format(PrintFormat::PDF);
report.printJobSettings().warnIfFileExists(false);
report.printJobSettings().fileName(strfmt("%1%2",path,filenamePDF));
report.run();
//tried to get around the file size problem by execute pdf file generation outside the loop
fi = new System.IO.FileInfo(strfmt('%1%2',path,filenamePDF));
length = fi.get_Length();
if(length <= 1000)
{
info(strfmt("%1 %2","Quotation problem",SalesQuotation.QuotationId));
this.OBRfixPDF(salesQuotation.QuotationId);
}
else
{
info(strfmt("%1 %2","Quotation OK:",SalesQuotation.QuotationId));
}
CodeAccessPermission::revertAssert();
}
生成的文件似乎已損壞,他們有一個大小爲1 KO,並且無法讀取。報告中沒有圖像,我使用沒有SP1的AX 2009。
請不要只發布鏈接的答案。將基本部分放在您的答案中 – Rizier123
這是修補程序的鏈接 – Edvinas