Printing a report from an Ignition Client

This post provides a quick intro into printing reports on demand from a client using an Ignition script. 

I was asked by a client to help them print a report from a perspective button and want to share what I have learned.

I learned that it is quite easy to print a report on demand. All you need is the system.report.executeAndDistribute function and you will be on your way. The Ignition docs show examples for emailing a report, saving a report, and sending a report to FTP server. However, the Ignition docs do not show a print example.

So, let’s dive in and look at a simple script to print the report with default settings (no actionSettings defined).

# Executes and distributes the report to the default printer on computer where the Ignition Gateway is installed
system.report.executeAndDistribute(path="My Report Path", project="My Project", action="print")

This script was placed in an onClick event script on a Button. See image below:

When the button is clicked, the report defined in the script is printed.

There are additional settings that can be configured. See excerpt from the Ignition Docs below:

  • Setting Keys: "primaryPrinterName", "backupPrinterName", "copies", "printBothSides", "collate", "useRaster", "rasterDPI", "useAutoLandscape", "pageOrientation".
  • Note: primaryPrinterName defaults to the default printer. backupPrinterName defaults to "none", but can also have the special value of "default". printBothSides, collate, and useRaster are booleans which default to false. rasterDPI is only used if useRaster is true. useAutoLandscape defaults to true. If useAutoLandscape is false, pageOrientation, which can have values of "portrait" or "landscape" (default is "portrait"), is used.

In conclusion, this blog post shows how easy it is to print a report on demand using the system.report.executeAndDistribute function.


Andrew Ott June 10, 2023
Share this post
Sign in to leave a comment