public class CupsClient extends Object
- get printers
- print documents
- get job attributes
- ...
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_HOST |
static int |
DEFAULT_PORT |
static String |
DEFAULT_USER |
| Constructor and Description |
|---|
CupsClient()
Creates a CupsClient for localhost port 631 with user anonymous
|
CupsClient(String host,
int port)
Creates a CupsClient for provided host and port with user anonymous
|
CupsClient(String host,
int port,
String userName)
Creates a CupsClient for provided host, port and user
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancelJob(int jobID)
Cancel the job with the provided jobID on the current host wit current user
|
boolean |
cancelJob(String hostname,
String userName,
int jobID)
Cancel the job with the provided jobID, hostname for provided userName
|
CupsPrinter |
getDefaultPrinter()
Returns default printer
|
PrintJobAttributes |
getJobAttributes(int jobID)
Returns job attributes for the job associated with the provided jobID
|
PrintJobAttributes |
getJobAttributes(String userName,
int jobID)
Returns job attributes for the job associated with the provided jobID and
user name
|
List<PrintJobAttributes> |
getJobs(CupsPrinter printer,
WhichJobsEnum whichJobs,
String userName,
boolean myJobs)
Returns all jobs for given printer and user Name
|
CupsPrinter |
getPrinter(String printerURL)
Returns the printer for the provided URL
|
List<CupsPrinter> |
getPrinters()
Returns all available printers
|
boolean |
holdJob(int jobID)
Hold the job with the provided jobID on the current host wit current set
user
|
boolean |
holdJob(String hostname,
String userName,
int jobID)
Hold the job with the provided jobID, hostname for provided userName
|
boolean |
moveJob(int jobID,
String userName,
CupsPrinter currentPrinter,
CupsPrinter targetPrinter)
Moves the print job with job ID jobID from currentPrinter to targetPrinter
|
boolean |
releaseJob(int jobID)
Release the held job with the provided jobID on the current host wit
current set user
|
boolean |
releaseJob(String hostname,
String userName,
int jobID)
Release the job with the provided jobID, hostname for provided userName
|
public static final String DEFAULT_HOST
public static final int DEFAULT_PORT
public static final String DEFAULT_USER
public CupsClient()
throws Exception
Exceptionpublic CupsClient(String host, int port) throws Exception
host - port - Exceptionpublic List<CupsPrinter> getPrinters() throws Exception
Exceptionpublic CupsPrinter getDefaultPrinter() throws Exception
Exceptionpublic CupsPrinter getPrinter(String printerURL) throws Exception
printerURL - an URL like http://localhost:631/printers/printernameExceptionpublic PrintJobAttributes getJobAttributes(int jobID) throws Exception
jobID - Exceptionpublic PrintJobAttributes getJobAttributes(String userName, int jobID) throws Exception
userName - jobID - Exceptionpublic List<PrintJobAttributes> getJobs(CupsPrinter printer, WhichJobsEnum whichJobs, String userName, boolean myJobs) throws Exception
Currently all Jobs on the server are returned by this method.
user and printer names are provided in the resulting PrintJobAttributes
printer - userName - Exceptionpublic boolean cancelJob(int jobID)
throws Exception
jobID - Exceptionpublic boolean cancelJob(String hostname, String userName, int jobID) throws Exception
hostname - userName - jobID - Exceptionpublic boolean holdJob(int jobID)
throws Exception
jobID - Exceptionpublic boolean holdJob(String hostname, String userName, int jobID) throws Exception
hostname - userName - jobID - Exceptionpublic boolean releaseJob(int jobID)
throws Exception
jobID - Exceptionpublic boolean releaseJob(String hostname, String userName, int jobID) throws Exception
hostname - userName - jobID - Exceptionpublic boolean moveJob(int jobID,
String userName,
CupsPrinter currentPrinter,
CupsPrinter targetPrinter)
throws Exception
jobID - userName - currentPrinter - targetPrinter - ExceptionCopyright © 2016. All rights reserved.