Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  RPRINT (1)


rprint - remote printing utility using a raw bidirectional tcp connection


Implementation Notes
Return Values
See Also


rprint [-a number_of_attempts,delay_in_seconds] [-b buffer_size] [-d] [-e] [-E] [-f file_name] [-i number_of_attempts,delay_in_seconds] [-l] [-p port_number[,port_number]] [-r number_of_attempts,delay_in_seconds] [-s final_delay_in_seconds] [-t timeout_in_seconds] [-u] [-w warning_period_in_seconds] [-x xmit_delay_in_seconds] {printer_name | printer_address}


The rprint utility establishes a bidirectional raw tcp connection to a network printer, usually on port 9100. In case of PostScript(TM) printers, rprint may be directed to query the printer for accounting and printer status information.

Although rprint can be used interactively, too, it is normally be invoked by an lpd(8) input filter program.


Some options are applicable for PostScript(TM) printers only and distinguished from the others by the leading string (PS) in the description text.

Available options are:

-a number_of_attempts,delay_in_seconds (PS) Inquires the page counter of the printer before sending any data and after having sent all data. The inquiry is done at less once, but normally multiple times until either two consecutive inquiries return the same page count or the maximal number of attempts given by the first part of the argument would be exceeded. Between each pair of inquiries there will be a delay the amount of which is given by the second part of the argument in seconds. Finally, the total number of pages printed will be calculated and printed on standard output.
-b buffer_size Sets the size of the send and receive buffer in bytes; rprint will attempt to transmit data to the printer in packets of this size. The default buffer size is 4096 bytes.
-d Turns on debug mode. All data sent and received as well as some additional information will be printed to the standard error output.
-e (PS) Causes rprint to send an end-of-file character after print job transmission and to wait for an acknowledgement.
-E (PS) Similar do -e, but causes rprint to wait for an acknowledgement only for the time period specified with -a or -s.
-f file_name Name of the file containing the data to print. If this options is not specified, data to send to the printer are read from standard input.
-i number_of_attempts,delay_in_seconds (PS) rprint will inquire the printer status before sending and after having sent all data and will wait for the printer to be idle before taking any other action. The inquiry will be done for the specified number of times with a delay of the specified number of seconds between each inquiry. Please note that many PostScript(TM) printers will never report an idle status after a tcp connection has been established.
-l Literal printing; needed for transmitting binary data. In normal non-literal operation, rprint will replace each byte of the print data representing one of the characters ^C (003), ^D (004) and ^T (020) by a space character due to their special meaning for PostScript(TM) interpreters.
-p port_number,[port_number] Port numbers on the printer side to send data to and to receive data from. If only one port number is specified, it will be used for sending and receiving data. If this option is not specified, rprint will assume the jetdirect port 9100 by default which is used by most printer network interfaces for raw tcp communication. Please note that the lpd(8) printing protocol according to RFC1179 is not implemented in rprint and thus rprint will not be able to make use of a connection to a printer on port 515.
-r number_of_attempts,delay_in_seconds By default, rprint will retry to establish a connection to a network printer for 60 times with a delay of one second before each retry if the connection cannot be established immediately. Different values can be specified here.
-s final_delay_in_seconds After having sent all data to the printer, rprint will wait some time for an unrequired and possibly delayed printer reply. The default value for this time is five seconds, different values can be specified here. A delay time specified by -a will override any value given with -s.
-t timeout_in_seconds Specifies a timeout value in seconds after which rprint will give up to wait for a printer reply required by one of the options -a, -e, -i or -u. The default value is 1800 seconds. Similarly, rprint will give up to send data to the printer after this time if the printer does not accept data anymore.
-u (PS) Causes rprint to inquire the printer status before sending and after having sent all data.
-w warning_period_in_seconds While trying to send data to the printer without success, or while waiting for a printer reply required by one of the options -a, -e, -i or -u, rprint will write warning messages to the system log each number of seconds specified here. If this options is not specified, the default value will be 300 seconds.
-x xmit_delay_in_seconds Network printers are often not capable to receive data with the same data rate computer systems could achieve when sending to an equivalent counterpart. Thus rprint will delay the next attempt to transmit a packet by the time quantum given here if the printer is not ready to receive data. The default value of the transmit delay time is 0.1 seconds. Whereas in general rprint accepts integer values as arguments only, here and only here a floating point value may be given.


rprint installs handlers for the signals SIGINT, SIGPIPE and SIGTERM and tries to shut down a connection to a printer gently after SIGINT or SIGTERM have been received.

An unexpected connection loss indicated by SIGPIPE will be written to the system log.


A simple example working with nearly all types of network printers offering a raw tcp port 9100 is:

rprint -f -l is assumed to be the ip address of the network interface of the printer in this example.

When sending to a Hewlett Packard LaserJet 8000 DN printer in PostScript(TM) mode (see BUGS section), the next example will apply:

rprint -a6,10 -e -i60,1 -p9100 hp8000

hp8000 is assumed to be the hostname of the printer resolvable by the system. Please note that there is some experimenting necessary for each printer model to find out the applicable options and to adjust the corresponding arguments.

When invoking rprint within an input filter used by lpd(8) the following skeleton may help to code the input filter:

rprint 1>&2 && exit 0
exit 2

In the printcap(5) file, the printer will be be defined like a local printer. No real device file will be assigned, of course, but e.g. lp=/dev/null may be used.


rprint writes some information to standard error output in an abbreviated manner while communicating with the printer. The extent of information given depends on the options specified. Following example resulting from the second example given above (Hewlett Packard LaserJet 8000 DN) will be used for an explanation:

#3 page(s)

The letter i shows that the printer is idle. The numbers 2098 and 2101 are the values of the page counter before sending and after having sent the print job. Each dot . indicates a data packet (the size of which is equal to the buffer size) that has been sent to the printer. After 16 packets have been sent, only each 16th packet transmission is shown by 16x. The dollar sign $ shows that the printer has acknowledged the end-of-file character sent by rprint after transmitting all data. The line #3 page(s) is written to standard output and gives the number of pages printed; it may be used for accounting purposes.

The character indicating the status of the printer may be one of the following:

b busy
e error
i idle
n initializing
o offline
p printing
r warming
u unknown
w waiting

Instead of the dollar sign $ a colon : will be printed to indicate the end of data transfer if end-of-file acknowledgement by the printer is not required. If it is required but missing an exclamation point ! will be printed.

rprint should print self-explaining error messages to the standard error output in case of error conditions.


The exit code rprint returns to the parent process may take one of the following values:

0 Nothing went wrong, data transmission has been successful.
1 An invalid option, option argument, printer name or printer address has been given, or memory allocation during program initialization failed.
2 The file containing the data to print or the streaming socket could not be opened, or the latter one could not be set to non-blocking, or the connection could not be established, or the printer was not idle or did not report the page counter or the status information correctly, or the signal handlers could not be installed or de-installed, or the connection timed out.
3 The printer reported a PostScript(TM) error within the print job and ignored the rest of the job.


printcap(5), lpd(8)


rprint has originally been developed for
.Fx 2.1.5-RELEASE and later been ported to newer releases. It is not part of the base system.


Some of the special options of rprint useful for PostScript(TM) printers only require the PostScript(TM) interpreter already to be active when the tcp connection gets established. These options do not work with a printer automatically selecting an interpreter depending on the data to print.

For example, Hewlett Packard printers offering PostScript(TM) or PCL(TM) selection automatically depending on the print job, have to be configured with PERSONALITY=PS to disable automatic selection.


.An Konrad Heuer Aq
Search for    or go to Top of page |  Section 1 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.