Remote printing over TCP/IP

If you want to set up spooler to print on a remote printer, you can pipe the print job to lpr.

This takes advantage of the fact that the filter sends the print job to the printer; you just name the remote printer in the filter command line of the configuration file used by spooler.

To try it, first get your remote printer working using lpr (see "Remote printing to a TCP/IP-enabled printer using lpr"), then do the following:

  1. Copy the configuration file from the printer you want to use (in this case, a PostScript printer):
    cp /etc/printers/ps.cfg /etc/printers/test.cfg
  2. Find the filter command lines in test.cfg; they look like this:
    Filter   =   phs:$d:phs-to-ps
    Filter   =   raw:$d:cat

    These filter command lines are in the form:


    The phs filter command line tells the filter to process .phs files by sending them through a filter called phs-to-ps before sending them on to the destination passed by spooler. The raw filter command is for utilities that already produce the correct output for the printer.

  3. Change the phs filter command line from this:
    Filter  =   phs:$d:phs-to-ps

    to this:

    Filter  =   phs:ps:phs-to-ps
  4. Add a line to tell the filter to send all PostScript files to the remote printer, rlpt2:
    Filter    ps:$d:lpr -Prlpt2

    What you've done is change the destination from that given by spooler to ps, so that after the .phs file has been converted to a ps type by phs-to-ps, it goes to the ps filter. Then the ps filter line you added sends PostScript files to lpr, forcing output to the remote printer (just as you did in "Remote printing to a TCP/IP-enabled printer using lpr").

    You might be wondering what happened to the destination passed by spooler ($d). Well, that is discarded because lpr (unlike phs-to-ps) doesn't return the job to the filter but completes it itself.

  5. Finally, start a new instance of spooler, telling it the pathname of your new configuration file (in this case /etc/printers/test.cfg) and the name of the printer you want to use (in this case rlpt2), like this:
    spooler -d /dev/null -c /etc/printers/test.cfg -n rlpt2 &

    The -n option specifies the name of the printer.

Now, you should be able to print your PostScript file on your remote TCP/IP-enabled printer.

Note: For configuration files for printing with lpr, SAMBA, and NCFTP, see the Examples appendix.