# Automatic Printing Problems

**URL:** <https://forum.inductiveautomation.com/t/automatic-printing-problems/9622>\
**Category:** Ignition\
**Created:** [January 29, 2015, 4:10pm UTC](https://forum.inductiveautomation.com/t/automatic-printing-problems/9622 "2015-01-29T16:10:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dfenter](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@dfenter](https://forum.inductiveautomation.com/u/dfenter)\
**Post date:** [January 29, 2015, 4:10pm UTC](https://forum.inductiveautomation.com/t/automatic-printing-problems/9622/1 "2015-01-29T16:10:29Z")

</div>

I have run across an issue with an client script used to automatically print a report at midnight. The script is defined below:

name = system.security.getUsername()  
if name == ‘admin’:  
system.nav.openWindow(“Advanced/Totalizers”)  
window = system.gui.getWindow(“Advanced/Totalizers”)  
job = system.print.createPrintJob(window)  
job.showPrintDialog = 0  
job.setMargins(0.5)  
job.fitToPage = 1  
job.orientation = system.print.LANDSCAPE  
job.showPageFormat = 0  
job.print()

When the script is triggered, the printout is blank unless I change the job.showPrintDialog to = 1. This makes it so that the user has to interact to get it to print.

I want the printout to work without user interaction. I have tried using import time, and time.sleep(3) after defining the job, but it still comes out blank.

What can I do to get this working without having job.showPrintDialog = 1? Invokelater?

---

<div class="post-metadata">

**Author:** ![dfenter](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@dfenter](https://forum.inductiveautomation.com/u/dfenter)\
**Post date:** [January 29, 2015, 9:18pm UTC](https://forum.inductiveautomation.com/t/automatic-printing-problems/9622/2 "2015-01-29T21:18:43Z")

</div>

I was able to get the client script used to automatically print without user interaction working by making the following changes:

name = system.security.getUsername()  
if name == ‘admin’:  
system.nav.openWindow(“Advanced/Totalizers”)  
system.nav.closeWindow(“Advanced/Totalizers”)  
system.nav.openWindow(“Advanced/Totalizers”)  
window = system.gui.getWindow(“Advanced/Totalizers”)  
def graph(window = system.gui.getWindow(“Advanced/Totalizers”)):  
import system  
# Get the interior section of the chart  
innerChart = window.getComponent(0)  
job = system.print.createPrintJob(innerChart)  
job.orientation = system.print.LANDSCAPE  
job.showPrintDialog = 0  
job.print()  
#Print 10secs after property change  
system.util.invokeLater(graph, 10000)

---

<div class="post-metadata">

**Author:** ![AJBerera](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@AJBerera](https://forum.inductiveautomation.com/u/AJBerera)\
**Post date:** [May 16, 2017, 2:48pm UTC](https://forum.inductiveautomation.com/t/automatic-printing-problems/9622/3 "2017-05-16T14:48:21Z")

</div>

Anyone have a solution for this that doesn't involve closing windows?

I have a popup that displays a barcode, it prints on a Dymo LabelWriter 450 Turbo just fine with the dialog, but when I try it without a get a blank label automatically printed.

> try:  
> #Print the Barcode to a Label  
> job = system.print.createPrintJob(event.source.parent.getComponent('Barcode'))  
> job.setOrientation(0)  
> job.setPrinterName("DYMO LabelWriter 450 Turbo")  
> job.setPageHeight(40)  
> job.setFitToPage(1)  
> #job.setShowPrintDialog(0)  
> job.print()

> except:  
> 1

> system.nav.closeParentWindow(event)
