Java Print Service

The Java™ Print Service (JPS) API allows printing on all Java platforms. Java 1.4 and subsequent versions provide a framework in which Java runtime environments and third parties can provide stream generator plugins for producing various formats for printing, such as PDF, Postscript, and Advanced Function Presentation (AFP). These plugins create the output formats from bi-dimensional (2D) graphic calls.

A IBM® i print service represents a printer device that is configured with the IBM i command Create Device Description (Printer) (CRTDEVPRT). Specify the publishing information parameters when you create a printer device. This increases the number of print service attributes supported by the IBM i print services.

If a printer supports Simple Network Management Protocol (SNMP), configure the printer on the server. Specify *IBMSNMPDRV for the value of the system driver program parameter in the CRTDEVPRT command. The print services use SNMP to retrieve specific information (printer service attributes) about a configured printer.

The Doc Flavors supported by the IBM i include *AFPDS, *SCS, *USERASCII - (PCL), *USERASCII - (Postscript), and *USERASCII - (PDF). Specify the Doc Flavors that the printer supports in the Data Streams Supported parameter within the Publishing Information of the CRTDEVPRT command.

When an application uses a print service to print a job (document) on the IBM i server, the print service places the document into a spooled file on an output queue with the same name as the printer device (also the same name as specified in the PrinterName attribute). Start a printer writer with the command STRPRTWTR before the documents print on the printer device.

In addition to the attributes defined by the Java Print Service specification, the IBM i print services support the following attributes for all Doc Flavors:

  • PrinterFile (specifies a printer file, name and library, to be used when creating the spooled file)
  • SaveSpooledFile (indicates whether to save the spooled file)
  • UserData (a 10 character string of user defined data)
  • JobHold (indicates whether to hold the spooled file)
  • SourceDrawer (indicates the source drawer to use for the output media)

How to enable JPS

To enable the Java Print Service, ensure the following JAR files are added to the classpath:
  • /QIBM/ProdData/OS400/jt400/lib/jt400Native.jar
  • /QIBM/ProdData/OS400/Java400/ext/ibmjps.jar