Skip to content
Cups4j Java printing library for CUPS/IPP
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
src exception handling improved if create-job failed Dec 13, 2018
.gitignore updated .gitignore Sep 12, 2018
.project removed classpath entries in manifest. Jan 27, 2018
LICENSE Create LICENSE Jun 20, 2017 Updated readme, .classpath Apr 7, 2019
pom.xml Started new Release 0.7.7-SNAPSHOT Jan 29, 2019


Cups4j — the Java printing library for CUPS.

Table of Contents


This library is available on the Maven Central repository, here.
To import and use cups4j in your project, add the following dependency in your pom.xml file:



Basic usage

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);

Connect to custom host

CupsClient cupsClient = new CupsClient("", 631);

Get specific printer by URL

URL printerURL = new URL("");
CupsPrinter cupsPrinter = cupsClient.getPrinter(printerURL);

Add extra PrintJob attributes

Map<String, String> attributes = new HashMap<>();
attributes.put("compression", "none");
attributes.put("job-attributes", "print-quality:enum:3#fit-to-page:boolean:true#sheet-collate:keyword:collated");

PrintJob printJob = new PrintJob.Builder(bytes)



You can’t perform that action at this time.