Printing without a driver using PJL

Use the Printer Job Language (PJL) to print documents without the need to install drivers.

Printer Job Language (PJL) is a method for switching printer languages and for reading printer status. PJL allows you to configure your printer for server-side silent printing on network Postscript printers.

Advantages of PJL printing

  • Does not require driver installation.
  • Full streaming available.
  • Better support for configuration properties.
  • Full support for printer-specific properties.
  • The software and the printer communicate directly with each other, which makes debugging easier.

Potential issues with PJL printing

PJL printing bypasses the system spooler and occurs synchronously with the printer. Therefore, long print jobs can block the production process on printers with limited memory. You can avoid this in interactive applications by executing the printing job in a separate process or thread.

In case of printer failure, such as a paper jam, the application must manage reprinting. You can cause the printer byte stream to be written to a different destination by using the fgl_report_setDestinationURL function, and the file in the specified destination is completed even in case of error. This file contains all the PJL commands so that the job can be restarted by opening a client socket connection at port 9100 to the printer and then sent the contents of this file.

Printer support

The printer must be reachable over the network at TCP port 9100, and support both the PJL and the Postscript language. The printer capabilities must be listed using the PrinterInfo utility, which can also be used to query a specific printer for a list of its PJL environment variables and permissible values.

PJL printer name syntax

PJL printers are identified by their network addresses. A PJL printer is identified by a printer name having the following syntax: pjl:password:host, where password is optional.

Examples without password:

pjl:FrontDesk
pjl:10.0.1.052

Example with password:

pjl:1234:FrontDesk

Configuring and selecting a PJL Printer

Configure the variables for the PJL printer using the fgl_report_setPrinterPJLVariables function.

Important: String values must be specified using double quotes, for example, "quoted string".

Select the PJL printer using the fgl_report_setPrinterName function.

Important: Unlike with driver-based printers, you must specify the printer name, because PJL printers are not discovered automatically.

For example:

DEFINE pjlSet om.SaxAttributes
LET pjlSet=om.SaxAttributes.create()
CALL pjlSet.addAttribute("BINDING","SHORTEDGE")
CALL pjlSet.addAttribute("OUTBIN","UPPER")

CALL fgl_report_setPrinterPJLVariables(pjlSet)

CALL fgl_report_setPrinterName("pjl:10.0.1.052")