By Axel Schmidt
Sometimes you might run into the requirement to provide the possibility of printing to a network printer from a SUSE Linux Enterprise Thin Client or SLEPOS POS Client and you don’t want to discover the mysteries of Linux printing, printer queues and CUPS, the Common Unix Printing system.
If this is your case, you will find this article helpful and you will be surprised how easy it is, to enable a JavaPOS based retail or a virtual desktop application the possibility to print to a network printer.
SLED 10 installed on the POS client.
The LPRng Tool
The LPRng tool contained as RPM on the SLE media is an implementation of the Line Printer Daemon protocol (commonly known as the Berkeley printing system LPR/LPD) that provides beside printer spooling network print server functionality.
For more information about LPRng and its options refer to The Printing Cookbook.
To install the RPM on your system start “YaST Control Center > Software > Install and Remove Software” and search for the package “lprng”. Activate the check box of this rpm and select the “Accept”-Button to install it.
Printing to a Network Printer
Almost every actual network printer supports printing of Post Script files. With the basic Linux tools like “a2ps” (ASCII text into PostScript conversation) and “ps2pdf” (Post Script to PDF) and vice versa we can handle very text format so far. Therefore we assume, that it will be no problem to use Post Script as the base text format which is send to the network printer.
Printing is quite simple, just use the following “lpr” command:
lpr -h -Ppr@<Printer Hostname> <File Name>
lpr -h -Ppr@NPI35FDDFD.novell.com test.ps
To define a default network printer, the environment variable “PRINTER” can be exported. In this case printing will be transparent for the application, because it does not need to know any network printer hostnames.
PRINTER=pr@NPI35FDDFD.novell.com; export PRINTER; lpr LinuxNetPrinting.ps
The LPR Options
Usage: lpr [-Pprinter[@host]] [-A] [-B] [-Cclass] [-Fformat] [-G] [-Jinfo] [-(K|#)copies] [-Q] [-Raccountname] [-Ttitle] [-Uuser[@host]] [-V] [-Zoptions] [-b] [-m mailaddr] [-h] [-i indent] [-l] [-w width ] [-r] [-Ddebugopt ] [--] [ filenames ... ] -A - use authentication specified by AUTH environment variable -B - filter files and reduce job to single file before sending -C class - job class -D debugopt - debugging flags -F format - job format -b,-l - binary or literal format c,d,f,g,l,m,p,t,v are also format options -G - filter individual job files before sending -J info - banner and job information -K copies, -# copies - number of copies -P printer[@host] - printer on host -Q - put 'queuename' in control file -Raccntname - accounting information -T title - title for 'pr' (-p) formatting -U username - override user name (restricted) -V - Verbose information during spooling -X path - user specified filter for job files -Y - connect and send to TCP/IP port (direct mode) -Z options - options to pass to filter -h - no header or banner page -i indent - indentation -k - do not use tempfile when sending to server -m mailaddr - mail final status to mailaddr -r - remove files after spooling -w width - width to use -- - end of options, files follow filename '-' reads from STDIN PRINTER, LPDEST, NPRINTER, NGPRINTER environment variables set default printer. LPRng-3.7.10, Copyright 1988-2001 Patrick Powell, <firstname.lastname@example.org>