# Accessing Print Dialog Box with a given value of print copies and get the default printer

**URL:** <https://forum.inductiveautomation.com/t/accessing-print-dialog-box-with-a-given-value-of-print-copies-and-get-the-default-printer/41116>\
**Category:** Ignition\
**Tags:** scripting, ignition80\
**Created:** [December 2, 2020, 6:00am UTC](https://forum.inductiveautomation.com/t/accessing-print-dialog-box-with-a-given-value-of-print-copies-and-get-the-default-printer/41116 "2020-12-02T06:00:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![epifanio.tigno](https://avatars.discourse-cdn.com/v4/letter/e/57b2e6/32.png) [@epifanio.tigno](https://forum.inductiveautomation.com/u/epifanio.tigno)\
**Post date:** [December 2, 2020, 6:00am UTC](https://forum.inductiveautomation.com/t/accessing-print-dialog-box-with-a-given-value-of-print-copies-and-get-the-default-printer/41116/1 "2020-12-02T06:00:43Z")

</div>

Hi,  
I have a simple code below, I have set the printer name and set the print dialog to False. My question is how i can access or code the number of copies with a given value by the user

```
	report = event.source.parent.getComponent('Report Viewer')
	report.print("EPSON TM-T82II Receipt5",0)
```

---

<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:** [December 2, 2020, 4:02pm UTC](https://forum.inductiveautomation.com/t/accessing-print-dialog-box-with-a-given-value-of-print-copies-and-get-the-default-printer/41116/2 "2020-12-02T16:02:36Z")

</div>

You can’t, directly. Something like this _may_ work:

```auto
from org.apache.commons.lang3.reflect import FieldUtils

def setCopies(component, copies):
	rmViewer = FieldUtils.readField(component, "reportView", True)
	rmViewer.copies = copies

```

Which you would use something like this:

```auto
setCopies(event.source.parent.getComponent("Report Viewer"), 3)

```

---

<div class="post-metadata">

**Author:** ![epifanio.tigno](https://avatars.discourse-cdn.com/v4/letter/e/57b2e6/32.png) [@epifanio.tigno](https://forum.inductiveautomation.com/u/epifanio.tigno)\
**Post date:** [December 3, 2020, 3:15am UTC](https://forum.inductiveautomation.com/t/accessing-print-dialog-box-with-a-given-value-of-print-copies-and-get-the-default-printer/41116/3 "2020-12-03T03:15:25Z")

</div>

It seems the code doesn’t work.

---

<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:** [December 3, 2020, 4:20pm UTC](https://forum.inductiveautomation.com/t/accessing-print-dialog-box-with-a-given-value-of-print-copies-and-get-the-default-printer/41116/4 "2020-12-03T16:20:09Z")

</div>

Well, if you can provide any detail about what ‘doesn’t work’ means - is an error thrown? Where are you applying the code? I might be able to help.

---

<div class="post-metadata">

**Author:** ![epifanio.tigno](https://avatars.discourse-cdn.com/v4/letter/e/57b2e6/32.png) [@epifanio.tigno](https://forum.inductiveautomation.com/u/epifanio.tigno)\
**Post date:** [December 7, 2020, 3:59am UTC](https://forum.inductiveautomation.com/t/accessing-print-dialog-box-with-a-given-value-of-print-copies-and-get-the-default-printer/41116/5 "2020-12-07T03:59:47Z")

</div>

It does not throw any errors,  
Maybe constructing/applying code  
I want to elaborate what the program should do

i have a report viewer(barcode) and a default printer, the printer should printer the report viewer for a example 4 times.depends othe the input quantity
