rlpr

Remote printing (org.dyndns.hvkls.rlpr)  // configuration

BSD-compatible, enhanced replacements for lpr, lpq, and lprm. Includes the hvkls.dyndns.org script “tlpr” to fix stair-stepping plain-text printouts.

Version History

  • 2.0.6-6 Added dependency to org.dyndns.hvkls.repository

Usage

rlpr can transport files to remote print queues. The corresponding printer driver needs to be installed on the server (typically a remote computer), or the printer itself.

Once set up as described below, printing from iOS is as easy as “lpr /path/to/file” or “stdout|rlpr”.

Network Printer

To print text files on a Brother HL-2070N laser printer (LPD queue), set $RLPR_PRINTHOST to its IP address, and $PRINTER to TEXT_P1. With “laser” pointing to the printer’s IP address through /etc/hosts, the following will get you going:

  • # run this code just once, as root (su -)!
    echo ‘export PRINTER=”TEXT_P1″‘ >> /etc/profile
    echo ‘RLPR_PRINTHOST=”laser”‘ >> /etc/profile
    killall Terminal
  • # Example of printer laser at 192.168.111.222
    # run this code just once, as root (su -)!
    echo ‘192.168.111.222 laser’ >> /etc/hosts

Print Server

Instead of direct printing, you could also set up queue with a print server like CUPS. This print server must accept LPD connections (port 515; cups-lpd man page). It must also have the appropriate filters to process input, like foomatic with Brother-HL-1250-hl1250.ppd for the aforementioned printer, referenced as laser in /etc/hosts on both systems.

Printer setup of iOS client

  • # run this code just once, as root (su -)!
    echo ‘export PRINTER=”laser”‘ >> /etc/profile
    echo ‘RLPR_PRINTHOST=”ls”‘ >> /etc/profile
    killall Terminal

Print Server Setup

On the server, set up /etc/cups/lpoptions for (only) plain text output adjustment on printer laser. Thereafter, restart CUPS.

  • # run this code as root (su -)!
    lpadmin -p laser -o PageSize=A4 -o job-sheets=none -o cpi=12 -o lpi=8 -o page-left=36 -o page-top=36 -o page=right=36 -o page-bottom=36
    killall -HUP cupsd

Thanks to CUPS’s MIME capacities /etc/cups/mime.*, it should be able to detect the filetype automatically.

Fix Stair-Stepping Output

Two ways to solve this:

  • Preferably, on the server, edit /usr/lib/cups/filter/foomatic-rip and change my $added_lf = “\n”; to my $added_lf = “\r\n”;
  • Alternatively, on iPhoneApple iPhone, employ the (included) wrapper script tlpr to fix eventual ‘stairs’ in plain-text printouts. Use tlpr for plain-text files, rlpr for other file-types.tlpr
    tlpr: Fix stair-stepping in plain-text input, and output to rlpr
    Usage: ‘tlpr /path/to/file‘, or ‘tlpr -‘ for stdin processing
    Pass non-plain-text input to rlpr instead.

Recent Posts

Meta

Comments are closed.