Print a Report with a Button Click

Is there an easy way to print a report with a button click. The report.print() function wont work, as i need it to print to the default printer without popping up the print dialog. Here is what i have so far

[code]fpmi.tag.writeToTag("[]Load Information/Load Finish",1)
report = event.source.parent.getComponent(‘Meter Ticket’)
def printReport(report = report):
import fpmi
fpmi.db.refresh(report,“Data”)
job = fpmi.print.createPrintJob(report)
job.showPrintDialog = 0
job.print()
fpmi.system.invokeLater(printReport,5000)
def changeScreen():
import fpmi
fpmi.nav.swapTo(“Welcome”)
fpmi.system.invokeLater(changeScreen)

[/code]

We set a bit to the PLC, which does some logic, then sends a trigger to FSQL. We need to wait 5 seconds for this to finish, as i dont know of an easy way to tell when all the plc/SQL stuff is done. Any help would be greatly appreciated

In the next version of the reporting plugin, there will be a new print function that will let you specify the printer name (or None for the default), and specify whether or not to show the print dialog.

Using the fpmi.print.createPrintJob for reports is not going to give you the results that you want - it’ll print the report as it looks on screen (with scrollbars) on one page, it won’t print a multi-page report.

Hope this helps,

I seem to have a Bit of an issue using this script to print my report…

report = event.source.parent.getComponent(“Report Viewer”)
report.print(None, 0)

I have it on my button just like this & I get an error. I need to print my report w/out the print dialog options box. Any other way to do this on button?

fpmi.db.refresh(report,“Data”)
job = fpmi.print.createPrintJob(report)
job.showPrintDialog = 0
job.print()

What is the error?

[quote=“Kyle Chase”]fpmi.db.refresh(report,“Data”)
job = fpmi.print.createPrintJob(report)
job.showPrintDialog = 0
job.print()[/quote]
This won’t work very well with a report - it will only print the first page.

Thanks… Mystery solved. This print fuction only works on Reporting Plug-in versions 1.1.7 & higher. It works great now. Travis helped me figure that out a few days ago. Sorry I didn’t reply sooner.