hpoj reference: ptal-printd

The ptal-printd daemon creates a special file (specifically, a named pipe), which simulates a traditional unidirectional printer character device. Any data written to this pipe special file, presumably by the print spooler, is correctly routed through libptal, ptal-mlcd, and on to the printer.

Using ptal-printd makes it easy to set up a print queue in conjunction with the hpoj software, because given a particular print spooler, almost exactly the same procedure is used to set up printing with an hpoj-driven multi-function peripheral as would be used to set up printing with a single-function printer. The only difference is where the print job data goes; instead of printing to something like /dev/lp0 or /dev/usb/lp0, the print queue is configured to print to something like /var/run/ptal-printd/mlc_par_OfficeJet_Series_700 or /var/run/ptal-printd/mlc_usb_OfficeJet_G85.

Important: If you're using CUPS (Common UNIX Printing System) as your print spooler, then ptal-printd likely will not work for you, because for security reasons newer versions of CUPS refuse to print to arbitrary file locations. The hpoj software now includes a CUPS ptal backend (ptal-cups) which you should use instead of ptal-printd.

Click here for more information on setting up printing with the hpoj software.


The ptal-printd command-line syntax is as follows:
	ptal-printd devname [options...]
Where: Recommended options: Other possible options (not necessary in most cases):


Previous versions of ptal-printd used /dev/ptal-printd as the default -pipepath. That has now been changed to /var/run/ptal-printd, because some platforms have a read-only /dev file system. For the sake of backwards compatibility, ptal-init attempts to create a symlink from /dev/ptal-printd to /var/run/ptal-printd so you don't have to recreate your print queues when upgrading from a previous hpoj version.

If you're setting up multiple print queues to the same device, then you should ensure that the "-morepipes n" option is passed to ptal-printd. This option causes the specified number of additional pipes (for example, 9) to be created with the same base name as the "main" pipe but with two underscores (or the character specified by -colon) and a 1-based index appended, for example, /var/run/ptal-printd/mlc_usb_PSC_750, /var/run/ptal-printd/mlc_usb_PSC_750__1, /var/run/ptal-printd/mlc_usb_PSC_750__2, etc. Simply set each print queue to send its data to a different one of these pipes to ensure that print data from multiple queues doesn't get interleaved (with quite undesirable results).

Don't confuse the ptal-printd daemon (with a trailing "d") and the ptal-print command-line utility (without a trailing "d"), which is an alias for ptal-connect.

ptal-printd logs startup and error messages to syslog (/var/log/messages) in addition to logging to standard error.

If you specify the -uel switch, a UEL (Universal Escape Language) sequence (Esc%-12345X) is sent before a print job, and a PCL end-of-job sequence (EscE) and another UEL are sent after a print job, to help identify job boundaries for the printer. However, this may not happen in the case of back-to-back print jobs, because ptal-printd may not get an end-of-file indication when reading from the pipe if data from the next job is already in the pipe by the time it reads the last data from the previous job.

-nouel is now the default behavior, because normally print drivers automatically add these kinds of escape sequences if necessary, the printer already gets job boundaries based on when the print channel is closed and reopened between jobs, and it may cause problems when printing to devices that don't support PCL.

If during a print job an error occurs with communicating with the device, the rest of the print job data is discarded, subject to the limitations discussed above regarding ptal-printd's ability to detect boundaries of back-to-back jobs. Subsequent jobs are retried indefinitely if it's not possible to re-open the print channel to the device.