Mike Bissett wrote: > On Tue, 12 May 2009 06:53:15 pm Caolán McNamara wrote: >> >> How about... >> uno.invoke(document, "print", (printOpts,)) >> i.e. add that extra "," >> > Yeah that did the trick thanks. Also found out after this that actually > having > a printer setup is a good idea also or this function silently does nothing :). > >> >> I'm not sure, but you *may* need to wait for printing to complete before >> going on to try and close the document >> > Looks like that could be the case as I'm getting this error when running the > script for a second time against a headless server: > > File "./DocumentConverter.py", line 165, in <module> > converter.print_convert(argv[1], argv[2]) > File "./DocumentConverter.py", line 109, in print_convert > document.close(True) > uno.RuntimeException: illegal object given! > > Any pointers on how I can wait for the print job to complete ? > I tried hacking in a sleep but that does not seem to help. when running out > of > headless mode a sleep of 200ms stops any errors.
You shouldn't need to wait, you only must be able to catch the exception that closing the document while printing will cause. Passing "True" as argument in the "close" call will make sure that OOo itself will take responsibility to close the document immediately after the printing has finished and so your Python code can forget about the document. I have no idea what caused the RuntimeException you have reported. Waiting is possible. You can pass a "Wait" property in the arguments of the "print" call (a boolean value with -surprise! ;-) - value "True"). Regards, Mathias -- Mathias Bauer (mba) - Project Lead OpenOffice.org Writer OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS Please don't reply to "[email protected]". I use it for the OOo lists and only rarely read other mails sent to it. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
