Hello everyone,
I need to export in AX 2009 the sales invoice to file system as PDF and I do that in the following method:
void createPDFFile(CustInvoiceJour _custInvoiceJour)
{
SalesFormLetter_Invoice salesFormLetter;
PrintJobSettings printJobSettings;
FileName filename;
;
filename = strFmt("%1%2%3%4%5",exportPath,#FilePathDelimiter,#fileNamePrefix,_custInvoiceJour.InvoiceId,#pdf);
printJobSettings = new PrintJobSettings();
printJobSettings.setTarget(PrintMedium::File);
printJobSettings.preferredTarget(PrintMedium::File);
printJobSettings.format(PrintFormat::PDF_EMBED_FONTS);
printJobSettings.warnIfFileExists(false);
printJobSettings.suppressScalingMessage(true);
printJobSettings.fileName(filename);
printJobSettings.allPages(true);
salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
salesFormLetter.updatePrinterSettingsFormLetter(printJobSettings.packPrintJobSettings());
_custInvoiceJour.printJournal(salesFormLetter);
}
it works fine, the file pdf is generated, but the problem is that the barcode inside the document is printed only for the first invoice (the method above is called during the fetching of a query on CustInvoiceJour). For all the other invoices some alphanumeric value is printed. The code is running on client and I've check if the font defined for barcode control is installed: it is installed on bothe client and server. Note that the same code using print medium "Screen" or "Printer" is working fine: for every invoice the barcode is correctly printed.
I would appreciate any help.