How to: Specify Printers for Reports (MorphX Reporting Tools) [AX 2012]

Updated: March 8, 2011

Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

Specify which printer a report is sent to and specify the printer settings by using the PrintJobSettings::deviceName method and the PrintJobSettings::unpackPrintJobSettings method. For more information about modifying other print settings, see PrintJobSettings class.

Specify whether users can select a printer and modify the printer settings by setting the Interactive property of the report to No. For more information, see Report Properties.

Send a report to a printer, a file, an e-mail address, or a screen by using the ReportRun.setTarget method and the PrintMedium system enumeration.

Send a report to additional output targets by using the ReportOutputUser and WebReportHTML classes.

To specify a printer and printer settings for a report

  1. To override the init method, click the report in the Application Object Tree (AOT), right-click Methods, click Override Method, and then click init. The X++ editor will appear.

  2. Call the deviceName and unpackPrintJobSettings methods.

In the following example, the deviceName method specifies the b110-1102-b printer and the unpackPrintJobSettings method specifies the settings that are contained in the SalesFormLetter class that ships with Microsoft Dynamics AX.

When you open the report by right-clicking the report and then clicking Open, the specified printer will be displayed in the dialog box.

public void init()
    PrintJobSettings printJobSettings;