# Invokelater printing

**URL:** <https://forum.inductiveautomation.com/t/invokelater-printing/8907>\
**Category:** Ignition\
**Created:** [August 14, 2014, 8:02pm UTC](https://forum.inductiveautomation.com/t/invokelater-printing/8907 "2014-08-14T20:02:19Z")\
**Posts on this page:** 1\
**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:** [August 14, 2014, 8:02pm UTC](https://forum.inductiveautomation.com/t/invokelater-printing/8907/1 "2014-08-14T20:02:19Z")

</div>

I have a pdf that I am trying to open and print via a pushbutton. When I press the button, I was having the issue where the printout was blank.

I tried to use the invokelater function, but I am not having any luck getting it to work.

Here is the event script:

system.nav.openWindow(‘BATCH/Stafford/BatchReportO2’)  
window = system.gui.getWindow(‘BATCH/Stafford/BatchReportO2’)  
def job2():  
job = system.print.createPrintJob(window.getRootContainer())  
job.setMargins(0.0)  
job.fitToPage = 1  
job.orientation = system.print.PORTRAIT  
job.showPageFormat = 0  
job.showPrintDialog = 0  
job.print()  
system.util.invokeLater(job2,1000)

What am I doing wrong? It seems to just sit there and not print. If I remove the tab indent on the system.util.invokelater function, it says, NameError: global name ‘system’ is not defined.

What can I do to get this to work?
