### Usage Example: Printing a Document Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/IppOperation.md An example demonstrating how to use IppPrintJobOperation to print a document with custom attributes. ```APIDOC ## Usage Example Most operations are used internally. However, for advanced usage: ```java // Print a document using lower-level operations IppPrintJobOperation printOp = new IppPrintJobOperation(631); Map attributes = new HashMap<>(); attributes.put("requesting-user-name", "john"); attributes.put("job-name", "MyDocument"); attributes.put("job-attributes", "copies:integer:2#sides:keyword:two-sided-long-edge"); try { IppResult result = printOp.request( printer, printer.getPrinterURI(), attributes, credentials ); if (result.getHttpStatusCode() == 200) { AttributeGroup jobGroup = result.getAttributeGroup("job-attributes-tag"); int jobId = Integer.parseInt( jobGroup.getAttribute("job-id").getValue() ); System.out.println("Job created with ID: " + jobId); } } catch (IOException e) { System.out.println("Error: " + e.getMessage()); } ``` ``` -------------------------------- ### getMakeAndModel() Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Gets the manufacturer and model information for the printer. ```APIDOC ## getMakeAndModel() ### Description Gets the make-and-model attribute for the printer. ### Method ```java public String getMakeAndModel() ``` ### Returns `String` - Make and model (e.g., "HP LaserJet Pro") ``` -------------------------------- ### Basic Cups4j Printer Usage Source: https://github.com/harwey/cups4j/blob/master/README.md Demonstrates the fundamental steps to get a default printer and send a print job using Cups4j. ```java CupsClient cupsClient = new CupsClient(); CupsPrinter cupsPrinter = cupsClient.getDefaultPrinter(); InputStream inputStream = new FileInputStream("test-file.pdf"); PrintJob printJob = new PrintJob.Builder(inputStream).build(); PrintRequestResult printRequestResult = cupsPrinter.print(printJob); ``` -------------------------------- ### getMediaSupported() Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Gets the list of supported media sizes for the printer. ```APIDOC ## getMediaSupported() ### Description Gets the list of supported media sizes. ### Method ```java public List getMediaSupported() ``` ### Returns `List` - Supported media types (e.g., "iso_a4_210x297mm", "na_letter_8.5x11in") ``` -------------------------------- ### getDescription() Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Gets the descriptive text associated with the printer. ```APIDOC ## getDescription() ### Description Gets the printer description. ### Method ```java public String getDescription() ``` ### Returns `String` - Description text ``` -------------------------------- ### Configure PrintJob with Extra Attributes Source: https://github.com/harwey/cups4j/blob/master/README.md Provides an example of building a PrintJob with various optional attributes like job name, copies, page ranges, and custom IPP attributes. ```java PrintJob printJob = new PrintJob.Builder(bytes) .jobName("job-name") .userName("user-name") .copies(2) .pageRanges("1-3") .duplex(false) .portrait(false) .color(true) .pageFormat("iso-a4") .resolution("300dpi") // extra PrintJob attributes .attribute("compression", "none") .attribute("job-attributes", "print-quality:enum:3#fit-to-page:boolean:true#sheet-collate:keyword:collated") .build(); ``` -------------------------------- ### Create CupsClient from URI Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsClient.md Initializes a CupsClient using a CUPS server URI. This constructor simplifies connection setup when the server address is provided as a complete URI. ```java public CupsClient(URI cupsURL) ```java CupsClient client = new CupsClient(URI.create("http://127.0.0.1:631")); ``` ``` -------------------------------- ### getMediaDefault() Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Gets the default media size configured for the printer. ```APIDOC ## getMediaDefault() ### Description Gets the default media size. ### Method ```java public String getMediaDefault() ``` ### Returns `String` - Default media type ``` -------------------------------- ### getResolutionSupported() Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Retrieves a list of supported resolution values for the printer. Example values include '300dpi' and '600dpi'. ```APIDOC ## getResolutionSupported() ### Description Gets supported resolution values. ### Returns `List` — Resolution values (e.g., "300dpi", "600dpi") ``` -------------------------------- ### PrintJob Instance: Get Number of Copies Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJob.md Returns the number of copies to be printed for this job. ```java public int getCopies() ``` -------------------------------- ### getName() Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Gets the name of the printer. ```APIDOC ## getName() ### Description Gets the printer name. ### Method ```java public String getName() ``` ### Returns `String` - Printer name (e.g., "printername" from `http://localhost:631/printers/printername`) ``` -------------------------------- ### getState() Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Gets the current operational state of the printer. ```APIDOC ## getState() ### Description Gets the current state of the printer (idle, printing, or stopped). ### Method ```java public PrinterStateEnum getState() ``` ### Returns `PrinterStateEnum` - Printer state ``` -------------------------------- ### PrintJob Instance: Get Document Stream Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJob.md Returns the document content as an InputStream. ```java public InputStream getDocument() ``` -------------------------------- ### Print Document using Lower-Level IPP Operations Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/IppOperation.md An advanced usage example demonstrating how to print a document using the `IppPrintJobOperation`. It shows how to set job attributes and process the result, including extracting the job ID. ```java // Print a document using lower-level operations IppPrintJobOperation printOp = new IppPrintJobOperation(631); Map attributes = new HashMap<>(); attributes.put("requesting-user-name", "john"); attributes.put("job-name", "MyDocument"); attributes.put("job-attributes", "copies:integer:2#sides:keyword:two-sided-long-edge"); try { IppResult result = printOp.request( printer, printer.getPrinterURI(), attributes, credentials ); if (result.getHttpStatusCode() == 200) { AttributeGroup jobGroup = result.getAttributeGroup("job-attributes-tag"); int jobId = Integer.parseInt( jobGroup.getAttribute("job-id").getValue() ); System.out.println("Job created with ID: " + jobId); } } catch (IOException e) { System.out.println("Error: " + e.getMessage()); } ``` -------------------------------- ### Basic CUPS Print Job Submission Source: https://github.com/harwey/cups4j/blob/master/_autodocs/README.md Connect to a CUPS server, find a printer, and submit a print job with specified settings. This example demonstrates the core workflow for printing documents using cups4j. ```java CupsClient client = new CupsClient(); CupsPrinter printer = client.getPrinter("MyPrinter"); byte[] pdfBytes = Files.readAllBytes(Paths.get("document.pdf")); PrintJob job = new PrintJob.Builder(pdfBytes) .jobName("Report") .copies(2) .color(true) .build(); PrintRequestResult result = printer.print(job); if (result.isSuccessfulResult()) { System.out.println("Job submitted: ID=" + result.getJobId()); } else { System.out.println("Error: " + result.getResultMessage()); } ``` -------------------------------- ### PrintJob Instance: Get Page Format Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJob.md Returns the configured page or media format keyword for the print job. ```java public String getPageFormat() ``` -------------------------------- ### PrintJob Instance: Get All Attributes Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJob.md Returns a copy of the map containing all custom attributes configured for the print job. ```java public Map getAttributes() ``` -------------------------------- ### getColorModeSupported() Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Retrieves a list of supported color modes for the printer. Example values include 'color' and 'monochrome'. ```APIDOC ## getColorModeSupported() ### Description Gets supported color modes. ### Returns `List` — Color mode values (e.g., "color", "monochrome") ``` -------------------------------- ### Usage Example for JobStateEnum Source: https://github.com/harwey/cups4j/blob/master/_autodocs/types.md Demonstrates how to retrieve a job's status using JobStateEnum and handle different states within a switch statement. This is useful for monitoring and reacting to job progress. ```java CupsPrinter printer = client.getDefaultPrinter(); JobStateEnum state = printer.getJobStatus(jobId); switch (state) { case COMPLETED: System.out.println("Job finished printing"); break; case PROCESSING: System.out.println("Printer is working..."); break; case PENDING_HELD: System.out.println("Job is on hold"); break; case CANCELED: case ABORTED: System.out.println("Job failed"); break; default: System.out.println("Job state: " + state); } ``` -------------------------------- ### Get a Specific Printer by URL Source: https://github.com/harwey/cups4j/blob/master/README.md Illustrates how to obtain a CupsPrinter object for a printer located at a specific URL. ```java URI printerURL = new URI("http://127.0.0.1:631/printers/printer-name"); CupsPrinter cupsPrinter = cupsClient.getPrinter(printerURL); ``` -------------------------------- ### getMimeTypesSupported() Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Retrieves a list of supported document MIME types for the printer. Example values include 'application/pdf' and 'text/plain'. ```APIDOC ## getMimeTypesSupported() ### Description Gets supported document MIME types. ### Returns `List` — MIME types (e.g., "application/pdf", "text/plain") ``` -------------------------------- ### getSidesSupported() Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Retrieves a list of supported duplex modes (sides) for the printer. Example values include 'one-sided' and 'two-sided-long-edge'. ```APIDOC ## getSidesSupported() ### Description Gets supported duplex modes. ### Returns `List` — Sides values (e.g., "one-sided", "two-sided-long-edge") ``` -------------------------------- ### Create CupsClient with Default Settings Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsClient.md Instantiates a CupsClient to connect to the default CUPS server (localhost:631) using anonymous authentication. Use this for simple setups where the CUPS server is running locally. ```java public CupsClient() ```java CupsClient client = new CupsClient(); ``` ``` -------------------------------- ### PrintJob Instance: Get Resolution Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJob.md Returns the configured print resolution in DPI for the print job. ```java public String getResolution() ``` -------------------------------- ### Get Printer Make and Model Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Retrieves the manufacturer and model of the printer. This information is helpful for identifying the specific hardware. ```java public String getMakeAndModel() ``` -------------------------------- ### Track Submitted Jobs Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintRequestResult.md An example of iterating through a list of print jobs, submitting them, and collecting the job IDs of successfully submitted jobs. ```java List submittedJobs = new ArrayList<>(); for (PrintJob job : jobs) { PrintRequestResult result = printer.print(job); if (result.isSuccessfulResult()) { submittedJobs.add(result.getJobId()); } } System.out.println("Submitted " + submittedJobs.size() + " jobs"); ``` -------------------------------- ### getJobStatus(String userName, int jobID) Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Gets the current state of a specified job for a particular user. ```APIDOC ## getJobStatus(String userName, int jobID) ### Description Gets the current state of a job for a specific user. ### Method ```java public JobStateEnum getJobStatus(String userName, int jobID) ``` ### Parameters #### Path Parameters - **userName** (String) - Yes - User name - **jobID** (int) - Yes - Job ID ### Returns `JobStateEnum` - Current job state ### Throws `IOException` - if I/O errors occur ``` -------------------------------- ### Get Supported MIME Types Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Retrieves a list of supported document MIME types, such as 'application/pdf' or 'text/plain'. Use this to check compatible file formats. ```java public List getMimeTypesSupported() ``` -------------------------------- ### Get Supported Resolutions Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Retrieves a list of supported resolution values for the printer. Use this to check available DPI settings. ```java public List getResolutionSupported() ``` -------------------------------- ### PrintJob Usage: Simple Single-Page Print Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJob.md Example of creating a basic PrintJob with a job name from PDF bytes. ```java byte[] pdfBytes = Files.readAllBytes(Path.of("document.pdf")); PrintJob job = new PrintJob.Builder(pdfBytes) .jobName("SimpleDoc") .build(); ``` -------------------------------- ### Connect to a Custom CUPS Host Source: https://github.com/harwey/cups4j/blob/master/README.md Shows how to instantiate a CupsClient to connect to a CUPS server at a specific URI. ```java CupsClient cupsClient = new CupsClient(URI.create("http://127.0.0.1:631")); ``` -------------------------------- ### Get Default Resolution Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Retrieves the default resolution setting for the printer. This is the resolution used if none is explicitly specified. ```java public String getResolutionDefault() ``` -------------------------------- ### getLocation() Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Gets the physical location of the printer. ```APIDOC ## getLocation() ### Description Gets the printer location. ### Method ```java public String getLocation() ``` ### Returns `String` - Location text ``` -------------------------------- ### Create a Basic PrintJob Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJob.md Instantiate a PrintJob with essential configurations like the document input stream and job name. Use this for simple print tasks. ```java PrintJob printJob = new PrintJob.Builder(inputStream) .jobName("MyDocument") .copies(2) .build(); ``` -------------------------------- ### PrintJob Instance: Get Page Ranges Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJob.md Returns the page range specification for the print job, e.g., '1-3,5'. ```java public String getPageRanges() ``` -------------------------------- ### Get Supported Color Modes Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Retrieves a list of supported color modes, such as 'color' or 'monochrome'. Use this to determine printing capabilities. ```java public List getColorModeSupported() ``` -------------------------------- ### Get Supported Media Sizes Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Retrieves a list of all paper sizes that the printer is configured to support. This is essential for selecting appropriate media for print jobs. ```java public List getMediaSupported() ``` -------------------------------- ### Instantiate JdkIppClient Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/IppClient.md This snippet shows how to create an instance of the default JdkIppClient implementation. This client uses Java's built-in HttpURLConnection. ```java public JdkIppClient() ``` ```java IppClient client = new JdkIppClient(); ``` -------------------------------- ### Handling Job Not Found Errors Source: https://github.com/harwey/cups4j/blob/master/_autodocs/errors.md This example demonstrates how to catch exceptions when trying to retrieve attributes for a non-existent print job. It specifically checks the exception message for 'not found'. ```java try { PrintJobAttributes jobAttrs = client.getJobAttributes(99999); } catch (Exception e) { if (e.getMessage().contains("not found")) { System.out.println("Job does not exist"); } else { System.out.println("Error: " + e.getMessage()); } } ``` -------------------------------- ### Configure Authenticated CUPS Client Source: https://github.com/harwey/cups4j/blob/master/_autodocs/OVERVIEW.md Sets up a `CupsClient` instance for connecting to a CUPS server that requires authentication, by providing username and password credentials. ```java CupsAuthentication auth = new CupsAuthentication("username", "password"); CupsClient client = new CupsClient( "secure-print-server", 631, "requesting_user", auth ); ``` -------------------------------- ### Get Job Name Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJobAttributes.md Retrieves the name of the print job. ```java public String getJobName() ``` -------------------------------- ### Detailed Error Handling Based on Status Codes Source: https://github.com/harwey/cups4j/blob/master/_autodocs/errors.md Implement detailed error handling by inspecting the IPP status code, message, and description. This example differentiates between client errors, server errors, and HTTP server errors. ```java PrintRequestResult result = printer.print(job); if (!result.isSuccessfulResult()) { String code = result.getResultCode(); String message = result.getResultMessage(); String description = result.getResultDescription(); if (code.startsWith("0x04") || code.equals("401")) { System.out.println("Authentication failed"); } else if (code.startsWith("0x0") && !code.equals("0x0000")) { System.out.println("Client error: " + message); } else if (code.startsWith("0x2")) { System.out.println("Server error: " + message); } else if (code.startsWith("5")) { // HTTP 5xx System.out.println("HTTP Server Error: " + description); } } ``` -------------------------------- ### Get Supported Number-Up Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Retrieves a list of supported 'pages-per-sheet' values. Use this to check how many pages can be printed on a single sheet. ```java public List getNumberUpSupported() ``` -------------------------------- ### Get Basic Job Attributes String Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJobAttributes.md Returns a formatted string representation of all job attributes. This is useful for quick inspection of job details. ```java public String toString() ``` -------------------------------- ### Get User Name Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJobAttributes.md Retrieves the user who submitted the print job. ```java public String getUserName() ``` -------------------------------- ### Create CupsClient with Authentication Credentials Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsClient.md Constructs a CupsClient using host, port, user name, and explicit authentication credentials. This is the most secure way to connect when authentication is required. ```java public CupsClient(String host, int port, String userName, CupsAuthentication creds) ```java CupsAuthentication auth = new CupsAuthentication("user", "password"); CupsClient client = new CupsClient("server.example.com", 631, "john", auth); ``` ``` -------------------------------- ### Get Password from CupsAuthentication Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsAuthentication.md Retrieve the password stored within a CupsAuthentication object. ```java public String getPassword() ``` ```java String pwd = auth.getPassword(); ``` -------------------------------- ### PrintJob Usage: Multi-copy Color Print Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJob.md Example of creating a PrintJob with multiple copies, color enabled, and a custom page format from an InputStream. ```java PrintJob job = new PrintJob.Builder(new FileInputStream("report.pdf")) .jobName("ColorReport") .userName("admin") .copies(5) .color(true) .pageFormat("iso-a3") .duplex(true) .build(); ``` -------------------------------- ### Get Job Complete Time Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJobAttributes.md Retrieves the timestamp when the job was completed, if it has finished. ```java public Date getJobCompleteTime() ``` -------------------------------- ### Create CupsClient with Host, Port, and User Name Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsClient.md Initializes a CupsClient with a specific host, port, and user name for print requests. This allows for authenticated access to CUPS servers requiring user identification. ```java public CupsClient(String host, int port, String userName) ```java CupsClient client = new CupsClient("127.0.0.1", 631, "john"); ``` ``` -------------------------------- ### Create Multiple Authenticated CUPS Clients Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsAuthentication.md Demonstrates creating separate CupsClient instances with different authentication credentials for distinct user roles. ```java CupsAuthentication adminAuth = new CupsAuthentication("admin", "admin_pass"); CupsAuthentication userAuth = new CupsAuthentication("user", "user_pass"); CupsClient adminClient = new CupsClient("server", 631, "admin", adminAuth); CupsClient userClient = new CupsClient("server", 631, "john", userAuth); ``` -------------------------------- ### Get Job Create Time Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJobAttributes.md Retrieves the timestamp when the job was created or submitted. ```java public Date getJobCreateTime() ``` -------------------------------- ### Create CupsClient Instance Source: https://github.com/harwey/cups4j/blob/master/_autodocs/OVERVIEW.md Instantiate CupsClient to connect to a local or remote CUPS server. Authentication can be provided for secure connections. ```java // Local CUPS server CupsClient client = new CupsClient(); // Remote server CupsClient client = new CupsClient("print-server.example.com", 631); // With authentication CupsAuthentication auth = new CupsAuthentication("user", "password"); CupsClient client = new CupsClient("server", 631, "username", auth); ``` -------------------------------- ### getJobStatus(int jobID) Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Gets the current state of a specified job using its ID. ```APIDOC ## getJobStatus(int jobID) ### Description Gets the current state of a job. ### Method ```java public JobStateEnum getJobStatus(int jobID) ``` ### Parameters #### Path Parameters - **jobID** (int) - Yes - Job ID ### Returns `JobStateEnum` - Current job state (PENDING, PROCESSING, COMPLETED, etc.) ### Throws `Exception` - if network or CUPS errors occur ``` -------------------------------- ### Instantiate JdkIppRequest Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/IppRequest.md Create a new JdkIppRequest instance, specifying the target URI, HTTP method (typically POST), and optional authentication credentials. ```java CupsAuthentication auth = new CupsAuthentication("user", "pass"); IppRequest request = new JdkIppRequest( printerUri, "POST", auth ); ``` -------------------------------- ### Create CupsClient from URI with User and Credentials Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsClient.md Constructs a CupsClient from a URI, specifying the user name and optional authentication credentials. This provides flexibility for connecting to CUPS servers via URI with authentication. ```java public CupsClient(URI cupsURL, String userName, CupsAuthentication creds) ```java CupsAuthentication auth = new CupsAuthentication("user", "password"); CupsClient client = new CupsClient(URI.create("http://server.example.com:631"), "john", auth); ``` ``` -------------------------------- ### Complete IppRequest Usage Pattern Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/IppRequest.md This pattern shows the typical workflow for creating an IppRequest, setting headers and body, and then executing it using an IppClient. ```java // Create request IppRequest request = new JdkIppRequest(printerUri, "POST", credentials); // Set standard IPP headers request.setHeader("Content-Type", "application/ipp"); request.setHeader("Host", printerUri.getHost() + ":" + printerUri.getPort()); // Build IPP operation bytes ByteBuffer ippBuffer = buildIppOperation(...); // Set request body InputStream bodyStream = new ByteArrayInputStream( ippBuffer.array(), 0, ippBuffer.position() ); request.setEntity(bodyStream, "application/ipp"); // Execute IppClient client = new JdkIppClient(); IppResult result = client.execute(request, responseHandler); ``` -------------------------------- ### Get User ID from CupsAuthentication Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsAuthentication.md Retrieve the user ID stored within a CupsAuthentication object. ```java public String getUserid() ``` ```java String userId = auth.getUserid(); ``` -------------------------------- ### Get Printer Hash Code Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Returns a hash code value for the printer, based on its URI. ```java public int hashCode() ``` -------------------------------- ### setMakeAndModel(String makeAndModel) Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Sets the make and model information for the printer. ```APIDOC ## setMakeAndModel(String makeAndModel) ### Description Sets the make-and-model attribute. ### Method `public void setMakeAndModel(String makeAndModel)` ``` -------------------------------- ### Get Printer Name Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Retrieves the name of the printer. This is typically the identifier used in the CUPS URI. ```java public String getName() ``` -------------------------------- ### Builder Methods Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJob.md Methods for configuring a PrintJob before it is built. ```APIDOC ## pageFormat(String pageFormat) ### Description Sets the page/media format for the print job. ### Method Builder method ### Parameters #### Path Parameters - **pageFormat** (String) - Required - Media format keyword (e.g., "iso-a4", "na-letter") ### Request Example ```java .pageFormat("iso-a4") ``` ``` ```APIDOC ## resolution(String resolution) ### Description Sets the print resolution for the print job. ### Method Builder method ### Parameters #### Path Parameters - **resolution** (String) - Required - Resolution specification (e.g., "300dpi", "600dpi") ### Request Example ```java .resolution("300dpi") ``` ``` ```APIDOC ## attributes(Map attributes) ### Description Sets additional IPP operation and job attributes for the print job. ### Method Builder method ### Parameters #### Path Parameters - **attributes** (Map) - Required - Attribute map. Format: Multiple attributes separated by `#` (e.g., "print-quality:enum:3#sheet-collate:keyword:collated") ### Request Example ```java Map attrs = new HashMap<>(); attrs.put("compression", "none"); attrs.put("job-attributes", "print-quality:enum:3"); .attributes(attrs) ``` ``` ```APIDOC ## attribute(String key, String value) ### Description Adds a single IPP attribute to the print job. ### Method Builder method ### Parameters #### Path Parameters - **key** (String) - Required - Attribute name - **value** (String) - Required - Attribute value ### Request Example ```java .attribute("compression", "none") .attribute("job-attributes", "print-quality:enum:3") ``` ``` ```APIDOC ## build() ### Description Constructs and returns the final PrintJob object with all configured settings. ### Method Builder method ### Returns `PrintJob` - Immutable print job object ``` -------------------------------- ### CupsClient Constructors Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsClient.md Provides various constructors to initialize the CupsClient with different connection parameters, including host, port, user name, and authentication credentials. ```APIDOC ## CupsClient() ### Description Creates a CupsClient connecting to the default CUPS server on localhost port 631 with anonymous user. ### Example ```java CupsClient client = new CupsClient(); ``` ``` ```APIDOC ## CupsClient(String host, int port) ### Description Creates a CupsClient for the specified host and port with anonymous user. ### Parameters #### Path Parameters - **host** (String) - Required - CUPS server hostname - **port** (int) - Required - CUPS server port number ### Throws - `IllegalArgumentException` if host is null or empty, or port is negative ### Example ```java CupsClient client = new CupsClient("192.168.1.100", 631); ``` ``` ```APIDOC ## CupsClient(String host, int port, String userName) ### Description Creates a CupsClient with specified host, port, and user name. ### Parameters #### Path Parameters - **host** (String) - Required - CUPS server hostname - **port** (int) - Required - CUPS server port number - **userName** (String) - Required - User name for print requests ### Example ```java CupsClient client = new CupsClient("127.0.0.1", 631, "john"); ``` ``` ```APIDOC ## CupsClient(String host, int port, String userName, CupsAuthentication creds) ### Description Creates a CupsClient with authentication credentials. ### Parameters #### Path Parameters - **host** (String) - Required - CUPS server hostname - **port** (int) - Required - CUPS server port number - **userName** (String) - Required - User name for print requests - **creds** (CupsAuthentication) - Optional - Authentication credentials ### Example ```java CupsAuthentication auth = new CupsAuthentication("user", "password"); CupsClient client = new CupsClient("server.example.com", 631, "john", auth); ``` ``` ```APIDOC ## CupsClient(URI cupsURL) ### Description Creates a CupsClient from a URI with anonymous user. ### Parameters #### Path Parameters - **cupsURL** (URI) - Required - CUPS server URI (e.g., `http://localhost:631`) ### Example ```java CupsClient client = new CupsClient(URI.create("http://127.0.0.1:631")); ``` ``` ```APIDOC ## CupsClient(URI cupsURL, String userName, CupsAuthentication creds) ### Description Creates a CupsClient from a URI with user name and optional credentials. ### Parameters #### Path Parameters - **cupsURL** (URI) - Required - CUPS server URI - **userName** (String) - Required - User name for print requests - **creds** (CupsAuthentication) - Optional - Authentication credentials ### Example ```java CupsClient client = new CupsClient(URI.create("http://127.0.0.1:631"), "john", auth); ``` ``` -------------------------------- ### Get Filtered Print Jobs Source: https://github.com/harwey/cups4j/blob/master/_autodocs/types.md Demonstrates how to retrieve print jobs using the WhichJobsEnum for filtering. ```java CupsClient client = new CupsClient(); CupsPrinter printer = client.getPrinter("MyPrinter"); // Get only completed jobs List completed = printer.getJobs( WhichJobsEnum.COMPLETED, "john", true ); // Get only active jobs for user List active = printer.getJobs( WhichJobsEnum.NOT_COMPLETED, "john", true ); // Get all jobs on printer List allJobs = printer.getJobs( WhichJobsEnum.ALL, "john", false // include jobs from all users ); ``` -------------------------------- ### Handle Different Error Types Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintRequestResult.md Demonstrates how to handle specific error codes, such as authentication or not found errors, and provides a fallback for other general errors. ```java PrintRequestResult result = printer.print(job); String code = result.getResultCode(); if (code.equals("0x0000")) { // Success int jobId = result.getJobId(); } else if (code.equals("0x0401") || code.equals("401")) { // Authentication error System.out.println("Authentication failed"); } else if (code.equals("0x0404") || code.equals("404")) { // Printer not found System.out.println("Printer unavailable"); } else { // Other error System.out.println("Error: " + result.getResultMessage()); } ``` -------------------------------- ### Submit a Simple Single Print Job Source: https://github.com/harwey/cups4j/blob/master/_autodocs/OVERVIEW.md Connect to a CUPS server, find a printer, create a print job with basic options, and submit it. Checks the result for success or failure. ```java // Connect CupsClient client = new CupsClient(); // Find printer CupsPrinter printer = client.getPrinter("MyPrinter"); // Create job byte[] pdfData = Files.readAllBytes(Paths.get("document.pdf")); PrintJob job = new PrintJob.Builder(pdfData) .jobName("My Document") .copies(1) .build(); // Submit PrintRequestResult result = printer.print(job); if (result.isSuccessfulResult()) { System.out.println("Job ID: " + result.getJobId()); } else { System.out.println("Error: " + result.getResultMessage()); } ``` -------------------------------- ### Handle Network Exceptions Source: https://github.com/harwey/cups4j/blob/master/_autodocs/OVERVIEW.md Demonstrates how to catch specific exceptions, such as `ConnectException`, when interacting with the CUPS server, providing user-friendly error messages. ```java try { List printers = client.getPrinters(); } catch (java.net.ConnectException e) { System.out.println("Cannot connect to CUPS server"); } catch (Exception e) { System.out.println("Error: " + e.getMessage()); } ``` -------------------------------- ### Get Deprecated Printer URL Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJobAttributes.md Returns the printer URL. Use `getPrinterURI()` instead. This method is deprecated. ```java @Deprecated public URL getPrinterURL() ``` -------------------------------- ### PrintJob Builder: Build PrintJob Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJob.md Constructs and returns the final PrintJob object with all configured settings. ```java public PrintJob build() ``` -------------------------------- ### Get Deprecated Job URL Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJobAttributes.md Returns the job URL. Use `getJobURI()` instead. This method is deprecated. ```java @Deprecated public URL getJobURL() ``` -------------------------------- ### Print with IPP Extensions Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJob.md This snippet demonstrates how to configure a print job using IPP (Internet Printing Protocol) extensions for advanced settings like fit-to-page and print scaling. ```java PrintJob job = new PrintJob.Builder(bytes) .jobName("AdvancedJob") .attribute("job-attributes", "fit-to-page:boolean:true#" + "print-scaling:keyword:fit#" + "media-col:collection:media-source-properties:keyword:auto") .build(); ``` -------------------------------- ### Check Printer State Source: https://github.com/harwey/cups4j/blob/master/_autodocs/types.md Get the current state of a CUPS printer and print a message based on its status. ```java CupsPrinter printer = client.getPrinter("MyPrinter"); PrinterStateEnum state = printer.getState(); if (state == PrinterStateEnum.IDLE) { System.out.println("Printer is ready"); } else if (state == PrinterStateEnum.PRINTING) { System.out.println("Printer is busy"); } else if (state == PrinterStateEnum.STOPPED) { System.out.println("Printer is offline or has an error"); } ``` -------------------------------- ### Create CupsClient with Host and Port Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsClient.md Creates a CupsClient instance for a specified CUPS server host and port. This is useful when the CUPS server is not running on the default localhost or port. Ensure the host and port are valid. ```java public CupsClient(String host, int port) ```java CupsClient client = new CupsClient("192.168.1.100", 631); ``` ``` -------------------------------- ### Connect to CUPS Server Using URI and Credentials Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsAuthentication.md Connect to a CUPS server using a URI and CupsAuthentication object, specifying a client user ID. ```java CupsAuthentication creds = new CupsAuthentication("operator", "secret123"); CupsClient client = new CupsClient( URI.create("http://print-server.local:631"), "alice", creds ); ``` -------------------------------- ### Check Job Progress Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJobAttributes.md Demonstrates how to retrieve and display basic progress information for a print job using CupsClient and PrintJobAttributes. Ensure CupsClient is initialized. ```java CupsClient client = new CupsClient(); PrintJobAttributes jobAttrs = client.getJobAttributes(jobId); System.out.println("Job: " + jobAttrs.getJobName()); System.out.println("State: " + jobAttrs.getJobState()); System.out.println("Pages printed: " + jobAttrs.getPagesPrinted()); System.out.println("Size: " + jobAttrs.getSize() + " KB"); ``` -------------------------------- ### Create PrintJob with Options Source: https://github.com/harwey/cups4j/blob/master/_autodocs/OVERVIEW.md Build a PrintJob using the Builder pattern, specifying various printing options like job name, copies, color, duplex, page format, resolution, and custom attributes. ```java PrintJob job = new PrintJob.Builder(documentBytes) .jobName("Report") .userName("john") .copies(2) .color(true) .pageFormat("iso-a4") .duplex(true) .build(); ``` -------------------------------- ### Get Default Color Mode Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Retrieves the default color mode for the printer. This indicates the standard color setting. ```java public String getColorModeDefault() ``` -------------------------------- ### Create CupsPrinter with Authentication Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Instantiate a CupsPrinter object with authentication credentials, suitable for secure HTTPS/IPPS connections. Provide valid user credentials and the printer's secure URI. ```java CupsAuthentication auth = new CupsAuthentication("user", "pass"); URI uri = URI.create("ipps://secure.example.com:631/printers/SecurePrinter"); CupsPrinter printer = new CupsPrinter(auth, uri, "SecurePrinter"); ``` -------------------------------- ### JdkIppRequest Constructor Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/IppRequest.md Default implementation using Java's built-in HttpURLConnection. ```APIDOC ## JdkIppRequest(URI uri, String method, CupsAuthentication credentials) ### Description Constructor for the default implementation of IppRequest using Java's built-in HttpURLConnection. ### Method Signature `public JdkIppRequest(URI uri, String method, CupsAuthentication credentials)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters Table | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | uri | URI | Yes | — | Target URI for the request | | method | String | Yes | — | HTTP method (typically "POST") | | credentials | CupsAuthentication | No | null | Authentication credentials | ### Example ```java CupsAuthentication auth = new CupsAuthentication("user", "pass"); IppRequest request = new JdkIppRequest( printerUri, "POST", auth ); ``` ``` -------------------------------- ### Create CupsAuthentication Object Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsAuthentication.md Instantiate CupsAuthentication with a user ID and password for CUPS server authentication. ```java public CupsAuthentication(String userid, String password) ``` ```java CupsAuthentication auth = new CupsAuthentication("print_user", "secure_password"); ``` -------------------------------- ### CupsPrinter Constructor (With Auth) Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Creates a CupsPrinter object with optional authentication credentials, supporting HTTPS/IPPS connections. Requires printer URI and name, and optionally accepts CupsAuthentication. ```APIDOC ## CupsPrinter(CupsAuthentication creds, URI printerURL, String printerName) ### Description Creates a CupsPrinter with optional authentication credentials. This constructor supports HTTPS/IPPS connections. ### Parameters #### Path Parameters - **creds** (CupsAuthentication) - Optional - Authentication credentials - **printerURL** (URI) - Required - Printer URI (e.g., `ipps://localhost/printers/NECP6`) - **printerName** (String) - Required - Printer name ### Request Example ```java CupsAuthentication auth = new CupsAuthentication("user", "pass"); URI uri = URI.create("ipps://secure.example.com:631/printers/SecurePrinter"); CupsPrinter printer = new CupsPrinter(auth, uri, "SecurePrinter"); ``` ``` -------------------------------- ### Get Pages Printed Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJobAttributes.md Retrieves the number of pages printed so far. This value is typically updated during job processing. ```java public int getPagesPrinted() ``` -------------------------------- ### PrintJob Instance Methods Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJob.md Methods for retrieving properties of a configured PrintJob object. ```APIDOC ## getDocument() ### Description Returns the document content stream. ### Method Instance method ### Returns `InputStream` - Document data ``` ```APIDOC ## getJobName() ### Description Returns the job name. ### Method Instance method ### Returns `String` - Job name ``` ```APIDOC ## getUserName() ### Description Returns the user name. ### Method Instance method ### Returns `String` - User name ``` ```APIDOC ## getCopies() ### Description Returns the number of copies. ### Method Instance method ### Returns `int` - Number of copies ``` ```APIDOC ## getPageRanges() ### Description Returns the page range specification. ### Method Instance method ### Returns `String` - Page ranges (e.g., "1-3,5") ``` ```APIDOC ## getPageFormat() ### Description Returns the page format. ### Method Instance method ### Returns `String` - Format keyword (e.g., "iso-a4") ``` ```APIDOC ## getResolution() ### Description Returns the resolution. ### Method Instance method ### Returns `String` - Resolution (e.g., "300dpi") ``` ```APIDOC ## isColor() ### Description Returns whether color printing is enabled. ### Method Instance method ### Returns `boolean` - `true` if color mode ``` ```APIDOC ## isDuplex() ### Description Returns whether duplex printing is enabled. ### Method Instance method ### Returns `boolean` - `true` if duplex mode ``` ```APIDOC ## isPortrait() ### Description Returns the page orientation. ### Method Instance method ### Returns `boolean` - `true` if portrait, `false` if landscape ``` ```APIDOC ## getAttributes() ### Description Returns all custom attributes. ### Method Instance method ### Returns `Map` - Copy of the attributes map ``` ```APIDOC ## setAttributes(Map printJobAttributes) ### Description Replaces all custom attributes. ### Method Instance method ### Parameters #### Path Parameters - **printJobAttributes** (Map) - Required - New attributes map ### Request Example ```java Map newAttrs = new HashMap<>(); newAttrs.put("orientation", "portrait"); printJob.setAttributes(newAttrs); ``` ``` ```APIDOC ## toString() ### Description Returns a string representation of the PrintJob. ### Method Instance method ### Returns `String` - Format: "PrintJob-{jobName}" ``` -------------------------------- ### Get Printer URI Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJobAttributes.md Retrieves the URI of the printer processing this job. This method is available since version 0.8.2. ```java public URI getPrinterURI() ``` -------------------------------- ### Get Job URI Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJobAttributes.md Retrieves the URI of the job on the IPP server. This method is available since version 0.8.2. ```java public URI getJobURI() ``` -------------------------------- ### Find Suitable Printer Source: https://github.com/harwey/cups4j/blob/master/_autodocs/OVERVIEW.md This snippet demonstrates how to find a suitable printer for a print job by iterating through available printers and checking their state, color capabilities, and supported MIME types. It assumes a CupsClient instance has been initialized. ```java CupsClient client = new CupsClient(); List printers = client.getPrinters(); CupsPrinter suitable = null; for (CupsPrinter printer : printers) { if (printer.getState() != PrinterStateEnum.STOPPED && printer.getColorModeSupported().contains("color") && printer.getMimeTypesSupported().contains("application/pdf")) { suitable = printer; break; } } if (suitable != null) { // Use this printer } ``` -------------------------------- ### Get Printer by URI Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsClient.md Retrieves a specific printer object using its URI. Ensure the URI is correctly formatted. ```Java public CupsPrinter getPrinter(URI printerURL) throws Exception ``` ```Java URI printerURI = URI.create("http://localhost:631/printers/MyPrinter"); CupsPrinter printer = client.getPrinter(printerURI); ``` -------------------------------- ### Check for Successful Print Request Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintRequestResult.md Determines if the print request was successful by checking if the result code starts with '0x00'. ```java public boolean isSuccessfulResult() ``` ```java if (result.isSuccessfulResult()) { System.out.println("Print job submitted successfully"); } else { System.out.println("Error: " + result.getResultDescription()); } ``` -------------------------------- ### PrintJob Builder Constructor with byte[] Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJob.md Initialize the PrintJob builder using document content provided as a byte array. This is useful when the document is already loaded into memory. ```java public Builder(byte[] document) ``` ```java byte[] pdf = Files.readAllBytes(Path.of("file.pdf")); PrintJob.Builder builder = new PrintJob.Builder(pdf); ``` -------------------------------- ### IppSendDocumentOperation Constructor Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/IppOperation.md Constructs an IppSendDocumentOperation. Used for sending documents to an existing job, with an option to mark it as the last document. ```java public IppSendDocumentOperation(int port, int jobId, boolean lastDocument) ``` -------------------------------- ### Get Default Number-Up Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Retrieves the default 'pages-per-sheet' value. This is the standard setting for printing multiple pages on one sheet. ```java public String getNumberUpDefault() ``` -------------------------------- ### Get Default Sides (Duplex Mode) Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Retrieves the default duplex mode for the printer. This is the standard setting for double-sided printing. ```java public String getSidesDefault() ``` -------------------------------- ### toString(CupsClient client) Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJobAttributes.md Returns a formatted string with additional details fetched from the server, including creation and completion times. ```APIDOC ## toString(CupsClient client) ### Description Returns a formatted string with additional details fetched from the server (creation and completion times). ### Method ```java public String toString(CupsClient client) ``` ### Parameters #### Path Parameters - **client** (CupsClient) - Optional - Client to query for additional details ### Returns `String` - Extended multi-line string with timestamps ### Note May be slower due to additional server queries ``` -------------------------------- ### PrintJob Builder Constructor with InputStream Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJob.md Initialize the PrintJob builder using an InputStream for the document content. This is efficient for large documents or when reading from a stream. ```java public Builder(InputStream document) ``` ```java InputStream stream = new FileInputStream("file.pdf"); PrintJob.Builder builder = new PrintJob.Builder(stream); ``` -------------------------------- ### Get Printer Location Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsPrinter.md Retrieves the physical or logical location of the printer. This is useful for identifying printers in different areas or departments. ```java public String getLocation() ``` -------------------------------- ### Create a Comprehensive PrintJob Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJob.md Configure a PrintJob with a wide range of attributes including job name, user, copies, color, duplex, page format, resolution, page ranges, orientation, and custom IPP attributes. Suitable for complex printing requirements. ```java InputStream doc = new FileInputStream("document.pdf"); PrintJob printJob = new PrintJob.Builder(doc) .jobName("Annual Report") .userName("john.doe") .copies(2) .color(true) .duplex(true) .pageFormat("iso-a4") .resolution("600dpi") .pageRanges("1-10, 15-20") .portrait(true) .attribute("compression", "none") .attribute("print-quality", "enum:3") .build(); ``` -------------------------------- ### Get Job State Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/PrintJobAttributes.md Retrieves the current state of the print job. Use this to check if a job is completed, pending, or processing. ```java JobStateEnum state = jobAttrs.getJobState(); if (state == JobStateEnum.COMPLETED) { System.out.println("Job finished"); } ``` -------------------------------- ### Execute IPP Request with Custom Response Handling Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/IppResponseHandler.md Demonstrates executing an IPP request using an IppClient and providing a custom IppResponseHandler to process the binary IPP response. This handler parses the response body into an IppResponse object and populates an IppResult. ```java IppClient client = new JdkIppClient(); IppRequest request = new JdkIppRequest(uri, "POST", credentials); request.setEntity(ippBodyStream, "application/ipp"); IppResult result = client.execute(request, (statusCode, reasonPhrase, body) -> { // Parse binary IPP response IppResponse ippResp = IppResponse.parse(body); IppResult result = new IppResult(); result.setHttpStatusCode(statusCode); result.setHttpStatusResponse("HTTP/1.0 " + statusCode + " " + reasonPhrase); result.setAttributeGroupList(ippResp.getAttributeGroups()); return result; }); ``` -------------------------------- ### Get Job Attributes by ID Source: https://github.com/harwey/cups4j/blob/master/_autodocs/api-reference/CupsClient.md Retrieves the attributes for a specific print job using its ID. This method is for the default user. ```Java public PrintJobAttributes getJobAttributes(int jobID) throws Exception ``` ```Java PrintJobAttributes jobAttrs = client.getJobAttributes(42); System.out.println("Job state: " + jobAttrs.getJobState()); ``` -------------------------------- ### Attribute Format Syntax Source: https://github.com/harwey/cups4j/blob/master/_autodocs/types.md Illustrates the syntax for specifying custom IPP attributes in print job requests. ```java print-quality:enum:3 // High quality compression:keyword:none // No compression media:keyword:iso-a4 // A4 media sides:keyword:two-sided-long-edge // Duplex orientation-requested:enum:3 // Portrait ``` ```java print-quality:enum:3#fit-to-page:boolean:true#sheet-collate:keyword:collated ``` -------------------------------- ### CupsClient Source: https://github.com/harwey/cups4j/blob/master/_autodocs/DOCUMENTATION_SUMMARY.txt The main entry point for interacting with a CUPS server. It provides methods for printer discovery and job management. ```APIDOC ## CupsClient ### Description Provides the primary interface for interacting with a CUPS server. This class allows for discovering printers, managing print jobs, and executing various CUPS operations. ### Class `CupsClient` ### Methods - **Constructors**: 8 constructor methods available for initializing the client. - **Public Methods**: 12 public methods for printer discovery and job management. - **Static Utility Methods**: Includes static utility methods for common tasks. ```