Invokelater printing

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?