Вечер добрый, уважаемые.
Есть такая необходимость: после создания SalesOrder и постинга инвойса мне нужно создать pdf-файл (аналогичный тому, который показывается при постинге инвойса из самого Dynamics AX) и положить его в какую-либо папку на компе (серваке). Весь код вызывается (через AxaptaObject::Call()) из ASP.NET приложения по клику на кнопку, предварительно создавая и SalesOrder, и Invoice и иже с ними: проверял - в самом Dynamics записи созданы верно и я могу распечатать инвойс . Т.е. мне фактически нужно, чтобы по клику на оную помимо создания все записей "выплевывался" pdf-файл-репорт об инвойсе.
Пробовал искать по форуму и "испытывал" следующие вещи:
1.
X++:
public static void EPSendDocumentTest(Args _args)
{
EPSendDocument sendDocument;
CustInvoiceJour custInvoiceJour;
Filename filename;
;
select firstonly custInvoiceJour;
filename = WinAPI::getTempPath() +'MyInvoice.pdf';
sendDocument = new EPSendDocument(custInvoiceJour);
sendDocument.parmOriginal(true);
sendDocument.parmFileName(filename);
// Make document will run the report and send it to a PDF file with
// the path specified in filename
sendDocument.makeDocument();
}
2.
X++:
public void SuccessPostingInvoice(SalesId _salesId)
{
SalesFormLetter letter;
PrintJobSettings printJobSettings;
CustInvoiceJour InvJTbl;
RecordSortedList List = new RecordSortedList(tableNum(CustInvoiceJour));
;
......
......
letter = SalesFormLetter::construct(DocumentStatus::Invoice, true);
letter.update(salesTable, SystemDateGet(), SalesUpdate::All, AccountOrder::None, false, true);
letter.run();
letter.createParmUpdate();
letter.initParameters(letter.salesParmUpdate(), PrintOut::Current,true);
Select InvJTbl Where InvJTbl.SalesId == salesId;
List.ins(InvJTbl);
TaxUnrealizedInvoice::printFromCustInvoiceJour(InvJTbl,letter,List,PrintCopyOriginal::Original);// тут много чего пробовал :(
letter.run();
}
3. пробовал и такую разновидность( это отсюда
gatesasbait: Automatic creation of a PDF from a customer invoice in Dynamics Ax 4.0):
X++:
printJobSettings=new PrintJobSettings(salesFormLetter.printerSettingsFormletter(
PrintSetupOriginalCopy::Original));
printJobSettings.setTarget(PrintMedium::File);
printJobSettings.format(PrintFormat::PDF);
printJobSettings.fileName(@"C:\Test_Order.pdf");
salesFormLetter.updatePrinterSettingsFormLetter(printJobSettings.packPrintJobSettings());
salesFormLetter.printJournal();
не помогло

Можете что-то посоветовать?