Print jobs in remote machines through the LPR command.

1 lpr

<lpr
    host='host'
    port='port'
    user='user'
    queue='queue'
    docname='docname'
    prtcode='prtcode'
/>

Exceptions

lpr already in use, close it first

A communication LPR is not possible to establish with the printer because there is one in process (for the same host, user and queue).

no active lpr connection

The communication LPR is not possible to obtain with the printer because there is no one established.

java.net.UnknownHostException

The name of domain or the specified IP address is not valid.

Remarks

In case of not indicate the host, queue and printer port by default, the system interprets which it is the connected user.

Remarks

This communications are performed through the protocol based in TCP Line Printer Daemon Protocol. A daemon is a Unix/Linux program which is executed in second plan permanently, waiting to receive remote petitions to lend a certain service.

To print documents in PDF format, The configuration of tge printer should be performed in the printer manager. In the case of platforms Unix/Linux dispose of the CUPS (Common Unix Printing System). You should register the printer informing the brand and the mode, getting that every time a document arrives in the print queue in a format recognized (PDF), CUPS performs the conversion to the language interpretable by the print device (PCL, PS).

Setting of CUPS:

Before start the setting of CUPS, you should check that the printing of the operating system using the lpr command, works correctly. This test should be performed both from the print server itself, as from another computer in the network (against the print server queue).

- CUPS dispose of a web application which allows to manage the printers, accessible through the URL http://localhost:631. 631 is the port by default, it exist the possibility to change it through the file /etc/cups/cupsd.conf.

- Once in the main menu, you should select the option administration tasks and later, click the button Add printer. Next, the fields to inform that are shown in the successive pages and their respective values are shown (for example):

  • Name: hplj_3330
  • Location: Administración
  • Description: Hewlett-Packard LaserJet 3330
  • Connection: LPD/LPR Host or Printer
  • connection URL: lpd://192.168.10.200/RAW
  • Producer: HP
  • Model: HP LaserJet Series Postscript

Ver también

http://www.ietf.org/rfc/rfc1179.txt - RFC 1179 - Line Printer Daemon Protocol.

Example

Send to print a newly created text file

Copy
<xsql-script name='lpr_sample1'>
    <body>
        <set name='m_file'><file name='data.txt' /></set>

        <file.out.open id='out1'><m_file /></file.out.open>
        <file.out.print id='out1'>Hello world</file.out.print>
        <file.out.close id='out1' />

        <lpr host='w2ksrv1' user='dvt' queue='hplj_3330'>
            <lpr.sendFile><m_file /></lpr.sendFile>
        </lpr>
    </body>
</xsql-script>