How to get full screen on System.print.printToImage?

Hi

I would like to make screen capture button which capture hole screen including navigation bars to image file.
I can make this with system.print.printToImage function but it needs container name and I want to include all containers from all windows?
Maybe there is better way to do this?

Br
Tommi Vahtera

The following code prints anything displayed in Ignition. It essentially grabs the frame that holds everything, and prints it.

obj = system.gui.getParentWindow(event) .parent
printJob = system.print.createPrintJob(obj) 
printJob.showPrintDialog = 0
printJob.orientation = system.print.LANDSCAPE
printJob.print()
2 Likes

Thanks, works nice !

Thanks Kyle,

I’ll have to bookmark this.

super, this is just what I was looking for too :smiley:

Does this still work for Ignition 8.0?

I get errors on line three saying " showprintdialog" does not exist…

https://docs.inductiveautomation.com/display/DOC80/system.print.createPrintJob

Looks like it has changed to “.setShowPrintDialog(Boolean)”
Orientation also changed, “.setOrientation(int)”

obj = system.gui.getParentWindow(event) .parent
printJob = system.print.createPrintJob(obj) 
printJob.setShowPrintDialog(0)
printJob.setOrientation(0)
printJob.print()

@PLCINC_NY, I just tested the original script, it still works perfectly fine. What are you getting for an error?

@bkthomas, nothing has changed. setShowPrintDialog(val) and showPrintDialog = val are the same thing.

Yes.
The “setShowPrint(val)” & "setOrientation(0)

all worked well .

printJob.showPrint = val and printJob.orientation = val will also work.

1 Like