HELIOS Base User manual

10 HELIOS LPR printing system
The acronym "LPR" stands for Line Printer Requester and has been the default protocol used by UNIX to access printers. For the last 10 years HELIOS has been continuing to develop the LPR printing system in order to support PostScript print jobs, many network protocols, different output workflows, and advanced accounting and error handling.
"lpr" creates a printer job in a spooling area for subsequent printing as facilities become available. Each print job consists of a control file and one or more data files. The data files are copies of (or, with -s, symbolic links to) each file name you specify. The spool area is managed by the "lpd" (Line Printer Daemon). Jobs that specify a printer on a remote machine are forwarded by "lpd". "lpr" reads from the standard input if no files are specified.
"lpr", which is responsible for passing print jobs to the appropriate printer, is used by the HELIOS Base printing service and is configured through the UNIX configuration file "HELIOSDIR/var/conf/printcap". This file contains an entry for each printer queue assigned to the system in order to define how the printer is connected to the network, and to specify which programs are responsible for transferring data to the printer.
10.1 The HELIOS printing system
The HELIOS printing system derives from the LPR printing system. The figures below and on the next page show the workflow which print jobs usually take, considering the various types of printer queues.

The printer settings are best configured in EtherShare Admin (Printer > Settings). Fonts, PPDs (PostScript Printer Description) and PostScript initialization are stored in the "HELIOSDIR/var/spool/qmeta" directory. The spool directories for the HELIOS print queues are defined in the "printcap" file ("HELIOSDIR/var/conf/printcap").

The figure on the previous page gives an overview of the HELIOS printing system workflow. However, of course it is possible to combine two or more printer queues and, in doing so, gain more efficiency from the printing process. E.g., the printer queues can be configured so that successfully resolved print jobs are sent to a so-called "Hold" queue, whereas faulty print jobs are relocated to an "Error" queue.
Another possibility is to define printer queues in the process that employ more than one other queue and so save time and server resources:
Clone queue
By use of a "Clone queue" print jobs can be duplicated into multiple queues (see Fig. 30) which are defined in a group of printers.
Fig. 30: Example "Clone queue"

* CTP = Computer To Plate
Balance queue
A "Balance queue" is used to set up a group of printers for load balancing - that is for shifting print jobs to a second or third printer in a group whenever the first printer is busy with a huge job (see Fig. 31).
Fig. 31: Example "Balance queue"

* next available queue in "Balance" group.

Note: We recommend to select the same PPD for the "Balance queue" which is already assigned to the printers of this group. Otherwise the printing results may not be predictable.

10.2 Printer output interfaces
The table below lists the HELIOS printer output interfaces and briefly describes their task/function. The column HELIOS products lists the HELIOS software product which supports the particular printer output interface.
HELIOS product
"Balance queue" driver
"Clone queue" driver
"Print to disk" driver
Print to AppleTalk/PAP driver
PCShare 2.5 DOS driver
"Create PDF" interface driver
PDF HandShake
"Shared Memory" driver
Remote LPR/TCP stream driver
Time interface driver
PrintPreview driver
PCShare Windows driver

10.3 LPR
lpr - send a job to the printer
HELIOSDIR/bin/lpr [-Pprinter ][-#copies ][-Cclass ]
-Jjob ][-Ttitle ][-i[indent ]][-1234font ][-wcols ]
-r][-m][-h][-s][-filter-option ][filename ... ]
lpr creates a printer job in a spooling area for subsequent printing as facilities become available. Each printer job consists of a control file and one or more data files. The data files are copies of (or, with -s, symbolic links to) each filename you specify. The spool area is managed by the line printer daemon, lpd. Jobs that specify a printer on a remote machine are forwarded by lpd.
lpr reads from the standard input if no files are specified.
Options (= not used by HELIOS LPR printing)
Send output to the named printer. Otherwise send output to the printer named in the environment variable PRINTER, or to the default printer lp.
Produce the number of copies indicated for each named file, e.g.:
example% lpr -#3 index.c lookup.c
produces three copies of index.c, followed by three copies of lookup.c. On the other hand,
example% cat index.c lookup.c || lpr -#3
generates three copies of the concatenation of the files.
Print class as the job classification on the burst page. For example,
example% lpr -C Operations new.index.c
replaces the system name (the name returned by hostname) with Operations on the burst page, and prints the file new.index.c.
Print job as the job name on the burst page. Normally, lpr uses the first file's name.
Use title instead of the file name for the title used by pr.
Indent output indent SPACE characters. Eight SPACE characters is the default. The indent is passed to the input filter. If no input filter is present, this option is ignored.
(see -4)
(see -4)
(see -4)
Mount the specified font on font position 1, 2, 3 or 4.
The daemon will construct a .rail-mag file in the spool directory that indicates the mount by referencing
Use cols as the page width for pr.
Remove the file upon completion of spooling, or upon completion of printing with the -s option.
Send mail upon completion.
Suppress printing the burst page.
Create a symbolic link from the spool area to the data files rather than trying to copy them (so large files can be printed). This means the data files should not be modified or removed until they have been printed. This option can be used to avoid truncating files larger than the maximum given in the mx capability of the printcap entry. -s only prevents copies of local files from being made. Jobs from remote hosts are copied anyway. -s only works with named data files; if the lpr command is at the end of a pipeline, the data is copied to the spool.
Pass options to the printer output interfaces. The options are stored in the control file ("cf" file) for the print job. When the job is printed, the options are set in the environment of the printer output interface as "HELIOS_XOPTION_key=value".
It is possible to specify more than one -x option on the command line.
The following single letter options notify the line printer spooler that the files are not standard text files. The spooling daemon will use the appropriate filters to print the data accordingly:
-p Use pr to format the files (lpr -p is very much like
"pr | lpr").
-l Print control characters and suppress page breaks.
-t The files contain troff (cat phototypesetter)
binary data.
-n The files contain data from ditroff (device
independent troff).
-d The files contain data from tex (DVI format from
-g The files contain standard plot data as produced by
the plot routines (see also plot(1G) for the filters
used by the printer spooler).
-v The files contain a raster image, see rasterfile.
The printer must support an appropriate imaging
model such as PostScript in order to print the image.
-c The files contain data produced by cifplot.
-f Interpret the first character of each line as a standard
FORTRAN carriage control character.
If no filter-option is given (and the printer can interpret PostScript), the string "%!" as the first two characters of a file indicates that it contains PostScript commands.
These filter options offer a standard user interface, and all options may not be available for, nor applicable to, all printers.
lpr: copy file is too large
A file is determined to be too large to print by copying into the spool area. lpr truncates the file, and prints as much of it as it can. The maximum file length is specified by the mx capability of the printcap entry for the printer. If no mx capability is specified, the default limit is 1000 Kbytes. Use the -s option as defined above to make a symbolic link to the file instead of copying it. The HELIOS default lpr job size is unlimited.
lpr: printer : unknown printer
The printer was not found in the printcap database. Usually this is a typing mistake; however, it may indicate a missing or incorrect entry in the file
lpr: printer : jobs queued, but cannot start daemon.
The connection to lpd on the local machine failed. This usually means the printer server started at boot time has died or is hung. Check the local socket
"/dev/printer" to be sure it still exists (if it does not exist, there is no lpd process running).
lpr: printer : printer queue is disabled
This means the queue was turned off with
example% /usr/etc/lpc disable printer
to prevent lpr from putting files in the queue. This is normally done by the system manager when a printer is going to be down for a long time. The printer can be turned back on by a superuser with lpc.
If a connection to lpd on the local machine cannot be made lpr will say that the daemon cannot be started. Diagnostics may be printed in the daemon log file regarding missing spool files by lpd.
Limitations (= not used by HELIOS LPR printing)
Command line options cannot be combined into a single argument as with some other commands. The command:
lpr -fs
is not equivalent to
lpr -f -s
Placing the -s flag first, or writing each option as a separate argument, makes a link as expected.
lpr -p is not precisely equivalent to pr | lpr. lpr -p puts the current date at the top of each page, rather than the date last modified.
Fonts for troff and TEX reside on the printer host. It is currently not possible to use local font libraries.
The -s option only avoids copying the data file to the spool directory of the local machine. If the printer for a job resides on a remote machine, the data file will be copied to the remote spool directory in all cases.
10.4 LPRM
lprm - remove jobs from the printer queue
HELIOSDIR/bin/lpc [ -Pprinter ][- ][job #... ]

lprm removes a job or jobs from a printer's spooling queue. Since the spool directory is protected from users, using lprm is normally the only method by which a user can remove a job.
Without any arguments, lprm deletes the job that is currently active, provided that the user who invoked lprm owns that job.
When the super-user specifies a username, lprm removes all jobs belonging to that user.
You can remove a specific job by supplying its job number as an argument, which you can obtain using lpq. For example:
example% lpq -Phost
host is ready and printing
Rank Owner Job Files Total Size
active wendy 385 standard input 35501 bytes
example% lprm -Phost 385
lprm reports the names of any files it removes, and is silent if there are no applicable jobs to remove.
lprm kills the active printer daemon, if necessary, before removing spooled jobs; it restarts the daemon when through.
Display information about the queue for the specified printer. In the absence of the -P option, the queue to the printer specified by the PRINTER variable in the environment is used. If the PRINTER variable isn't set, the queue for the default printer is used.
Remove all jobs owned by you. If invoked by the superuser, all jobs in the spool are removed. (Job ownership is determined by the user's login name and host name on the machine where the lpr command was invoked).
lprm: printer : cannot restart printer daemon
The connection to lpd on the local machine failed. This usually means the printer server started at boot time has died or is hung. If it is hung, the master lpd daemon may have to be killed and a new one started.
Since race conditions are possible when updating the lock file, an active job may be incorrectly identified for removal by an lprm command issued with no arguments. During the interval between an lpq command and the execution of lprm, the next job in line may have become active; that job may be removed unintentionally if it is owned by you. To avoid this, supply lprm with the job number to remove when a critical job that you own is next in line.
Only the superuser can remove print jobs submitted from another host.
10.5 LPQ
lpq - display the queue of printer jobs
HELIOSDIR/bin/lpc [-Pprinter ][-l][+[interval]]
[job #... ] [username...]

lpq displays the contents of a printer queue. It reports the status of jobs specified by job#, or all jobs owned by the user specified by username. lpq reports on all jobs in the default printer queue when invoked with no arguments.
For each print job in the queue, lpq reports the user's name, current position, the names of input files comprising the job, the job number (by which it is referred to when using lprm) and the total size in bytes. Normally, only as much information as will fit on one line is displayed. Jobs are normally queued on a "first-in-first-out basis". File names comprising a job may be unavailable, such as when lpr is used at the end of a pipeline; in such cases the file name field indicates ``(standard input)".
If lpq warns that there is no daemon present (that is, due to some malfunction), the lpc command can be used to restart a printer daemon.
Display information about the queue for the specified printer. In the absence of the -P option, the queue to the printer specified by the PRINTER variable in the environment is used. If the PRINTER variable isn't set, the queue for the default printer is used.
Display queue information in long format; includes the name of the host from which the job originated.
+[ interval ]
Display the spool queue periodically until it empties. This option clears the terminal screen before reporting on the queue. If an interval is supplied, lpq sleeps that number of seconds in between reports.
printer is ready and printing
The lpq program checks to see if there is a printer daemon. If the daemon is hung, the superuser can abort the current daemon and start a new one using lpc.
Waiting for printer to become ready
The daemon could not open the printer device. The printer may be turned off-line. This message can also occur if a printer is out of paper, the paper is jammed, and so on. Another possible cause is that a process, such as an output filter, has exclusive use of the device. The only recourse in this case is to kill the offending process and restart the printer with lpc.
Waiting for host to come up
A daemon is trying to connect to the remote machine named host, in order to send the files in the local queue. If the remote machine is up, lpd on the remote machine is probably dead or hung and should be restarted using lpc.
Sending to host
The files are being transferred to the remote host, or else the local daemon has hung while trying to transfer the files.
Warning: printer is down
The printer has been marked as being unavailable with lpc.
Warning: no daemon present
The lpd process overseeing the spooling queue, as indicated in the ``lock'' file in that directory, does not exist. This normally occurs only when the daemon has unexpectedly died. Check the printer's error log for a diagnostic from the deceased process; you can restart the printer daemon with lpc.
lpq may report unreliably. The status as reported may not always reflect the actual state of the printer. Under some circumstances, lpq reports that a printer is ready and printing when the daemon is, in fact, hung.
Output formatting is sensitive to the line length of the terminal; this can result in widely-spaced columns.
lpq is sometimes unable to open various files when the lock file is malformed.
10.6 LPC
lpc - line printer control program
HELIOSDIR/bin/lpc [ command [ parameter... ] ]
lpc controls the operation of the printer, or of multiple printers, as described in the "HELIOSDIR/var/conf/printcap" database. lpc commands can be used to start or stop a printer, disable or enable a printer's spooling queue, rearrange the order of jobs in a queue, or display the status of each printer - along with its spooling queue and printer daemon.
With no arguments, lpc runs interactively, prompting with lpc>. If arguments are supplied, lpc interprets the first as a command to execute; each subsequent argument is taken as a parameter for that command. The standard input can be redirected so that lpc reads commands from a file.
Commands may be abbreviated to an unambiguous substring.

Note: the printer parameter is specified just by the name of the printer (as lw), not as you would specify it to lpr or lpq (not as -Plw).

? [command]...
help [command]...
Display a short description of each command specified in the argument list, or, if no arguments are given, a list of the recognized commands.
abort [ all | [ printer ...]]
Terminate an active spooling daemon on the local host immediately and then disable printing (preventing new daemons from being started by lpr) for the specified printers. The abort command can only be used by the superuser.
clean [ all | [ printer ...]]
Remove all files with names beginning with cf, tf, ef, vf, or df from the specified printer queue(s) on the local machine. The clean command can only be used by the superuser.
disable [ all | [ printer ...]]
Turn the specified printer queues off. This prevents new printer jobs from being entered into the queue by lpr. The disable command can only be used by the superuser.
down [ all | [ printer ...]][message]
Turn the specified printer queue off, disable printing and put message in the printer status file. The message does not need to be quoted, the remaining arguments are treated like echo. This is normally used to take a printer down and let others know why (lpq indicates that the printer is down, as does the status command).
enable [ all | [ printer ...]]
Enable spooling on the local queue for the listed printers, so that lpr can put new jobs in the spool queue. The enable command can only be used by the superuser.
Exit from lpc.
restart [ all | [ printer ...]]
Attempt to start a new printer daemon. This is useful when some abnormal condition causes the daemon to die unexpectedly leaving jobs in the queue. lpq reports that there is no daemon present when this condition occurs. This command can be run by any user.
start [ all | [ printer ...]]
Enable printing and start a spooling daemon for the listed printers. The start command can only be used by the superuser.
status [ all | [ printer ...]]
Display the status of daemons and queues on the local machine. This command can be run by any user.
stop [ all | [ printer ...]]
Stop a spooling daemon after the current job completes and disable printing. The stop command can only be used by the superuser.
topq printer [ job# ...][user ...]
Move the print job(s) specified by job# or those job(s) belonging to user to the top (head) of the printer queue. The topq command can only be used by the superuser.
up [ all | [ printer . . . ] ] Enable everything and start a new printer daemon. Undoes the effects of down.
?Ambiguous command
The abbreviation you typed matches more than one command.
?Invalid command
You typed a command or abbreviation that was not recognized.
?Privileged command
You used a command that can be executed only by the superuser.
10.7 LPD
lpd - printer daemon
HELIOSDIR/sbin/lpd [-l]
lpd is the line printer daemon (spool area handler). It is usually invoked at boot time from the "start-helios" script, making a single pass through the printcap file to find out about the existing printers and printing any files left after a crash. It then accepts requests to print files in a queue, transfer files to a spooling area, display a queue's status, or remove jobs from a queue. In each case, it forks a child process for each request, and continues to listen for subsequent requests.
The Internet port number used to communicate with other processes is obtained with getservent.
If a file cannot be opened, an error message is logged using the facility of syslog. lpd will try up to 20 times to reopen a file it expects to be there, after which it proceeds to the next file or job.
All TCP/IP remote LPR print jobs are only accepted by the LPD daemon if access is granted in the "HELIOSDIR/var/conf/ipaccess" file. We recommend to edit the "ipaccess" configuration file with EtherShare Admin (Lists > IP Access) or PCShare Admin (Setup > IP Access).
To allow remote access to the LPD of a machine, independent of the entries in the main "ipaccess" list, it is possible to create a "HELIOSDIR/var/conf/ipaccess.lpd" file which will only be used by the LPD daemon.
To set up a "ipaccess.lpd" file you could do the following:
-> Copy the existing "ipaccess" file to "ipaccess.lpd".
cd /usr/local/helios/var/conf
cp ipaccess ipaccess.lpd
-> Then edit "ipaccess.lpd" for your needs.
Log valid requests received from the network. This can be useful for debugging purposes.
Lock File
The lock file in each spool directory is used to prevent multiple daemons from becoming active, and to store information about the daemon process for lpr, lpq, and lprm.
lpd uses flock to provide exclusive access to the lock file and to prevent multiple daemons from becoming active simultaneously. If the daemon should be killed or die unexpectedly, the lock file need not be removed. The lock file is kept in a readable ASCII form and contains two lines. The first is the process id of the daemon and the second is the control file name of the current job being printed. The second line is updated to reflect the current status of lpd for the programs lpq and lprm.
Control Files
After the daemon has successfully set the lock, it scans the directory for files beginning with cf. Lines in each cf file specify files to be printed or non-printing actions to be performed. Each such line begins with a key character that indicates what to do with the remainder of the line.
J Job name to print on the burst page.
C Classification line on the burst page.
L Literal. This line contains identification information
from the password file, and causes a burst page to be
T Title string for page headings printed by pr.
H Hostname of the machine where lpr was
P Person. Login name of the person who invoked
lpr. This is used to verify ownership by lprm.
M Send mail to the specified user when the current
print job completes.
f Formatted File, the name of a file to print that is
already formatted.
l Like f, but passes control characters along, and does
not make page breaks.
p Name of a file to print using pr as a filter.
t Troff File. The file contains troff output (cat
photo-typesetter commands).
n Ditroff File. The file contains device independent
troff output.
d DVI File. The file contains T E X output (DVI
format from Stanford).
g Graph File. The file contains data produced by
c Cifplot File. The file contains data produced by
v The file contains a raster image.
r The file contains text data with FORTRAN carriage
control characters.
1 Troff Font R. The name of a font file to use instead
of the default.
2 Troff Font I. The name of the font file to use instead
of the default.
3 Troff Font B. The name of the font file to use instead
of the default.
4 Troff Font S. The name of the font file to use instead
of the default.
W Width. Changes the page width (in characters) used
by pr and the text filters.
I Indent. Specify the number of characters by which
to indent the output.
U Unlink. The name of file to remove upon completion
of printing.
N Filename. The name of the file being printed, or a
blank for the standard input (when lpr is invoked
in a pipeline).
x X options set with lpr -x
Data Files
When a file is spooled for printing, the content is copied into a data file in the spool directory. Data file names begin with df. When lpr is called with the -s option, the control files contain a symbolic link to the actual file, and no data files are created.
Minfree File
The file minfree in each spool directory contains the number of kB to leave free so that the line printer queue will not completely fill the disk.
10.8 Printcap
printcap - printer capability database
printcap is a simplified version of the termcap database for describing printers. The spooling system accesses the printcap file every time it is used, allowing dynamic addition and deletion of printers. Each entry in the database describes one printer. This database may not be substituted for, as is possible for termcap, because it may allow accounting to be bypassed.
The default printer is normally lp, though the environment variable PRINTER may be used to override this. Each spooling utility supports a -Pprinter option to explicitly name a destination printer.
Refer to the "4.3 BSD Line Printer Spooler Manual" for a discussion of how to set up the database for a given printer.
Each entry in the printcap file describes a printer, and is a line consisting of a number of fields separated by ":" characters. The first entry for each printer gives the names which are known for the printer, separated by "|" characters. Entries may continue onto multiple lines by giving a "\" as the last character of a line, and empty fields may be included for readability.
Capabilities in printcap are all introduced by two-character codes, and are of three types:
Boolean Capabilities that indicate that the printer has
some particular feature. Boolean capabilities are
simply written between the ":" characters, and
are indicated by the word "bool" in the type
column of the capabilities table below.
Numeric Capabilities that supply information such as
baud-rates, number of lines per page, and so on.
Numeric capabilities are indicated by the word
num in the type column of the capabilities table
below. Numeric capabilities are given by the
two-character capability code followed by the
"#" character, followed by the numeric value.
The following example is a numeric entry stating
that this printer should run at 1200 baud:
String Capabilities that give a sequence which can be
used to perform particular printer operations
such as cursor motion. String valued capabilities
are indicated by the word str in the type column
of the capabilities table below. String valued
capabilities are given by the two-character
capability code followed by an "=" sign and then
a string ending at the next following ":", e.g.:
is a sample entry stating that the remote printer
is named spinwriter.
If an entry for a file or directory is not an absolute path (i.e. does not start with "/") then the file or directory is relative to HELIOSDIR.
name of accounting file
if lp is a tty, set the baud rate (ioctl call)
cifplot data filter
TEX data filter (DVI format)
User ID of user "daemon".
if lp is a tty, clear flag bits
string to send for a form feed
print a form feed when device is opened
like "fc" but set bits
graph data filter (plot format)
print the burst header page last
driver supports (non standard) ioctl to indent printout
name of input/communication filter (created per job)
error logging file name
name of lock file
device name to open for output
maximum number of copies
list of terminal modes to set or clear
maximum file size (in BUFSIZ blocks), zero = unlimited
next directory for list of queues (unimplemented)
ditroff data filter (device independent troff)
name of output/banner filter (created once)
price per foot or page in hundredths of cents
page length (in lines)
page width (in characters)
page width in pixels (horizontal)
page length in pixels (vertical)
filter for printing FORTRAN style text files
restricted group. Only members of group allowed access
machine name for remote printer
remote printer name argument
restrict remote users to those with local accounts
open printer device read/write instead of write-only
short banner (one line only)
suppress multiple copies
spool directory
suppress form feeds
suppress printing of burst page header
status file name
name of similar printer; must be last
troff data filter (C/A/T phototypesetter)
trailer string to print when queue empties
raster image filter
if lp is a tty, clear local mode bits
like "xc" but set bits

If the local line printer driver supports indentation, the daemon must understand how to invoke it.
Example preferences for AppleTalk/PAP printer:
# Spooler Preferences for PAP and SMB:
bin/pcfilter lw8500 | bin/lpr -Plw8500
# Interface Preferences for AppleTalk PAP:
LaserWriter 8500:LaserWriter@HELIOS Backbone
Example HELIOS "printcap" entries:
/etc/passwd personal identification
HELIOSDIR/var/conf printer capabilities database
HELIOSDIR/var/conf interface output options
HELIOSDIR/var/conf TCP/IP access list for remote
/ipaccess access to the LPD
HELIOSDIR/var/run "pid" for master LPD daemon
HELIOSDIR/var/run communication socket file
HELIOSDIR/sbin/lpd line printer daemon
HELIOSDIR/bin/*if HELIOS printer drivers
/var/spool/* directories used for spooling
/var/spool/*/cf* daemon control files
/var/spool/*/df* data files specified in `cf' files
/var/spool/*/tf* temporary copies of `cf' files
/var/spool/*/ef* print job error file
/var/spool/*/vf* print job PDF view file,
e.g. PDF from "PrintPreview" or
"Create PDF" spool queue
/var/spool/*/minfree minimum free space to leave
/var/spool/*/status text status file of current print job
HELIOSDIR/var/spool PPD file for spooler/device

HELIOSDIR/var/spool PostScript fonts of device

HELIOSDIR/var/spool printer setup file to be included
/qmeta/*/SETUP in every PostScript job
HELIOSDIR/var/spool sequence ID of next job

HELIOSDIR/var/spool "pid" of the queue LPD daemon

HELIOSDIR/var/spool queue log file in spool directory

© 2002 HELIOS Software GmbH