K
Karsten Wutzke
Hi all!
I really just want to print something very simple - just a plain text
string. But it doesn't work... PrintServiceLookup.lookupPrintServices
returns a zero length (or empty) array of print services.
//get plain text string doc flavor
DocFlavor df = DocFlavor.STRING.TEXT_PLAIN;
//make doc
Doc doc = new SimpleDoc(strOutputSchedule, df, null);
//get services
PrintService[] services = PrintServiceLookup.lookupPrintServices(df, null);
if ( services.length>0 )
{
DocPrintJob job = services[0].createPrintJob();
try
{
job.print(doc, pras);
}
catch ( PrintException pe )
{
System.err.println("Print exception!");
}
}
else
{
System.out.println("No printer found!");
}
This code will print "No printer found!" to the console all the time.
Looks like I don't have the simplest service installed. How can I get it
to work without having to worry about other users having to install
working print services manually??
Can anyone help?
Karsten
I really just want to print something very simple - just a plain text
string. But it doesn't work... PrintServiceLookup.lookupPrintServices
returns a zero length (or empty) array of print services.
//get plain text string doc flavor
DocFlavor df = DocFlavor.STRING.TEXT_PLAIN;
//make doc
Doc doc = new SimpleDoc(strOutputSchedule, df, null);
//get services
PrintService[] services = PrintServiceLookup.lookupPrintServices(df, null);
if ( services.length>0 )
{
DocPrintJob job = services[0].createPrintJob();
try
{
job.print(doc, pras);
}
catch ( PrintException pe )
{
System.err.println("Print exception!");
}
}
else
{
System.out.println("No printer found!");
}
This code will print "No printer found!" to the console all the time.
Looks like I don't have the simplest service installed. How can I get it
to work without having to worry about other users having to install
working print services manually??
Can anyone help?
Karsten