Following code is used on button event.
Report viewer is used in popup window. and using print function from report viewer.
event.source.parent.getComponent(‘Report Viewer’).print()
But getting following error:
Traceback (most recent call last): File “event:actionPerformed”, line 1, in java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: 0 or negative value argument
caused by IllegalArgumentException: 0 or negative value argument
Ignition v7.9.4 (b2017082911)
Java: Oracle Corporation 1.8.0_171
Can anyone help on this…
You’ll need to post the full stack trace, (ideally, wrapped in triple quotes for posting on the forum here) to be able to see what’s going wrong.
error message
Traceback (most recent call last):
File "<event:actionPerformed>", line 9, in <module>
at javax.print.attribute.standard.MediaPrintableArea.<init>(Unknown Source)
at com.inductiveautomation.rm.viewer.RMViewer.print(RMViewer.java:1210)
at com.inductiveautomation.reporting.components.ReportViewer.doPrint(ReportViewer.java:1055)
at com.inductiveautomation.reporting.components.ReportViewer.print(ReportViewer.java:1040)
at com.inductiveautomation.reporting.components.ReportViewer.print(ReportViewer.java:1028)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: 0 or negative value argument
at org.python.core.Py.JavaError(Py.java:495)
at org.python.core.Py.JavaError(Py.java:488)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
at org.python.core.PyObject.__call__(PyObject.java:387)
at org.python.core.PyObject.__call__(PyObject.java:391)
at org.python.core.PyMethod.__call__(PyMethod.java:109)
at org.python.pycode._pyx78.f$0(<event:actionPerformed>:9)
at org.python.pycode._pyx78.call_function(<event:actionPerformed>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1275)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:657)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:183)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:284)
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:55)
at com.sun.proxy.$Proxy23.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: 0 or negative value argument
at javax.print.attribute.standard.MediaPrintableArea.<init>(Unknown Source)
at com.inductiveautomation.rm.viewer.RMViewer.print(RMViewer.java:1210)
at com.inductiveautomation.reporting.components.ReportViewer.doPrint(ReportViewer.java:1055)
at com.inductiveautomation.reporting.components.ReportViewer.print(ReportViewer.java:1040)
at com.inductiveautomation.reporting.components.ReportViewer.print(ReportViewer.java:1028)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
... 50 more
Ignition v7.9.4 (b2017082911)
Java: Oracle Corporation 1.8.0_171
Did you set the report’s margins to 0? Try a very small value rather than 0.