com.numdata.printer
Class LPDClient

java.lang.Object
  extended by com.numdata.printer.LPDClient

public class LPDClient
extends Object

Client for the Line Printer Daemon Protocol.

Author:
Gerrit Meinders
See Also:
RFC 1179: Line Printer Daemon Protocol

Field Summary
static int DEFAULT_PORT
          The default LPD port number.
 
Constructor Summary
LPDClient(PrinterSettings printerSettings)
          Constructs a new instance.
LPDClient(String hostname, int networkPort, String queueName)
          Constructs a new instance.
 
Method Summary
 void print(String documentName, byte[] documentData, boolean printRaw)
          Print a document to a LPD print server on a network host.
 void removeCurrentJob()
          Removes the currently active job.
 String requestQueueState(boolean longFormat)
          Requests information about the printer queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
The default LPD port number.

See Also:
Constant Field Values
Constructor Detail

LPDClient

public LPDClient(PrinterSettings printerSettings)
Constructs a new instance.

Parameters:
printerSettings - Printer settings to use.

LPDClient

public LPDClient(String hostname,
                 int networkPort,
                 String queueName)
Constructs a new instance.

Parameters:
hostname - Host name or IP address of server.
networkPort - Port to use on host (0 or less to use default).
queueName - Name of remote printer queue or port.
Method Detail

requestQueueState

public String requestQueueState(boolean longFormat)
                         throws PrinterException
Requests information about the printer queue.

Parameters:
longFormat - false for short format; true for long format.
Returns:
Printer queue information.
Throws:
PrinterException - if an error occurs while accessing the printer.

removeCurrentJob

public void removeCurrentJob()
                      throws PrinterException
Removes the currently active job.

Throws:
PrinterException - if an error occurs while accessing the printer.

print

public void print(String documentName,
                  byte[] documentData,
                  boolean printRaw)
           throws PrinterException
Print a document to a LPD print server on a network host. This implementation conforms to RFC1179, except for the fact that it does not use local port numbers 721 - 731, which may not always be available.

Parameters:
documentName - Name of document to display in queue.
documentData - Document data to print.
printRaw - Print raw vs. cooked data.
Throws:
PrinterException - if there was a problem sending the document to the printer.


Copyright © 2017 Numdata BV. All rights reserved.