# Getting error while printing report on button event

**URL:** <https://forum.inductiveautomation.com/t/getting-error-while-printing-report-on-button-event/18997>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [July 27, 2018, 12:40pm UTC](https://forum.inductiveautomation.com/t/getting-error-while-printing-report-on-button-event/18997 "2018-07-27T12:40:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sachin.rewale](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@sachin.rewale](https://forum.inductiveautomation.com/u/sachin.rewale)\
**Post date:** [July 27, 2018, 12:40pm UTC](https://forum.inductiveautomation.com/t/getting-error-while-printing-report-on-button-event/18997/1 "2018-07-27T12:40:42Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 27, 2018, 2:20pm UTC](https://forum.inductiveautomation.com/t/getting-error-while-printing-report-on-button-event/18997/2 "2018-07-27T14:20:32Z")

</div>

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.

```auto

```

error message

```auto

```

---

<div class="post-metadata">

**Author:** ![sachin.rewale](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@sachin.rewale](https://forum.inductiveautomation.com/u/sachin.rewale)\
**Post date:** [July 30, 2018, 1:22pm UTC](https://forum.inductiveautomation.com/t/getting-error-while-printing-report-on-button-event/18997/4 "2018-07-30T13:22:39Z")

</div>

```auto
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

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 30, 2018, 3:27pm UTC](https://forum.inductiveautomation.com/t/getting-error-while-printing-report-on-button-event/18997/5 "2018-07-30T15:27:14Z")

</div>

Did you set the report’s margins to 0? Try a very small value rather than 0.
