Hey... Iam trying to use a AIF-Call to save my Invoice as a PDF on the Server.
The AIF-Call is doing fine but no file is stored on the disc.
The path and its permission is okay - i tried to write a file via TextIo and it woked well.
But the following code is not woorking an at this point Iam pretty helpless. Hopefully you guys can give me some good advices.
[ AifDocumentCreateAttribute, SysEntryPointAttribute(true) ] public str getInvoiceAsPDF(str 200 _invoiceId) { CustInvoiceJour custInvoiceJour; SalesInvoiceJournalPrint salesInvoiceJournalPrint; Set set = new Set(Types::Record); SRSPrintDestinationSettings srsPrintDestinationSettings; str content ,fileName ,settings = 'KeepSettings'; System.Byte[] pdfDocBuffer; System.IO.FileInfo fi_pdfDoc; System.IO.FileStream fs; ; // Get record select firstonly custInvoiceJour where custInvoiceJour.InvoiceId == _invoiceId; if (custInvoiceJour.RecId) { // Set printer settings SysLabel::labelId2String2(literalstr('@SYS14204'), CustInvoiceJour.LanguageId), _invoiceId); fileName = 'C:\\TEMP\\test.pdf'; srsPrintDestinationSettings = new SRSPrintDestinationSettings(); srsPrintDestinationSettings.fileFormat(SRSReportFileFormat::PDF); srsPrintDestinationSettings.fileName(fileName); srsPrintDestinationSettings.printMediumType(SRSPrintMediumType::File); srsPrintDestinationSettings.numberOfCopies(1); srsPrintDestinationSettings.overwriteFile(true); // Initalize salesInvoiceJournalPrint = SalesInvoiceJournalPrint::construct(); salesInvoiceJournalPrint.parmPrintFormletter(NoYes::Yes); salesInvoiceJournalPrint.parmUsePrintManagement(false); salesInvoiceJournalPrint.parmPrinterSettingsFormLetter(srsPrintDestinationSettings.pack()); // Print salesInvoiceJournalPrint.printJournal(set); return "noting happens"; }
Greetings
Alex