NonStop Server for Java 5.1 Programmer's Reference
Java Print Service (JPS)
The Java Print Service is implemented in NonStop Server for Java 5.1. The Java Print Service allows you to print
on printers directly attached to NonStop systems and to network printers attached to a local area network (LAN) or
wide area network (WAN). For information on configuring network printers, see the Spooler FASTP Network
Print Processes Manual. For information on the Spooler subsystem, see the Spooler Utilities Reference Manual.
The JPS implemented into NonStop Server for Java 5.1 uses the headless version of the javax.print API.
The functionality of the JPS API available on NonStop systems will be limited to the functionality that can be
supported by the NonStop spooler and printer. Also, the NonStop operating system requirement for sending text
and postscript files to separate printers also applies when printing under JPS.
The JPS classes are:
javax.print●
javax.print.attribute●
javax.print.attribute.standard●
javax.print.event●
Note: For applications using the java.awt.print.PrinterJob class, the printer should be
postscript enabled. For information on enabling postscript printing, see the Spooler FASTP Network
Print Processes Manual.
Using the Guardian Printer
NonStop Java API accepts the Guardian printer filenames.
The following code fragment shows how to set the Guardian printer filename and print the print.txt file.
..
String printer = "\$s.#<guardian-printer-name>";
FileInputStream stream =
new FileInputStream("print.txt"); // file to print
..
PrintServiceAttributeSet prAttr =
new HashPrintServiceAttributeSet();
prAttr.add(new PrinterName(printer, null));
PrintServiceLookup lookup = new UnixPrintServiceLookup();
PrintService[] services = null;
..
services = lookup.getPrintServices(null, prAttr);
..
DocPrintJob job = services[0].createPrintJob();
SimpleDoc doc = new SimpleDoc(stream,
DocFlavor.INPUT_STREAM.AUTOSENSE, null);