List Info

Thread: RE: avoid printer discovery




RE: avoid printer discovery
user name
2007-06-15 11:47:27
Hello,
We use a java program to drive documents in an OO instance;
part of
loading the document is to get a printable accessor:
==
  private XComponent       theComponent;
  private XTextDocument    textDocument;
  private XPrintable       printable;
  private PropertyValue    printerProps[];

  . . .
  synchronized (lock) {
      if (loadingBody) {
          theComponent =
officeConnection.loadDocument(getFrame()
                       , documentBody);
      } else {
          theComponent =
officeConnection.loadDocument(getFrame()
                       , documentName, templateName);
      }

      textDocument          = (XTextDocument)   
                             
queryInterface(XTextDocument.class
                            , theComponent);
      printable             = (XPrintable)
                             
queryInterface(XPrintable.class
                            , textDocument);

      this.printerProps     = new PropertyValue[]
                            { new PropertyValue(
"Name"
                                               , -1
                                               ,
""
                                               ,
PropertyState.DIRECT_VALUE)
                            };
  }
  . . .
==
then
==
  void print(String printerName) {
    if (printable != null) try {
      printerProps[0].Value = printerName;
      printable.setPrinter(printerProps);
      printable.print(printArgs);
    }
    catch (Throwable tr) {
      caught(tr, true);
    }
  }
==
printerName is provided in a property set or some other
java-centric
resource.
Thanx
John S


-----Original Message-----
From: Philippe Brun (perso) [mailto:phb.persoaegle.fr]

 
Hi,

I'm printing documents from a java program connected to an
OO instance
on a remote Linux server. I 
would like to avoid printer discovery.

----egasseM lanigirO-----

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: avoid printer discovery
user name
2007-06-18 04:34:13
Hi John,

thanks to you for your response.

I'm afraid though, that printer discovery takes place when
the OO instance starts on the server, 
before the remote java program connects and gets a chance to
do anything.

But I hope I missed something...

Regards
--
Philippe

John Sisson a écrit :
> Hello,
> We use a java program to drive documents in an OO
instance; part of
> loading the document is to get a printable accessor:
> ==
>   private XComponent       theComponent;
>   private XTextDocument    textDocument;
>   private XPrintable       printable;
>   private PropertyValue    printerProps[];
> 
>   . . .
>   synchronized (lock) {
>       if (loadingBody) {
>           theComponent =
officeConnection.loadDocument(getFrame()
>                        , documentBody);
>       } else {
>           theComponent =
officeConnection.loadDocument(getFrame()
>                        , documentName, templateName);
>       }
> 
>       textDocument          = (XTextDocument)   
>                              
queryInterface(XTextDocument.class
>                             , theComponent);
>       printable             = (XPrintable)
>                              
queryInterface(XPrintable.class
>                             , textDocument);
> 
>       this.printerProps     = new PropertyValue[]
>                             { new PropertyValue(
"Name"
>                                                , -1
>                                                ,
""
>                                                ,
> PropertyState.DIRECT_VALUE)
>                             };
>   }
>   . . .
> ==
> then
> ==
>   void print(String printerName) {
>     if (printable != null) try {
>       printerProps[0].Value = printerName;
>       printable.setPrinter(printerProps);
>       printable.print(printArgs);
>     }
>     catch (Throwable tr) {
>       caught(tr, true);
>     }
>   }
> ==
> printerName is provided in a property set or some other
java-centric
> resource.
> Thanx
> John S
> 
> 
> -----Original Message-----
> From: Philippe Brun (perso) [mailto:phb.persoaegle.fr]

>  
> Hi,
> 
> I'm printing documents from a java program connected to
an OO instance
> on a remote Linux server. I 
> would like to avoid printer discovery.
> 
> ----egasseM lanigirO-----
> 
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
> For additional commands, e-mail: dev-helpapi.openoffice.org
> 
> 
> 

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: avoid printer discovery
user name
2007-06-18 07:50:46
Philippe Brun (perso) wrote:

> Hi John,
> 
> thanks to you for your response.
> 
> I'm afraid though, that printer discovery takes place
when the OO instance starts on the server, 
> before the remote java program connects and gets a
chance to do anything.

Printer discovery is done in a separate thread. So it
shouldn't disturb
you as long as you don't try to access any printer.

Ciao,
Mathias

-- 
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/Gu
llFOSS
Please don't reply to "nospamformbagmx.de".
I use it for the OOo lists and only rarely read other mails
sent to it.

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )