Printing report to networked printer

Hello, (Version 7.9)

I’m having trouble printing reports to 3 different networked printers. I have a project that I intend to use to generate 3 reports and print them to three different networked printers.

So, my specific question is this… What format do my printer names need to be in? Full networked path? Name as it appears on the client PC?

I’ve read several forum posts on printing to specific printers and have discerned that the format might need to be whatever the gateway has, if that is true for this function, how do I find out what the gateway has for a specific printer name.

I have a script on a print button;

event.source.parent.getComponent('Report Viewer_Main').print(r"\\ngvlabel-a\Zebra 220Xi4 (300 dpi) 16278-01", 0)
event.source.parent.getComponent('Report Viewer_Duplicate').print(r"\\ngvlabel-a\Zebra 110Xi (300 dpi) 16278-04", 0)
event.source.parent.getComponent('Report Viewer_CNG Warning').print("Zebra 220Xi4 (300 dpi)", 0)

to select and print my report viewers/obects, but I get errors saying that it can’t find the printers for the first two. The third is the default printer (the reason I don’t have the full network path called out), which, just by chance is the correct printer for that particular report (label).

When I use

event.source.parent.getComponent('Report Viewer_Main').print()
event.source.parent.getComponent('Report Viewer_Duplicate').print()
event.source.parent.getComponent('Report Viewer_CNG Warning').print()

(With no specific printer name selected) I’m able to print each report individually via the print prompt that comes up for each report and select each printer from the printer name drop down.

I’ve tried something like this;

job = system.print.createPrintJob(event.source.parent.getComponent('Report Viewer_Main'))
job.setPrinterName("Zebra 220Xi4 (300 dpi)")

But it still cannot find the printer unless it happens to be the default printer. Also with this method I would need to do a lot more format tweaking that I’d rather not do, since the second script works beautifully for simply printing. It just doesn’t print to a specific printer automatically.

Any help would be great!

I think it needs to be as it’s installed and named in the client.

This bit of code will fetch the installed printer names:

from javax.print import PrintServiceLookup as PSL

printerList = PSL.lookupPrintServices(None, None)
defaultPrinter = PSL.lookupDefaultPrintService()

for printer in printerList:
  print printer.getName()
print 'Default printer : ' + defaultPrinter.getName()
1 Like

Thank you so much! I set them up how the client PC has them, works like a charm now. On the day before a holiday no less.

Have a wonderful Thanksgiving!

For future people finding this thread, some general comments on printing reports. :slight_smile:

If you’re printing a report via a scheduled action or via a script (ie, the printing happens on the gateway, and the OS sees it as coming from the users running the gateway ignition service. So the printer needs to be available to that user and the name needs to be as it appears to the gateway.

If you’re printing out of the Vision component, then it needs to be available to the user that the OS sees as running the client (not the user logged in to the client), and the printer needs to be as it appears to the client.



I am using Ignition 7.9.5 and Java 1.8.0_161-b12.

I am trying to print report using schdule and getting below error. As you have mentioned in the above comment, I have provided access to network printer for that OS user where gateway service is running. Please below error.

Try Googling “no print service found” along with your OS. You’ll find how to fix this pretty quickly.

I’m trying to print a report from a vision client script in Ignition 7.9.8
I’m getting the printer name using the code posted by @JordanCClark but when I call executeAndDistribute, nothing happens - no errors, nothing.
For every attempt, the logger shows and error: Could not print report to primary printer.
I don’t understand the volume of stuff in the details when I expand the logger message.
How can I solve this?

Post the rest of your code, use triple back single quotes one line before and after the code for formatting

Also, did you specifically run @JordanCClark’s code on the gateway? That’s the whole root of this issue for 90% of users - reports are executed and distributed from the gateway, even if you initiate the printing process from the client. Even if you ran that code in the script console on the same physical machine that’s running the gateway, it’s not a true comparison - Windows separates printers per user.


Here is my code running in a 7.9.8 Vision client script:

import libraries

from javax.print import PrintServiceLookup as PSL

check to see if there is anything to do

orderNumber = ‘[Client]OrderNumber’ ).value
if orderNumber == None:

initialize variables

reportName = ‘Order History Detail’
format = ‘pdf’

defaultPrinter = PSL.lookupDefaultPrintService()

printActionSettings = {}
printActionSettings[‘copies’] = 1
printActionSettings[‘primaryPrinterName’] = defaultPrinter path=reportName, action=‘print’, actionSettings=printActionSettings )

You are looking up print services in the client, but executeAndDistribute() runs on the gateway. Your gateway needs a print service accessible to the gateway service.


An easy way to do this is to create a tag that runs that query for print services mentioned by @JordanCClark. Tag scans execute on the gateway, so it will give you gateway printers.

Thank you.
There are no printers on the server except for “Microsoft XPS Document Writer”, just USB printers directly connected to client workstations.
I created a “Mix Report” window with a Report Viewer and instead of printing, open the window.
Users and management say “It’s acceptable.”

Can you not just right click on the report and select ‘print’? This should allow you to print to a printer plugged in locally.

Yes, that is what the report window is for.
The system I’m replacing just prints the report, the users never see the report before it prints. That is what I was trying to duplicate.
I’m displaying the report and they have to manually print it.
Printers are installed on local workstations by anyone, never put on any server.
I added an “AutoPrint” parameter to automatically print the report then close the window but was directed to just open the window and make them print.