Saving file and having gateway open and print the saved file

Hi guys,

I have a network printer set up and am trying to print screenshots, pdf, etc. from my clients. Everything works great except the first time I try to print after a client has opened up. It takes a long time to process the print job (minimum 10 seconds).

From different tests that I’ve done I realized that creating the print job is immediate, however, sending the print job takes a long time, doesn’t matter what type of print script I use, I experience the same behavior every time I print for the first time since a client was started. Same issue with the designer. The problem appears to be the java query the printer capability and status.

My questions is, is there a way of saving files of any sort and send a message to gateway so gateway can open the file and print it? The reason I’d like to do it this way is because when I initiate the print, for the period of the time it takes to get the print job sent (for example 10 seconds) my whole client freezes and nothing updates, it seems like the whole thing stops.

The problem is critical because we have a requirement to stop all PLC sequences when PLC senses that a client is not responding. For this purpose, I have created a heartbeat between client and gateway and PLC monitors it. For that period of time when my client is frozen, the PLC does not see feedback from client and halts everything. So by letting gateway execute the print job, I can eliminate the client freeze up.

Any suggestions?

Spoke with tech support and found a good solution for this. You need to wrap your print script in a function and invoke asynchronous. See the code below:

def printAsync():	
	job = system.print.createPrintJob("Whatever you want to print")	
	job.print()
	
system.util.invokeAsynchronous(printAsync)

This way the client doesn’t wait for the print job to be created or sent to printer.

1 Like