Hello Hal,

The real problem you have ... printing is by default an asynchronous
operation. And of course - if you try to dispose a document which is
currently in printing state it can crash (at least it shouldnt ...
but it can).

The best solution: start the printing job with a well documented
parameter "Wait=true". see css.view.PrintOptions for further details.

So I can set a print option of "Wait" to "true" and my program will wait until the document is printed? Do I understand that properly? That would simplify several questions I've had along the way.

It makes your XPrintable.print() call synchron !
If your call returns the document was printed (at least the content
was transfered completely to the underlying print queue of your system).
That means you can close the document afterwards without any problems
and you can shutdown the whole office without any problems.


On the other side it can be important how do you close the document.
Do you use dispose() or close(). Documentation say you have to
preferr XClosable.close().

That's what I'm using.

OK. ... with close(true) I hope :-)


Further its always a good idea to control the lifetime of a document without any exception and call
close(false). Means - please do not deliver the ownership to the
document itself. It can work for a while ... but if you close the
application it can make trouble. Because all documents not finished
within her jobs ... but closed with "false" does not know how they
should handle these situation right. They can of course handle it
right ... but mostly they dont do it :-)

But if I use "Wait=true" for printing, then close immediately after the doc has been printed, and only load in one at a time, then that should eliminate any problems, right?

Yes - and your code will be more readable and easy.
There is no need to use polling code, sleeps, threads or listener.
Only 3 lines of code are needed ...

loadComponentFromURL()
print()
close()

... OK - excepting some further stuff to define all needed parameters :-)


Hal

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Regards
Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to