Question - Print Fee

Hello,

In ignition 8.1.7, I try to use “system.print.createPrintJob()” function in the button to allow the user to and select the their preferred printer and print out the report in PDF Viewer.
After the user printed the report, I would like to record it to DB if the user did press “Print” button on the screen below.

Here is the script, it looks like the no matter the user decides to press ‘Print’ or ‘Cancel’ button, system.print.createPrintJob will return the class with some sort of UUID like "
com.inductiveautomation.factorypmi.application.script.builtin.PrintUtilities$JythonPrintJob@ea6d399".

I have also tried to use getPrinterName() function as well, but it always return None to me.
print script

is there any way that the return value can determine the button that the user press (Print or Cancel)?

Thank you

Unfortunately, it doesn’t look like there is. We could theoretically amend the print() method on the job to return a true/false, but I don’t see any way to get a useful value out via scripting.

Thanks for reply!
I end up using from javax.print import PrintServiceLookup as PSL to create the client printer list on table and using setShowPrintDialog(0) to prevent the user to cancel the printing.

1 Like