Re: Get list of printers

Niklas Nebel <[email protected]> Thu, 07 Apr 2011 18:08:00 +0200
Newsgroups gmane.comp.openoffice.devel.api
Message-ID <[email protected]>
On 07.04.2011 15:48, Andrew Douglas Pitonyak wrote:
> I had hoped it would be as easy as
>
> CreateUnoService("com.sun.star.awt.PrinterServer")
>
> Unfortunately, the returned object is not usable.

"Usable" is a relative term. You can always do something like this:

oServer = CreateUnoService("com.sun.star.awt.PrinterServer")
oCore = CreateUnoService("com.sun.star.reflection.CoreReflection")
oClass = oCore.forName("com.sun.star.awt.XPrinterServer")
oMethod = oClass.getMethod("getPrinterNames")
aNames = oMethod.invoke(oServer, Array())

Niklas
--
-----------------------------------------------------------------
To unsubscribe send email to [email protected]
For additional commands send email to [email protected]
with Subject: help