# Open Window in background and Print it

**URL:** <https://forum.inductiveautomation.com/t/open-window-in-background-and-print-it/10187>\
**Category:** Ignition\
**Created:** [July 1, 2015, 12:04pm UTC](https://forum.inductiveautomation.com/t/open-window-in-background-and-print-it/10187 "2015-07-01T12:04:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhananjay\_vichare](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dhananjay_vichare/32/74712_2.png) [@dhananjay\_vichare](https://forum.inductiveautomation.com/u/dhananjay_vichare)\
**Post date:** [July 1, 2015, 12:04pm UTC](https://forum.inductiveautomation.com/t/open-window-in-background-and-print-it/10187/1 "2015-07-01T12:04:36Z")

</div>

I had created some reports like hourly, Daily and Monthly. Now I want to print thses reports on scheduled time. Like Hourly report will be automatically print on every hour and Daily report on every end of the day or Start of the Next day.

I had created the tags for schedules and created below gateway script.

But I could not able to access window and component from gateway script.

In other option, I had passing the schedule tag value to REPORT\_VIEWER component and on change property event try to print the report. It is working while report screen is opened and if report screen is closed it was not working.

Need help.

---

<div class="post-metadata">

**Author:** ![dhananjay\_vichare](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dhananjay_vichare/32/74712_2.png) [@dhananjay\_vichare](https://forum.inductiveautomation.com/u/dhananjay_vichare)\
**Post date:** [July 2, 2015, 10:19am UTC](https://forum.inductiveautomation.com/t/open-window-in-background-and-print-it/10187/2 "2015-07-02T10:19:23Z")

</div>

[i]Example:

# This would prompt the user to print, showing them the print dialog box and starting with the deafult printer selected

report = event.source.parent.getComponent("Report Viewer")  
report.print()  
Example:

# This would print to the "HP Laserjet" printer with no user interaction

report = event.source.parent.getComponent("Report Viewer")  
report.print("HP Laserjet", 0)  
Example:

# This would print to the default printer with no user interaction

report = event.source.parent.getComponent("Report Viewer")  
report.print(None, 0)[/i]

I had tried this...... ![:heart:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/9634633d14c35d0584d891622d22ebdebfa1820e.gif "Heart")

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 2, 2015, 9:21pm UTC](https://forum.inductiveautomation.com/t/open-window-in-background-and-print-it/10187/3 "2015-07-02T21:21:30Z")

</div>

Hi Dhan, hope all is well with you!

GUI components are not available from the gateway. There needs to be a running client executing a client script.

---

<div class="post-metadata">

**Author:** ![dhananjay\_vichare](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dhananjay_vichare/32/74712_2.png) [@dhananjay\_vichare](https://forum.inductiveautomation.com/u/dhananjay_vichare)\
**Post date:** [July 7, 2015, 3:14pm UTC](https://forum.inductiveautomation.com/t/open-window-in-background-and-print-it/10187/4 "2015-07-07T15:14:49Z")

</div>

Thank you for the information,
