Script for printing a report in perspective

Hello all,

My question is the following : is it possible to print a report from a button ?

thanks in advance

If the printer is on the network, and reachable from the gateway, then an action script on the button could run system.report.executeAndDistribute() to print from the gateway. The other option is to execute the report and get the raw PDF bytes, then deliver them to the browser with system.perspective.download(). The user would have to print manually from the PDF support in their browser or local OS.

5 Likes

Thanks ! It works :slight_smile:

Hello

I would like to ask additional question related to it. Obviously "system.report.executeAndDistribute()" doesn't work without proper parameters put in, but I don't see an example where report source is ReportViewer in the same perspective window.

I would like it to work like user is pressing the button and standard print pop-up is displayed. How to make it like that?

Perspective can't do that (yet?). Use your browser's PDF viewer print functionality.

Hi,
I have also an additional question:
I try to use the system.report.executeAndDistribute() to print a report from a perspective session. I will have several users on different PC's that need to print at one central network printer.
Therefore I added a network printer on my gateway.
If I log into the server, where the gateway is installed I can print a testpage, but I'm not able to print from Ignition.

settings = {'primaryPrinterName': 'PRINTERNAME on printserver1', 'copies': 1, 'printBothSides': False, 'collate': True, 'useRaster': False, 'rasterDPI': 1200, 'useAutoLandscape': False, 'pageOrientation': 'portrait'}
system.report.executeAndDistribute(path='PrintLabels', project="MyProject",  action='print', actionSettings=settings)

Do you have any idea, what I did wrong or a suggestion what else I could do ?