Hi together again,

I implemented a protocol handler for the CommandURL .Judas:PrintTrays.
The target of this new protocol is to print a document on different
printer trays (page one on tray with letter paper, the others on the
tray with normal paper). After sending the print command via API I added
a PrintJobListener:
-----%<-----
// Querying for the interface XPrintable on the loaded document
XPrintable xPrintable = (XPrintable)
                UnoRuntime.queryInterface(XPrintable.class,
                        this.xComponent);

// Adding a print job listener
XPrintJobBroadcaster selection = (XPrintJobBroadcaster)
                UnoRuntime.queryInterface(XPrintJobBroadcaster.class,
                        xPrintable);
OOPrintJobListener ooPrintJobListener = new OOPrintJobListener();
ooPrintJobListener.setDebug(debug);
selection.addPrintJobListener(ooPrintJobListener);

// Setting the property "Pages" so that only the desired pages
// will be printed.
PropertyValue[] printOpts = new PropertyValue[1];
printOpts[0] = new PropertyValue();
printOpts[0].Name = "Pages";
printOpts[0].Value = myPages;

try {
        xPrintable.print(printOpts);
} catch (IllegalArgumentException e) {}
                
// Watch print process and continue if done.
// TODO: see OO Bug id 72240; don't print a non-existing page, other-
// wise here is a loop.
while (ooPrintJobListener.getStatus() == null ||
           ooPrintJobListener.getStatus() == PrintableState.JOB_STARTED)
{
        try {
                Thread.sleep(2000);
        }
        catch (InterruptedException e) {}
}
-----%<-----

In the line where I wait send the Thread sleeping, I send the whole OO
sleeping and my protocol handler throws an exception. Is this a bug or a
feature?

I solved this problem by creating another thread printing my document.
Then it works. But this other thread won't show my dialog if the print
failes. How can I show the dialog if my print failes from an other thread?

Greetings, Tobias

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

Reply via email to