Create screenshot on entire screen comprising multiple ignition windows

I am working on Ignition Vision 8.1.2


My application has separate 6 separate windows covering 4 quadrant and 1 header 1 footer, something like image attached

I need to place a screenshot button that saves a single image of entire screen. To my understanding system.print.createPrintJob() or system.print.printToImage() takes only the parentWindow at most. So I dont want to create multiple images of open windows, all need to be in 1 image

Any suggestions how to do this? I don’t have a keyboard in my application else would have given Windows key + PrintScreen button to achieve it

You could probably use the java.awt.Robot API to press the Win+PrintScreen.

That would work, I can reference the image stored in Pictures\screenshot folder

Any other way to do it using ignition functions

I don’t know offhand how you would do it for all windows at once. Past results from a forum search seem to be window-specific solutions.

Okay thanks! I will try the jawa.awt.Robot API method

When you were using system.print.printToImage what were you passing in? event.parent? Did you try to go deeper (even.parent.parent)?

That worked!!

I had to go multiple levels deep, I used event.source.parent.parent.parent.parent.parent
So 4 extra parent levels.
here’s what came up:

Root Container

Level1 = javax.swing.JLayeredPane[null.layeredPane,0,0,800x600,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,optimizedDrawingPossible=true]

Level2 = javax.swing.JRootPane[,5,22,800x600,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.synth.SynthBorder@5686f2c2,flags=449,maximumSize=,minimumSize=,preferredSize=]
Level3 = Main Window
Level4 = VisionApp[demo]

So once it reached the VisionApp level, it saved image of everything thats open!

A shortcut for you using SwingUtilities and VisionDesktop:

from javax.swing import SwingUtilities
from com.inductiveautomation.factorypmi.application import VisionDesktop
appWindow = SwingUtilities.getAncestorOfClass(VisionDesktop, event.source)

The advantage of this approach is that it should work with multiple desktops, too.


It turned out that my application actually has 6 Vision desktops/containers, one for each quadrant, and 1 each for header and footer.
So I had to try and use your method. Somehow it also captures only the window from which the event is fired, but not other windows.
Going through the documentation for VisionDesktop

Works only if all vision screens are in single desktop, and single Vision container