Because there is no API interface returning a list of all registered
printers (there is even an issue for this, or at least there was one)
and because there is no such functionality in the Basic runtime, there
is no native SB way to do it, as far as I know.

Workarounds:
Use the mentioned Java code wrapping it up in an interface, making it
language-independent by writing the according idl file and putting it
all together as a UNO component using the OpenOffice.org SDK tools.
Once it is integrated into the office you can just use it from SB.

Try to find platform specific functionality to get the list of
registered printers, for example on Win32
1) by means of a COM-aware application that has some function
returning the list of registered printers with
com.sun.star.bridge.OleObjectFactory

2) by means of loading the specific MS Windows API dll exposing such a
function with the DECLARE statement.

On other platforms like Mac OS X and Linux you might check the (cups)
lpstat tool, running it with the Shell command (problem here: shell
command does not return the console output but just the exit code).


2005/8/8, Turbo Fredriksson <[EMAIL PROTECTED]>:
> [this mail was previously sent to the user list. Sending it here
>  instead/as well becuse of more on-topic here]
> 
> Quoting Christian Andersson <[EMAIL PROTECTED]>:
> 
> > when I asked about this a long time ago, I was told that ther is no
> > such thing in openoffice and I should use the api of the language to
> > do this.
> > for example if you are using java, use the java-api for finding the printers
> > the code below might help you if you are using java
> > public String[] getDefinedPrintersOnServer(){
> >    PrintService[] printers =
> > printServiceLookup.lookupPrintServices(null,null);
> >    String[] data = new String[printers.length];
> >    for(int i=0; i<printers.length; i++){
> >      data[i] = printers[i].getName();
> >    }
> >    return data;
> > }
> >
> > to be able to use these printers in openoffice (in va 1.1.x atleast,
> > hav enot checked with the 1.9 series) you might have to add < and >
> > around the name... so if you get "Hp color jet" from the system call,
> > to be able to use it in openoffice you might have to supply the name
> > "<Hp color jet>"
> 
> Is there any way to do this in OOo BASIC?
> --
> Cocaine South Africa Nazi Semtex cracking iodine jihad Serbian 767 KGB
> Ortega Kennedy terrorist Ft. Meade fissionable
> [See http://www.aclu.org/echelonwatch/index.html for more about this]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
Best Regards
Christian Junker

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

Reply via email to