Let’s start with the explanation from Microsoft:
Documents that require custom margins
When the Document Routing Agent runs as a Windows service, document reports, such as checks, that require custom margins can’t be printed directly to network printers. Instead, the Document Routing Agent automatically routes those document to a target folder. New configuration properties in the application’s Settings dialog box let you define the target location for document reports that require custom margins.
When the Document Routing Agent runs as a desktop application, it continues to take advantage of Adobe Reader to spool the document to the shared printer device that is selected in Finance and Operations. To handle scenarios where documents that have custom margins must be printed, we recommend that you install the Document Routing Agent in multiple locations. Then install the printers that will handle those documents only on the Document Routing Agents that will run in desktop application mode. Alternatively, use a post-execution process to pick up the files in the target directory and direct them in the appropriate manner.
What Microsoft is saying about the reports, which require custom margins (as far as we know the Cheque report is the only one with custom margins in D365FO), is that Document Routing Agent (DRA) in combination with SSRS Reporting Services is not capable of conveying this information to a selected network printer directly.
Please note that in AX 2012, where we have only on-premises environments and no need for DRAs, SSRS is capable of printing reports with custom margins to network printers directly.
Why do we need Document Routing Agents in the first place
In on-premises environments, D365FO and SSRS Reporting Services can directly communicate with network printers, since they all are normally in the same corporate network. Therefore, in on-premises D365FO environments printing reports to network printers works without any additional application, as it was working in AX 2012.
Once we move to the cloud, direct printing is no longer an option, because D365FO nor SSRS Reporting Services don’t have access to network printers that dwell behind a company firewall in a corporate network. In order to support printing to network printers, Microsoft created Document Routing Agent (DRA).
What is DRA and how it works
DRA is an application provided by Microsoft and can be downloaded from D365FO (Organization administration > Setup > Network printers). You can install DRA on a print server or on a user workstation, which are part of the corporate network.
DRA can run in two modes: as a desktop application (usually when installed on a user workstation) or as a Windows service (when installed on a print server).
When D365FO prints a report via DRA, SSRS Reporting Services generates an EMF image for each page of the generated document. D365FO then temporarily saves the generated EMF files to Azure Blob storage along with the corresponding print-settings in the form of an XML file. The print-settings contains information about the target printer, page orientation, number of copies, etc.
D365FO also creates a new record in Document routing status, a table containing the printing log for all reports and printers.
DRA uses the polling mechanism to check for any changes in the blob containers, i.e. if a new document for printing is available for download. Since each DRA is linked to particular network printers, it will be downloading only those documents routed to the printers on the DRA’s printer list. After DRA downloads a print job information, it will create a print job for the target printer, and send the information back to D365FO to update the Job status field to Succeeded in the Document routing status table. This doesn’t necessarily mean that the printing has succeeded but only that the print job has been successfully created and sent to the Windows Print Spooler.
What is so special about Checks
When D365FO prints a report without custom margins via DRA, SSRS Reporting Services generates EMF files and saves them to Azure blob storage. However, when D365FO prints a report with custom margins via DRA, such as Cheque, SSRS Reporting Services generates a PDF document instead of EMF images, which is again saved to Azure Blob storage, together with the corresponding print-settings.
Remember that the print-settings contain the information about the target printer (i.e. the printer dedicated to printing checks), which means that only DRAs linked to the Check printer will be triggered.
When a DRA downloads the PDF output document from Azure Blob storage, it will not create a print job as it would with EMF images. EMF is one of the Windows Print Spooler formats, whereas PDF is not. This is why DRA has to employ an application, which knows how to print PDFs. Microsoft chose to use Adobe Acrobat Reader invoked from command line interface (CLI) for this purpose.
Checks can only be printed to network printers via Adobe Acrobat Reader, if DRA runs as a desktop app, or they can be saved to a local folder, if DRA runs as a Windows service. In that case, the target folder is configured in the DRA’s settings, which is used for printing checks to the Check printer.
However, it is not enough to just install DRA and Adobe Acrobat Reader on a user workstation. Let’s write down all the necessary steps:
- Install DRA on a workstation. When installing the DRA, make sure you are logged in as the Admin user.
- Set up DRA to register the Check printer.
- Ensure that DRA is running as a desktop application.
- Open D365FO and activate the Check printer in Organization administration > Setup > Network printers, for each legal entity that you want to enable printing checks to this printer.
- Before printing any check from D365FO, on the workstation configure Adobe Reader print settings to prevent document scaling.
To accomplish this, open an arbitrary PDF document with Adobe Reader on the workstation, set the print settings required for printing checks, print the document to the Check printer, and close Adobe Reader.This is required because when DRA invokes Adobe Reader to print the Cheque document, the last print settings used in Adobe Reader will be applied and used in any subsequent printing.
Printing checks without Adobe Reader
Can we print checks in D365FO without Adobe Reader? If you are using Docentric, you can!
Printing checks based on SSRS report designs
Custom margins for the Cheque report are set in: Cash and bank management > Bank accounts > the Bank accounts form > the SET UP action tab > the LAYOUT button group > the Check button > the Check layout form > the Layout tab.
If these custom margins are not used, and the SSRS report design for Cheque is used as is, then such SSRS report design can also be printed in EMF format, which means avoiding the Print as PDF printing mode and Adobe Acrobat Reader.
Printing checks based on Docentric templates
When printing checks with Docentric, there is no need for setting up custom margins in the Check layout form. Instead, margins are set and fine-tuned on Docentric templates directly, which users can create or change from within D365FO, without deployments. Moreover, end-users can designed checks with Docentric Designer by themselves, using MS Word, and without help of developers.
While Docentric still reuses the existing DRAs to print reports to network printers, it always generates EMF files, and Adobe Reader is never employed for printing, regardless of whether DRA runs as a desktop app or as a service.
If we don’t set Report caption in Docentric report setup, the default caption will be used. Depends on the report, sometimes the default caption is the report AOT name (e.g. PurchPurchaseOrder.Report) or the label of the report menu item (e.g. “Print checks” or “Show invoice”).
Other DRA limitations we are going to fix
We are aware that, besides using Adobe Reader for printing checks, DRA still has many other limitations such as serial single-threaded processing of print jobs, causing this way printing bottlenecks.
The printing via DRA isn’t just slow but also not robust. For example, if the printing to one printer fails, the rest of the print jobs will also fail. Some partners solved this issue by having a separate DRA for a single printer.
Next, DRA doesn’t support the information about the user who triggers the printing and consequently makes it impossible to introduce a centralized printing solution such as the FollowMe printing.
DRA also doesn’t support the information about the input printer trays or page orientation neither for the whole document nor for the particular document pages.
On top of all that, each time when you upgrade D365FO, you also need to upgrade all your DRAs – manually.
Please reach us at email@example.com if you want to get involved!
You can still route your PDF documents to local folders if you want
It’s interesting to mention that Docentric introduced an additional option: Print as PDF, which can be configured on the Print destination settings form > Docentric Printer print destination. By using it, you can fully control whether you want to employ Adobe Acrobat Reader for physical printing or to route PDF documents to a local folder, when printing reports using Docentric Printer print destination.
Learn more >>
We are also preparing a new series of articles on how easy it is to design checks with Docentric. Stay tuned!