Skip to content

Commit 798d6b9

Browse files
committed
Add CUPS printing system bindings to c.s.j.p.unix
Closes #1710 Add Cups interface providing JNA bindings for libcups, the Common UNIX Printing System library. Includes structures (CupsDest, CupsOption, CupsJob), printer state/type constants, job state constants, and functions for destination enumeration, job management, option handling, and server/user configuration.
1 parent 27a0f4b commit 798d6b9

4 files changed

Lines changed: 737 additions & 0 deletions

File tree

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Features
99
--------
1010
* [#1696](https://github.com/java-native-access/jna/pull/1696): Add `LARGE_INTEGER.ByValue` to `LARGE_INTEGER` in `WinNT.java` - [@baier233](https://github.com/baier233).
1111
* [#1697](https://github.com/java-native-access/jna/pull/1697): Add WlanApi module - [@eranl](https://github.com/eranl).
12+
* [#1718](https://github.com/java-native-access/jna/pull/1718): Add `Cups` to `c.s.j.p.unix` providing CUPS printing system bindings for destinations, jobs, options, and server configuration - [@dbwiddis](https://github.com/dbwiddis).
1213

1314
Bug Fixes
1415
---------

PR_DESCRIPTION.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## Add CUPS printing system bindings
2+
3+
Closes #1710
4+
5+
Adds `Cups` interface to `c.s.j.p.unix` providing JNA bindings for [libcups](https://openprinting.github.io/cups/doc/cupspm.html), the Common UNIX Printing System library available on Linux, macOS, and other UNIX platforms.
6+
7+
### Structures
8+
9+
| Structure | C type | Description |
10+
|-----------|--------|-------------|
11+
| `CupsDest` | `cups_dest_t` | Printer/class destination with name, instance, and options |
12+
| `CupsOption` | `cups_option_t` | Name/value option pair |
13+
| `CupsJob` | `cups_job_t` | Print job with ID, state, title, user, and timestamps |
14+
15+
### Functions
16+
17+
| Function | Description |
18+
|----------|-------------|
19+
| `cupsGetDests` / `cupsGetDests2` | Enumerate available printers |
20+
| `cupsFreeDests` | Free destination list |
21+
| `cupsGetDest` | Find a printer in a list by name |
22+
| `cupsGetNamedDest` | Optimized single-printer lookup |
23+
| `cupsGetDefault` | Get default printer name |
24+
| `cupsGetOption` | Read an option value |
25+
| `cupsAddOption` | Add/replace an option |
26+
| `cupsFreeOptions` | Free options array |
27+
| `cupsGetJobs2` | Get print jobs (active/completed/all) |
28+
| `cupsFreeJobs` | Free job array |
29+
| `cupsCancelJob` | Cancel a print job |
30+
| `cupsServer` / `cupsSetServer` | Get/set CUPS server |
31+
| `cupsUser` / `cupsSetUser` | Get/set CUPS user |
32+
| `cupsLastError` / `cupsLastErrorString` | Error reporting |
33+
34+
### Constants
35+
36+
- Printer state: `IPP_PRINTER_IDLE`, `IPP_PRINTER_PROCESSING`, `IPP_PRINTER_STOPPED`
37+
- Printer type flags: `CUPS_PRINTER_CLASS`, `CUPS_PRINTER_COLOR`, `CUPS_PRINTER_DUPLEX`, etc.
38+
- Job state: `IPP_JSTATE_PENDING` through `IPP_JSTATE_COMPLETED`
39+
- Job filters: `CUPS_WHICHJOBS_ALL`, `CUPS_WHICHJOBS_ACTIVE`, `CUPS_WHICHJOBS_COMPLETED`
40+
41+
### Testing
42+
43+
`CupsTest` exercises all functions, gracefully handling environments without CUPS installed or without a running scheduler.

0 commit comments

Comments
 (0)