7.8.3 vs 7.7.2 using PDF Viewer and JFrame/Swing

I’m having an issue with an app when testing on 7.8.3. In the 7.7.2 version, we use the most recent version of the PDF Viewer module. The user selects an item to view and the PDF is displayed in a floating JFrame window.

Behind the scenes, an Ignition window containing the PDF viewer is opened, then the JFrame window is constructed and displayed, followed by the closing of the Ignition window. The code snippet looks like this:

pdfwindow = system.gui.getWindow(‘MES_Validation_Setup/PDF’)
main = system.gui.getWindow(‘MES_Validation_Setup/Main Window’)
pdfwindow.getRootContainer().getComponent(‘PDF Viewer’).filename = filename

from javax.swing import JFrame
contentPane = system.gui.getWindow(‘MES_Validation_Setup/PDF’).rootContainer.getRootPane().getContentPane()
newWindow = JFrame()
newWindow.title = ‘PDS Drawing’

In 7.7.2 the user gets a floating window that they can drag onto a second monitor for viewing outside of the Ignition app. Within this window, the user can still adjust the zoom factor of the PDF.

In 7.8.3 we changed the Ignition window to use the PDF Viewer found in the Reporting module. Now, the JFrame window only works if the Ignition window remains open. The last line of code above will cause the JFrame window to go blank or become unresponsive (can’t scroll or change zoom %).

Any thoughts on what I’m missing are appreciated.


Update -

The simple workaround was to move the open Ignition window to a lower layer so that it remains open without being visible. That keeps the JFrame window working normally in 7.8.3.

Consider adding a JDesktopPane to your JFrame, then putting the target window in the desktop pane, maximized. If you also use openWindowInstance(), this will let you have multiple PDFs open, each independent of the main application window.
The key is that Ignition’s window object is the host of all binding operations, so you can’t close it and expect much of Ignition’s tech to work. The window is an instance of JInternalFrame, though, so you can reparent it to a JDesktopPane. This generic approach works for any Ignition window, not just a window containing a PDF viewer.