When using ForNAV Direct Print, you can choose to let a central Windows service handle all your print jobs, or you can download the jobs and print them automatically from the web client. The latter option is called client print, and this is often used if you do not have a centralized printer setup. It is ideal for the user that works at home or at a small office. It also works well for laptop users working from a mobile office, such as a car.
Since the introduction of the browser-based web client, it has been a problem to download multiple files in one action. This has been a problem for client printing because it relies on the ability to download a file with a specific file name extension. One example of an action that requires multiple print jobs could be when printing both an invoice and a shipping document. If both these print jobs were to be downloaded, then one of them would be lost.
With the release of the ForNAV Customizable Report Pack 7.1, it is now possible to use client print with multiple documents created in the same action. This is possible because the client print feature can now use the ForNAV print queue in Business Central. The print queue was originally intended only to be used for the service print, but now it can be used for both.
As shown in the screenshot above, you can create a client printer and select the Queue Jobs check box and set the Initial Job Status column to On Hold. Only jobs with the status Ready will be picked up by the direct print service if you are using both client print and service print in the same Business Central tenant.
When printing to the new printer called Client Printer, the jobs will be placed in the queue instead of being downloaded as a normal client print job would be. Whenever you are ready to print the saved jobs, you can call a line of code that collects all the jobs in the queue that belongs to your user’s session. The ForNAV code will then create a zip archive with all the jobs and download that as a client print file.
Here is an example that shows how to create an action that downloads waiting print jobs:
action(DownloadMyOnHold){ApplicationArea = All;Image = Download;Caption = 'Download MY print jobs on hold';trigger OnAction()varpq: Record "ForNAV DirPrt Queue";beginpq.DownloadPrintJobs();end;}
The essence of this code is the call to DownloadPrintJobs that collects all the jobs on hold for the current user session. In theory, you could modify the current selection of jobs by setting a filter on the record for the print queue in the example.
You can also collect the jobs automatically after your action is done printing them. Here is how you could use the DownloadPrintJobs procedure with an event handler that runs after all actions on a page:
[EventSubscriber(ObjectType::Page, Page::"ForNAV Reports", 'OnAfterActionEvent', 'Run', true, true)]local procedure MyOnAfterActionEvent()varpq: Record "ForNAV DirPrt Queue";beginpq.DownloadPrintJobs();end;
Using the method described here extends the use of client printing and removes one of the downsides of client printing when compared to service printing. You can still use the simple client print, where you create a direct printer without the queuing option. This is still somewhat easier if you only print one document at a time.