Printing report in Perspective

I'm looking to print a report using executeAndDistribute() on button press in Perspective. My printer receives the job in its queue but error's out (included). Manually printing the report via the browser print button works fine. Does executeAndDistribute() work with USB printers or does my printer need to be exposed to the network? Any advice/help would be appreciated.

executeAndDistribute() runs on the gateway, so as long as your printer is installed on the gateway computer, whether local or a network printer, it should print fine.

Note: I use windows server 2019 and I have had problems with the install printer function when you browse for a printer on the network. Typically, I use the printer I want was not shown and install the printer manually by using the IP address.

2 Likes

Currently the printer is installed on the gateway computer and plugged in via USB

Can you print a test page from the gateway without using Ignition, just using the printer properties for testing?

Sorry I'm an Ignition novice. I'm able to print a test page from the printer without any issues. The Reports module reads my printer as an available device as well, but the sent job to the printer always errors out.

Edit: I tried using the action "save" with no issues, not sure if that's relevant/helpful

You may have to contact support, I don't know of anything else to check personally.

1 Like

Thanks anyways, I'll update when I find a solution.

1 Like

Support resolved the issue, here's the resolution:

Problem:
Cannot print report in Perspective using system.report.executeAndDistribute

  • Java-printing error when printing using system.report.executeAndDistribute
  • Issue seemed to be with the printer, so removed the device and reinstalled its driver and its software.
  • The issue persisted.
  • Error in the gateway that the printer is not accepting jobs. The user that is sending the print job was SYSTEM.
  • Changed the user that is logged-in into the ignition service and then restarted the ignition service.

  • After making this change, the print job was sent under the specified account.
  • Ran into an issue with the label size.
  • Navigated to the report section of the designer and changed the page size to 90 width and 29 height MM.
  • Changed the reportandExecute parameters to something like this:
system.report.executeAndDistribute(path="your-path", project="your-project", action="print", actionSettings = {"primaryPrinterName":"your-printer", "useAutoLandscape":True}

The print was successful and the label was the correct size.

Thanks again Lorens and dkhayes117 :slight_smile: