Skip to main content

Posts

Showing posts with the label print

Common problem in Printing AX Reports as a file using Batch job scheduling through code in the Server File System

The solution is pretty simple and is as follows: As AX batch job scheduling always runs on the server, the below configuration has to be followed: (i) E nable AOS printing on the AOS server configuration (see below). Do not restart the AOS yet. (ii) D ue to a bug in the Configuration Utility, we need to manually update the corresponding value in the registry. In this path-> HKEY-LOCAL MACHINE->SOFTWARE->MICROSOFT->DYNAMICS-5.0->Configuration->Original search for the Name useserverprinters and set the value to “1”. After that restart the AOS. (iii) Provide an UNC Path on the AOS computer that will used for saving the PDF Files (temp. only). Now you can print the AX reports as a pdf, rtf,txt or any other valid format through code(x++) from batch job scheduling.

Print Sales Invoice Report in PDF / HTML / RTF / ASCII etc., format through code

SalesFormLetter salesFormLetter; PrintJobSettings printJobSettings; CustInvoiceJour custInvoiceJour; SalesId salesId; #File   salesid = "SO-100010"; salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice,false); printJobSettings = new PrintJobSettings(); printJobSettings.setTarget(PrintMedium::File); printJobSettings.format(PrintFormat); printJobSettings.fileName( '//10.0.57.22/AOSPrintShare//' + salesId+#pdf ); printJobSettings.warnIfFileExists(false); SalesFormLetter.updatePrinterSettingsFormLetter(printJobSettings.packPrintJobSettings()); select custInvoiceJour where custInvoiceJour.SalesId == salesId; custInvoiceJour.printJournal(salesFormLetter);

How to: Print a Range of Pages from a Report

static void printToPDF(Args _args) {     Args                args;     ReportRun           rr;     str reportName = 'Cust';     ;     args = new Args(reportName);     rr = new ReportRun(args,'');         rr.setTarget(Printmedium::File);     rr.printJobSettings().format(PrintFormat::PDF);     rr.printJobSettings().fileName("C:\\Cust_ReportRange.pdf");         rr.printJobSettings().allPages(false);     rr.printJobSettings().from(2);     rr.printJobSettings().to(4);     // Disables forms that enable users to modify     // the report query and print settings.     rr.query().interactive(false); ...