Printing Report With Button

I’m trying to print a report with a button on the screen, this is what I have so far.

report = event.source.parent.getComponent('Report Viewer') report.showPrintDialog=0 report.print()

When I run this code it prints a screen shot of the page. I want it to print the report not a screen shot.

I’ve also tried it this way, but get the same result.

report = event.source.parent.getComponent('Report Viewer') job = system.print.createPrintJob(report) job.showPrintDialog=0 job.print()

If I run it this way it works, but I get the Print dialog box. I would like to do this without using the print dialog box.

report = event.source.parent.getComponent('Report Viewer') report.print()

There’s an example of this in the manual:

# This would print to the default printer with no user interaction report = event.source.parent.getComponent("Report Viewer") report.print(None, 0)

support.inductiveautomation.com … viewer.htm

Awesome, this works great! Thanks.