---
name: "pappl-printer"
section: "3"
platform: "linux"
package: "pappl"
version: "1.4.12-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/pappl-printer"
---

# pappl-printer(3)

pappl printer functions

## NAME

pappl-printer - pappl printer functions

## LIBRARY

Printer Application Framework (libpappl, "pkg-config --cflags --libs pappl")

## SYNOPSIS

**#include \<pappl/pappl.h\>**

*typedef struct \_pappl\_printer\_s* **pappl\_printer\_t;**

*void*\
 **papplPrinterCancelAllJobs***(pappl\_printer\_t \*printer);*

*void*\
 **papplPrinterCloseDevice***(pappl\_printer\_t \*printer);*

*pappl\_printer\_t \**\
 **papplPrinterCreate***(pappl\_system\_t \*system, int printer\_id, const char \*printer\_name, const char \*driver\_name, const char \*device\_id, const char \*device\_uri);*

*void*\
 **papplPrinterDelete***(pappl\_printer\_t \*printer);*

*pappl\_job\_t \**\
 **papplPrinterFindJob***(pappl\_printer\_t \*printer, int job\_id);*

*pappl\_contact\_t \**\
 **papplPrinterGetContact***(pappl\_printer\_t \*printer, pappl\_contact\_t \*contact);*

*const char \**\
 **papplPrinterGetDeviceID***(pappl\_printer\_t \*printer);*

*const char \**\
 **papplPrinterGetDeviceURI***(pappl\_printer\_t \*printer);*

*char \**\
 **papplPrinterGetDNSSDName***(pappl\_printer\_t \*printer, char \*buffer, size\_t bufsize);*

*ipp\_t \**\
 **papplPrinterGetDriverAttributes***(pappl\_printer\_t \*printer);*

*pappl\_driver\_data\_t \**\
 **papplPrinterGetDriverData***(pappl\_printer\_t \*printer, pappl\_driver\_data\_t \*data);*

*const char \**\
 **papplPrinterGetDriverName***(pappl\_printer\_t \*printer);*

*char \**\
 **papplPrinterGetGeoLocation***(pappl\_printer\_t \*printer, char \*buffer, size\_t bufsize);*

*int*\
 **papplPrinterGetID***(pappl\_printer\_t \*printer);*

*int*\
 **papplPrinterGetImpressionsCompleted***(pappl\_printer\_t \*printer);*

*char \**\
 **papplPrinterGetLocation***(pappl\_printer\_t \*printer, char \*buffer, size\_t bufsize);*

*int*\
 **papplPrinterGetMaxActiveJobs***(pappl\_printer\_t \*printer);*

*int*\
 **papplPrinterGetMaxCompletedJobs***(pappl\_printer\_t \*printer);*

*const char \**\
 **papplPrinterGetName***(pappl\_printer\_t \*printer);*

*int*\
 **papplPrinterGetNextJobID***(pappl\_printer\_t \*printer);*

*int*\
 **papplPrinterGetNumberOfActiveJobs***(pappl\_printer\_t \*printer);*

*int*\
 **papplPrinterGetNumberOfCompletedJobs***(pappl\_printer\_t \*printer);*

*int*\
 **papplPrinterGetNumberOfJobs***(pappl\_printer\_t \*printer);*

*char \**\
 **papplPrinterGetOrganization***(pappl\_printer\_t \*printer, char \*buffer, size\_t bufsize);*

*char \**\
 **papplPrinterGetOrganizationalUnit***(pappl\_printer\_t \*printer, char \*buffer, size\_t bufsize);*

*char \**\
 **papplPrinterGetPrintGroup***(pappl\_printer\_t \*printer, char \*buffer, size\_t bufsize);*

*pappl\_preason\_t*\
 **papplPrinterGetReasons***(pappl\_printer\_t \*printer);*

*ipp\_pstate\_t*\
 **papplPrinterGetState***(pappl\_printer\_t \*printer);*

*int*\
 **papplPrinterGetSupplies***(pappl\_printer\_t \*printer, int max\_supplies, pappl\_supply\_t \*supplies);*

*pappl\_system\_t \**\
 **papplPrinterGetSystem***(pappl\_printer\_t \*printer);*

*void*\
 **papplPrinterIterateActiveJobs***(pappl\_printer\_t \*printer, pappl\_job\_cb\_t cb, void \*data, int first\_index, int limit);*

*void*\
 **papplPrinterIterateAllJobs***(pappl\_printer\_t \*printer, pappl\_job\_cb\_t cb, void \*data, int first\_index, int limit);*

*void*\
 **papplPrinterIterateCompletedJobs***(pappl\_printer\_t \*printer, pappl\_job\_cb\_t cb, void \*data, int first\_index, int limit);*

*pappl\_device\_t \**\
 **papplPrinterOpenDevice***(pappl\_printer\_t \*printer);*

*void*\
 **papplPrinterPause***(pappl\_printer\_t \*printer);*

*void*\
 **papplPrinterResume***(pappl\_printer\_t \*printer);*

*void*\
 **papplPrinterSetContact***(pappl\_printer\_t \*printer, pappl\_contact\_t \*contact);*

*void*\
 **papplPrinterSetDNSSDName***(pappl\_printer\_t \*printer, const char \*value);*

*void*\
 **papplPrinterSetDriverData***(pappl\_printer\_t \*printer, pappl\_driver\_data\_t \*data, ipp\_t \*attrs);*

*void*\
 **papplPrinterSetDriverDefaults***(pappl\_printer\_t \*printer, pappl\_driver\_data\_t \*data);*

*void*\
 **papplPrinterSetGeoLocation***(pappl\_printer\_t \*printer, const char \*value);*

*void*\
 **papplPrinterSetImpressionsCompleted***(pappl\_printer\_t \*printer, int add);*

*void*\
 **papplPrinterSetLocation***(pappl\_printer\_t \*printer, const char \*value);*

*void*\
 **papplPrinterSetMaxActiveJobs***(pappl\_printer\_t \*printer, int max\_active\_jobs);*

*void*\
 **papplPrinterSetMaxCompletedJobs***(pappl\_printer\_t \*printer, int max\_completed\_jobs);*

*void*\
 **papplPrinterSetNextJobID***(pappl\_printer\_t \*printer, int next\_job\_id);*

*void*\
 **papplPrinterSetOrganization***(pappl\_printer\_t \*printer, const char \*value);*

*void*\
 **papplPrinterSetOrganizationalUnit***(pappl\_printer\_t \*printer, const char \*value);*

*void*\
 **papplPrinterSetPrintGroup***(pappl\_printer\_t \*printer, const char \*value);*

*void*\
 **papplPrinterSetReadyMedia***(pappl\_printer\_t \*printer, int num\_ready, pappl\_media\_col\_t \*ready);*

*void*\
 **papplPrinterSetReasons***(pappl\_printer\_t \*printer, pappl\_preason\_t add, pappl\_preason\_t remove);*

*void*\
 **papplPrinterSetSupplies***(pappl\_printer\_t \*printer, int num\_supplies, pappl\_supply\_t \*supplies);*

*void*\
 **papplPrinterSetUSB***(pappl\_printer\_t \*printer, unsigned vendor\_id, unsigned product\_id, pappl\_uoptions\_t options);*

## DESCRIPTION

The **PAPPL** printer functions provide access to the printer object. Printers are created and deleted by the printer application while the life cycle of the **pappl\_printer\_t** objects are managed automatically by the system object for the printer application.

The **papplPrinterCreate** function creates a new printer while the **papplPrinterDelete** function deletes a printer.

The **papplPrinterPause** function stops a printer while the **papplPrinterResume** function starts a printer.

The **papplPrinterGet** functions get the current values associated with a printer while the **papplPrinterSet** functions set the current values associated with a printer.

The **papplPrinterCancelAddJobs, papplPrinterFindJob,** **papplPrinterGetNumberOfActiveJobs, papplPrinterGetNumberOfCompletedJobs,** **papplPrinterGetNumberOfJobs, papplPrinterIterateActiveJobs,** **papplPrinterIterateAllJobs,** and **papplPrinterIterateCompletedJobs** functions provide access to the jobs queued on a printer.

The **papplPrinterOpenDevice** function provides access to the device associated with a printer when it is not processing a job. The device must be later closed using the **papplPrinterCloseDevice** function so that the printer can resume job processing.

## ENUMERATIONS

### pappl\_color\_mode\_e

IPP "print-color-mode" bit values

- PAPPL\_COLOR\_MODE\_AUTO

  ´auto' - Automatic color/monochrome print mode

- PAPPL\_COLOR\_MODE\_AUTO\_MONOCHROME

  ´auto-monochrome' - Automatic monochrome/process monochrome print mode

- PAPPL\_COLOR\_MODE\_BI\_LEVEL

  ´bi-level' - B&W (threshold) print mode

- PAPPL\_COLOR\_MODE\_COLOR

  ´color' - Full color print mode

- PAPPL\_COLOR\_MODE\_MONOCHROME

  ´monochrome' - Grayscale print mode using 1 color

- PAPPL\_COLOR\_MODE\_PROCESS\_MONOCHROME

  ´process-monochrome' - Grayscale print mode using multiple colors

### pappl\_content\_e

IPP "print-content-optimize" bit values

- PAPPL\_CONTENT\_AUTO

  ´auto': Automatically determine content

- PAPPL\_CONTENT\_GRAPHIC

  ´graphic': Optimize for vector graphics

- PAPPL\_CONTENT\_PHOTO

  ´photo': Optimize for photos/continuous tone images

- PAPPL\_CONTENT\_TEXT

  ´text': Optimize for text

- PAPPL\_CONTENT\_TEXT\_AND\_GRAPHIC

  ´text-and-graphic': Optimize for text and vector graphics

### pappl\_duplex\_e

Duplex printing support

- PAPPL\_DUPLEX\_FLIPPED

  Duplex with flipped back sides

- PAPPL\_DUPLEX\_MANUAL\_TUMBLE

  Duplex with back side rotated 180 degrees for short-edge duplex

- PAPPL\_DUPLEX\_NONE

  No duplex printing support

- PAPPL\_DUPLEX\_NORMAL

  Duplex with normal back sides

- PAPPL\_DUPLEX\_ROTATED

  Duplex with back side rotated 180 degrees for long-edge duplex

### pappl\_finishings\_e

IPP "finishings" bit values

- PAPPL\_FINISHINGS\_NONE

  ´none'

- PAPPL\_FINISHINGS\_PUNCH

  ´punch'

- PAPPL\_FINISHINGS\_STAPLE

  ´staple'

- PAPPL\_FINISHINGS\_TRIM

  ´trim'

### pappl\_identify\_actions\_e

IPP "identify-actions" bit values

- PAPPL\_IDENTIFY\_ACTIONS\_DISPLAY

  ´display': Display a message

- PAPPL\_IDENTIFY\_ACTIONS\_FLASH

  ´flash': Flash the display or a light

- PAPPL\_IDENTIFY\_ACTIONS\_NONE

  No actions

- PAPPL\_IDENTIFY\_ACTIONS\_SOUND

  ´sound': Make a sound

- PAPPL\_IDENTIFY\_ACTIONS\_SPEAK

  ´speak': Speak a message

### pappl\_kind\_e

IPP "printer-kind" bit values

- PAPPL\_KIND\_DISC

  ´disc'

- PAPPL\_KIND\_DOCUMENT

  ´document'

- PAPPL\_KIND\_ENVELOPE

  ´envelope'

- PAPPL\_KIND\_LABEL

  ´label'

- PAPPL\_KIND\_LARGE\_FORMAT

  ´large-format'

- PAPPL\_KIND\_PHOTO

  ´photo'

- PAPPL\_KIND\_POSTCARD

  ´postcard'

- PAPPL\_KIND\_RECEIPT

  ´receipt'

- PAPPL\_KIND\_ROLL

  ´roll'

### pappl\_label\_mode\_e

IPP "label-mode-xxx" bit values

- PAPPL\_LABEL\_MODE\_APPLICATOR

  ´applicator'

- PAPPL\_LABEL\_MODE\_CUTTER

  ´cutter'

- PAPPL\_LABEL\_MODE\_CUTTER\_DELAYED

  ´cutter-delayed'

- PAPPL\_LABEL\_MODE\_KIOSK

  ´kiosk'

- PAPPL\_LABEL\_MODE\_PEEL\_OFF

  ´peel-off'

- PAPPL\_LABEL\_MODE\_PEEL\_OFF\_PREPEEL

  ´peel-off-prepeel'

- PAPPL\_LABEL\_MODE\_REWIND

  ´rewind'

- PAPPL\_LABEL\_MODE\_RFID

  ´rfid'

- PAPPL\_LABEL\_MODE\_TEAR\_OFF

  ´tear-off'

### pappl\_media\_tracking\_e

IPP "media-tracking" bit values

- PAPPL\_MEDIA\_TRACKING\_CONTINUOUS

  ´continuous'

- PAPPL\_MEDIA\_TRACKING\_GAP

  ´gap'

- PAPPL\_MEDIA\_TRACKING\_MARK

  ´mark'

- PAPPL\_MEDIA\_TRACKING\_WEB

  ´web'

### pappl\_preason\_e

IPP "printer-state-reasons" bit values

- PAPPL\_PREASON\_COVER\_OPEN

  ´cover-open'

- PAPPL\_PREASON\_DEVICE\_STATUS

  Supported *papplDeviceGetStatus* bits

- PAPPL\_PREASON\_DOOR\_OPEN

  ´door-open'

- PAPPL\_PREASON\_IDENTIFY\_PRINTER\_REQUESTED

  ´identify-printer-requested'

- PAPPL\_PREASON\_INPUT\_TRAY\_MISSING

  ´input-tray-missing'

- PAPPL\_PREASON\_MARKER\_SUPPLY\_EMPTY

  ´marker-supply-empty'

- PAPPL\_PREASON\_MARKER\_SUPPLY\_LOW

  ´marker-supply-low'

- PAPPL\_PREASON\_MARKER\_WASTE\_ALMOST\_FULL

  ´marker-waste-almost-full'

- PAPPL\_PREASON\_MARKER\_WASTE\_FULL

  ´marker-waste-full'

- PAPPL\_PREASON\_MEDIA\_EMPTY

  ´media-empty'

- PAPPL\_PREASON\_MEDIA\_JAM

  ´media-jam'

- PAPPL\_PREASON\_MEDIA\_LOW

  ´media-low'

- PAPPL\_PREASON\_MEDIA\_NEEDED

  ´media-needed'

- PAPPL\_PREASON\_NONE

  ´none'

- PAPPL\_PREASON\_OFFLINE

  ´offline'

- PAPPL\_PREASON\_OTHER

  ´other'

- PAPPL\_PREASON\_SPOOL\_AREA\_FULL

  ´spool-area-full'

- PAPPL\_PREASON\_TONER\_EMPTY

  ´toner-empty'

- PAPPL\_PREASON\_TONER\_LOW

  ´toner-low'

### pappl\_raster\_type\_e

IPP "pwg-raster-document-type-supported" bit values

- PAPPL\_PWG\_RASTER\_TYPE\_ADOBE\_RGB\_16

  16-bit per component AdobeRGB

- PAPPL\_PWG\_RASTER\_TYPE\_ADOBE\_RGB\_8

  8-bit per component AdobeRGB

- PAPPL\_PWG\_RASTER\_TYPE\_BLACK\_1

  1-bit (device) black

- PAPPL\_PWG\_RASTER\_TYPE\_BLACK\_16

  16-bit (device) black

- PAPPL\_PWG\_RASTER\_TYPE\_BLACK\_8

  8-bit (device) black

- PAPPL\_PWG\_RASTER\_TYPE\_CMYK\_16

  16-bit per component (device) CMYK

- PAPPL\_PWG\_RASTER\_TYPE\_CMYK\_8

  8-bit per component (device) CMYK

- PAPPL\_PWG\_RASTER\_TYPE\_NONE

  Do not force a particular raster type

- PAPPL\_PWG\_RASTER\_TYPE\_RGB\_16

  16-bit per component (device) RGB

- PAPPL\_PWG\_RASTER\_TYPE\_RGB\_8

  8-bit per component (device) RGB

- PAPPL\_PWG\_RASTER\_TYPE\_SGRAY\_16

  16-bit grayscale with 2.2 gamma

- PAPPL\_PWG\_RASTER\_TYPE\_SGRAY\_8

  8-bit grayscale with 2.2 gamma

- PAPPL\_PWG\_RASTER\_TYPE\_SRGB\_16

  16-bit per component sRGB

- PAPPL\_PWG\_RASTER\_TYPE\_SRGB\_8

  8-bit per component sRGB

### pappl\_scaling\_e

IPP "print-scaling" bit values

- PAPPL\_SCALING\_AUTO

  ´auto': Scale to fit (non-borderless) or fill (borderless) if larger, otherwise center

- PAPPL\_SCALING\_AUTO\_FIT

  ´auto-fit': Scale to fit if larger, otherwise center

- PAPPL\_SCALING\_FILL

  ´fill': Scale to fill the media

- PAPPL\_SCALING\_FIT

  ´fit': Scale to fit within margins

- PAPPL\_SCALING\_NONE

  ´none': No scaling (center/crop)

### pappl\_sides\_e

IPP "sides" bit values

- PAPPL\_SIDES\_ONE\_SIDED

  ´one-sided'

- PAPPL\_SIDES\_TWO\_SIDED\_LONG\_EDGE

  ´two-sided-long-edge'

- PAPPL\_SIDES\_TWO\_SIDED\_SHORT\_EDGE

  ´two-sided-short-edge'

### pappl\_uoptions\_e

USB gadget options

- PAPPL\_UOPTIONS\_ETHERNET

  Include USB ethernet gadget

- PAPPL\_UOPTIONS\_NONE

  No options (just USB printer)

- PAPPL\_UOPTIONS\_SERIAL

  Include USB serial gadget

- PAPPL\_UOPTIONS\_STORAGE

  Include USB mass storage gadget

- PAPPL\_UOPTIONS\_STORAGE\_READONLY

  USB mass storage gadget is read-only

- PAPPL\_UOPTIONS\_STORAGE\_REMOVABLE

  USB mass storage gadget is removable

## FUNCTIONS

### papplPrinterCancelAllJobs

Cancel all jobs on the printer.

```
void papplPrinterCancelAllJobs (
    pappl_printer_t *printer
);
```

This function cancels all jobs on the printer.  If any job is currently being printed, it will be stopped at a convenient time (usually the end of a page) so that the printer will be left in a known state.

### papplPrinterCloseDevice

Close the device associated with the printer.

```
void papplPrinterCloseDevice (
    pappl_printer_t *printer
);
```

This function closes the device for a printer.  The device must have been previously opened using the *papplPrinterOpenDevice* function.

### papplPrinterCreate

Create a new printer.

```
pappl_printer_t * papplPrinterCreate (
    pappl_system_t *system,
    int printer_id,
    const char *printer_name,
    const char *driver_name,
    const char *device_id,
    const char *device_uri
);
```

This function creates a new printer (service) on the specified system.  The "type" argument specifies the type of service to create and must currently be the value **PAPPL\_SERVICE\_TYPE\_PRINT**.

The "printer\_id" argument specifies a positive integer identifier that is unique to the system.  If you specify a value of **0** a new identifier will be assigned.

The "driver\_name" argument specifies a named driver for the printer, from the list of drivers registered with the *papplSystemSetPrinterDrivers* function.

The "device\_id" and "device\_uri" arguments specify the IEEE-1284 device ID and device URI strings for the printer.

On error, this function sets the **errno** variable to one of the following values:

- •

  **EEXIST**: A printer with the specified name already exists.

- •

  **EINVAL**: Bad values for the arguments were specified.

- •

  **EIO**: The driver callback failed.

- •

  **ENOENT**: No driver callback has been set.

- •

  **ENOMEM**: Ran out of memory.\</li\> \</ul\>

### papplPrinterDelete

Delete a printer.

```
void papplPrinterDelete (
    pappl_printer_t *printer
);
```

This function deletes a printer from a system, freeing all memory and canceling all jobs as needed.

### papplPrinterDisable

Stop accepting jobs on a printer.

```
void papplPrinterDisable (
    pappl_printer_t *printer
);
```

This function stops accepting jobs on a printer.

### papplPrinterEnable

Start accepting jobs on a printer.

```
void papplPrinterEnable (
    pappl_printer_t *printer
);
```

This function starts accepting jobs on a printer.

### papplPrinterGetContact

Get the "printer-contact" value.

```
pappl_contact_t * papplPrinterGetContact (
    pappl_printer_t *printer,
    pappl_contact_t *contact
);
```

This function copies the current printer contact information to the buffer pointed to by the "contact" argument.

### papplPrinterGetDNSSDName

Get the current DNS-SD service name.

```
char * papplPrinterGetDNSSDName (
    pappl_printer_t *printer,
    char *buffer,
    size_t bufsize
);
```

This function copies the current DNS-SD service name to the buffer pointed to by the "buffer" argument.

### papplPrinterGetDeviceID

Get the IEEE-1284 device ID of the printer.

```
const char * papplPrinterGetDeviceID (
    pappl_printer_t *printer
);
```

This function returns the IEEE-1284 device ID of the printer.

### papplPrinterGetDeviceURI

Get the URI of the device associated with the\
                                printer.

```
const char * papplPrinterGetDeviceURI (
    pappl_printer_t *printer
);
```

This function returns the device URI for the printer.

### papplPrinterGetDriverAttributes

Get a copy of the current driver\
                                       attributes.

```
ipp_t * papplPrinterGetDriverAttributes (
    pappl_printer_t *printer
);
```

This function returns a copy the current driver attributes. Use the **ippDelete** function to free the memory used for the attributes when you are done.

### papplPrinterGetDriverData

Get the current print driver data.

```
pappl_pr_driver_data_t * papplPrinterGetDriverData (
    pappl_printer_t *printer,
    pappl_pr_driver_data_t *data
);
```

This function copies the current print driver data, defaults, and ready (loaded) media information into the specified buffer.

### papplPrinterGetDriverName

Get the driver name for a printer.

```
const char * papplPrinterGetDriverName (
    pappl_printer_t *printer
);
```

This function returns the driver name for the printer.

### papplPrinterGetGeoLocation

Get the current geo-location as a "geo:"\
                                  URI.

```
char * papplPrinterGetGeoLocation (
    pappl_printer_t *printer,
    char *buffer,
    size_t bufsize
);
```

This function copies the currently configured geographic location as a "geo:" URI to the buffer pointed to by the "buffer" argument.

### papplPrinterGetID

Get the printer ID.

```
int  papplPrinterGetID (
    pappl_printer_t *printer
);
```

This function returns the printer's unique positive integer identifier.

### papplPrinterGetImpressionsCompleted

Get the number of impressions\
                                           (sides) that have been printed.

```
int  papplPrinterGetImpressionsCompleted (
    pappl_printer_t *printer
);
```

This function returns the number of impressions that have been printed.  An impression is one side of an output page.

### papplPrinterGetLocation

Get the location string.

```
char * papplPrinterGetLocation (
    pappl_printer_t *printer,
    char *buffer,
    size_t bufsize
);
```

This function copies the printer's human-readable location to the buffer pointed to by the "buffer" argument.

### papplPrinterGetMaxActiveJobs

Get the maximum number of active (queued)\
                                    jobs allowed by the printer.

```
int  papplPrinterGetMaxActiveJobs (
    pappl_printer_t *printer
);
```

This function returns the maximum number of active jobs that the printer supports, as configured by the *papplPrinterSetMaxActiveJobs* function.

### papplPrinterGetMaxCompletedJobs

Get the maximum number of jobs retained\
                                       for history by the printer.

```
int  papplPrinterGetMaxCompletedJobs (
    pappl_printer_t *printer
);
```

This function returns the maximum number of jobs that are retained in the job history as configured by the *papplPrinterSetMaxCompletedJobs* function.

### papplPrinterGetMaxPreservedJobs

Get the maximum number of jobs\
                                       preserved by the printer.

```
int  papplPrinterGetMaxPreservedJobs (
    pappl_printer_t *printer
);
```

This function returns the maximum number of jobs that are retained (including document data) in the job history as configured by the *papplPrinterSetMaxPreservedJobs* function.

### papplPrinterGetName

Get the printer name.

```
const char * papplPrinterGetName (
    pappl_printer_t *printer
);
```

This function returns the printer's human-readable name.

### papplPrinterGetNextJobID

Get the next job ID.

```
int  papplPrinterGetNextJobID (
    pappl_printer_t *printer
);
```

This function returns the positive integer identifier that will be used for the next job that is created.

### papplPrinterGetNumberOfActiveJobs

Get the number of active print jobs.

```
int  papplPrinterGetNumberOfActiveJobs (
    pappl_printer_t *printer
);
```

This function returns the number of print jobs that are either printing or waiting to be printed.

### papplPrinterGetNumberOfCompletedJobs

Get the number of completed print\
                                            jobs.

```
int  papplPrinterGetNumberOfCompletedJobs (
    pappl_printer_t *printer
);
```

This function returns the number of print jobs that have been aborted, canceled, or completed.

### papplPrinterGetNumberOfJobs

Get the total number of print jobs.

```
int  papplPrinterGetNumberOfJobs (
    pappl_printer_t *printer
);
```

This function returns the number of print jobs that are printing, waiting to be printed, have been aborted, have been canceled, or have completed.

### papplPrinterGetOrganization

Get the organization name.

```
char * papplPrinterGetOrganization (
    pappl_printer_t *printer,
    char *buffer,
    size_t bufsize
);
```

This function copies the printer's organization name to the buffer pointed to by the "buffer" argument.

### papplPrinterGetOrganizationalUnit

Get the organizational unit name.

```
char * papplPrinterGetOrganizationalUnit (
    pappl_printer_t *printer,
    char *buffer,
    size_t bufsize
);
```

This function copies the printer's organizational unit name to the buffer pointed to by the "buffer" argument.

### papplPrinterGetPath

Get the URL path for a printer web page.

```
char * papplPrinterGetPath (
    pappl_printer_t *printer,
    const char *subpath,
    char *buffer,
    size_t bufsize
);
```

This function generates and returns the URL path for the printer's web page. The "subpath" argument specifies an optional sub-path for a specific printer web page.

### papplPrinterGetPrintGroup

Get the print authorization group, if any.

```
char * papplPrinterGetPrintGroup (
    pappl_printer_t *printer,
    char *buffer,
    size_t bufsize
);
```

This function copies the printer's authorization group name to the buffer pointed to by the "buffer" argument.

### papplPrinterGetReasons

Get the current "printer-state-reasons" bit values.

```
pappl_preason_t  papplPrinterGetReasons (
    pappl_printer_t *printer
);
```

This function returns the current printer state reasons bitfield, which can be updated by the printer driver and/or by the *papplPrinterSetReasons* function.

### papplPrinterGetState

Get the current "printer-state" value.

```
ipp_pstate_t  papplPrinterGetState (
    pappl_printer_t *printer
);
```

This function returns the current printer state as an enumeration:

- •

  **IPP\_PSTATE\_IDLE**: The printer is idle and has no jobs to process.

- •

  **IPP\_PSTATE\_PROCESSING**: The printer is processing a job and/or producing\
     output.

- •

  **IPP\_PSTATE\_STOPPED**: The printer is stopped for maintenance.\</li\> \</ul\>

### papplPrinterGetSupplies

Get the current "printer-supplies" values.

```
int  papplPrinterGetSupplies (
    pappl_printer_t *printer,
    int max_supplies,
    pappl_supply_t *supplies
);
```

This function copies the current printer supply values to the specified array.  The "max\_supplies" and "supplies" arguments can be **0** and **NULL** to query the number of supplies used.

The return value is the actual number of supplies used by the printer, regardless of the size of the array.

### papplPrinterGetSystem

Get the system associated with the printer.

```
pappl_system_t * papplPrinterGetSystem (
    pappl_printer_t *printer
);
```

This function returns a pointer to the system object that contains the printer.

### papplPrinterHoldNewJobs

Hold new jobs for printing.

```
bool  papplPrinterHoldNewJobs (
    pappl_printer_t *printer
);
```

This function holds any new jobs for printing and is typically used prior to performing printer maintenance.  Existing jobs will finish printing but new jobs will be held until you call *papplPrinterReleaseHeldNewJobs*.

### papplPrinterIsAcceptingJobs

Return whether the printer is accepting jobs.

```
bool  papplPrinterIsAcceptingJobs (
    pappl_printer_t *printer
);
```

This function returns a boolean value indicating whether a printer is accepting jobs.

### papplPrinterIsDeleted

Return whether a printer is in the process of being deleted.

```
bool  papplPrinterIsDeleted (
    pappl_printer_t *printer
);
```

This function returns a boolean value indicating whether a printer is being deleted.

### papplPrinterIsHoldingNewJobs

Return whether the printer is holding new jobs.

```
bool  papplPrinterIsHoldingNewJobs (
    pappl_printer_t *printer
);
```

This function returns a boolean value indicating whether a printer is holding new jobs.

### papplPrinterIterateActiveJobs

Iterate over the active jobs.

```
void papplPrinterIterateActiveJobs (
    pappl_printer_t *printer,
    pappl_job_cb_t cb,
    void *data,
    int job_index,
    int limit
);
```

This function iterates over jobs that are either printing or waiting to be printed.  The specified callback "cb" will be called once per job with the data pointer "data".

The "job\_index" argument specifies the first job in the list to iterate, where **1** is the first job, etc.  The "limit" argument specifies the maximum number of jobs to iterate - use **0** to iterate an unlimited number of jobs.

### papplPrinterIterateAllJobs

Iterate over all the jobs.

```
void papplPrinterIterateAllJobs (
    pappl_printer_t *printer,
    pappl_job_cb_t cb,
    void *data,
    int job_index,
    int limit
);
```

This function iterates over all jobs.  The specified callback "cb" will be called once per job with the data pointer "data".

The "job\_index" argument specifies the first job in the list to iterate, where **1** is the first job, etc.  The "limit" argument specifies the maximum number of jobs to iterate - use **0** to iterate an unlimited number of jobs.

### papplPrinterIterateCompletedJobs

Iterate over the completed jobs.

```
void papplPrinterIterateCompletedJobs (
    pappl_printer_t *printer,
    pappl_job_cb_t cb,
    void *data,
    int job_index,
    int limit
);
```

This function iterates over jobs that are aborted, canceled, or completed. The specified callback "cb" will be called once per job with the data pointer "data".

The "job\_index" argument specifies the first job in the list to iterate, where **1** is the first job, etc.  The "limit" argument specifies the maximum number of jobs to iterate - use **0** to iterate an unlimited number of jobs.

### papplPrinterOpenDevice

Open the device associated with a printer.

```
pappl_device_t * papplPrinterOpenDevice (
    pappl_printer_t *printer
);
```

This function opens the printer's device.  **NULL** is returned if the device is already in use, for example while a job is being printed.

The returned device must be closed using the *papplPrinterCloseDevice* function.

### papplPrinterOpenFile

Create or open a file for a printer.

```
int  papplPrinterOpenFile (
    pappl_printer_t *printer,
    char *fname,
    size_t fnamesize,
    const char *directory,
    const char *resname,
    const char *ext,
    const char *mode
);
```

This function creates, opens, or removes a file for a printer.  The "fname" and "fnamesize" arguments specify the location and size of a buffer to store the printer filename, which incorporates the "directory", printer ID, resource name, and "ext" values.  The resource name is "sanitized" to only contain alphanumeric characters.

The "mode" argument is "r" to read an existing printer file, "w" to write a new printer file, or "x" to remove an existing printer file.  New files are created with restricted permissions for security purposes.

For the "r" and "w" modes, the return value is the file descriptor number on success or **-1** on error.  For the "x" mode, the return value is **0** on success and **-1** on error.  The **errno** variable is set appropriately on error.

### papplPrinterPause

Pause (stop) a printer.

```
void papplPrinterPause (
    pappl_printer_t *printer
);
```

This function pauses a printer.  If the printer is currently processing (printing) a job, it will be completed before the printer is stopped.

### papplPrinterReleaseHeldNewJobs

Release any previously held jobs for printing.

```
bool  papplPrinterReleaseHeldNewJobs (
    pappl_printer_t *printer,
    const char *username
);
```

This function releases all jobs that were previously held due to a prior call to *papplPrinterHoldNewJobs*.

### papplPrinterResume

Resume (start) a printer.

```
void papplPrinterResume (
    pappl_printer_t *printer
);
```

This function resumes a printer and starts processing any pending jobs.

### papplPrinterSetContact

Set the "printer-contact" value.

```
void papplPrinterSetContact (
    pappl_printer_t *printer,
    pappl_contact_t *contact
);
```

This function sets the printer's contact information.

### papplPrinterSetDNSSDName

Set the DNS-SD service name.

```
void papplPrinterSetDNSSDName (
    pappl_printer_t *printer,
    const char *value
);
```

This function sets the printer's DNS-SD service name.  If **NULL**, the printer will stop advertising the printer.

### papplPrinterSetDriverData

Set the driver data.

```
bool  papplPrinterSetDriverData (
    pappl_printer_t *printer,
    pappl_pr_driver_data_t *data,
    ipp_t *attrs
);
```

This function validates and sets the driver data, including all defaults and ready (loaded) media.

- 5

  Note: This function regenerates all of the driver-specific capability

- 5

  attributes like "media-col-database", "sides-supported", and so forth.

- 5

  Use the *papplPrinterSetDriverDefaults* or

- 5

  *papplPrinterSetReadyMedia* functions to efficiently change the

- 5

  "xxx-default" or "xxx-ready" values, respectively.

### papplPrinterSetDriverDefaults

Set the default print option values.

```
bool  papplPrinterSetDriverDefaults (
    pappl_printer_t *printer,
    pappl_pr_driver_data_t *data,
    int num_vendor,
    cups_option_t *vendor
);
```

This function validates and sets the printer's default print options.

- 5

  Note: Unlike *papplPrinterSetPrintDriverData*, this function only

- 5

  changes the "xxx\_default" members of the driver data and is considered

- 5

  lightweight.

### papplPrinterSetGeoLocation

Set the geo-location value as a "geo:" URI.

```
void papplPrinterSetGeoLocation (
    pappl_printer_t *printer,
    const char *value
);
```

This function sets the printer's geographic location as a "geo:" URI.  If **NULL**, the location is cleared to the 'unknown' value.

### papplPrinterSetImpressionsCompleted

Add impressions (sides) to the\
                                           total count of printed impressions.

```
void papplPrinterSetImpressionsCompleted (
    pappl_printer_t *printer,
    int add
);
```

This function adds to the printer's impressions counter.  An impression is one side of an output page.

### papplPrinterSetLocation

Set the location string.

```
void papplPrinterSetLocation (
    pappl_printer_t *printer,
    const char *value
);
```

This function sets the printer's human-readable location string.  If **NULL**, the location is cleared.

### papplPrinterSetMaxActiveJobs

Set the maximum number of active jobs for\
                                    the printer.

```
void papplPrinterSetMaxActiveJobs (
    pappl_printer_t *printer,
    int max_active_jobs
);
```

This function sets the maximum number of jobs that can be spooled on the printer at one time.

- 5

  Note: This limit does not apply to streaming raster formats such as PWG

- 5

  Raster since they are not spooled.

### papplPrinterSetMaxCompletedJobs

Set the maximum number of completed\
                                       jobs for the printer.

```
void papplPrinterSetMaxCompletedJobs (
    pappl_printer_t *printer,
    int max_completed_jobs
);
```

This function sets the maximum number of aborted, canceled, or completed jobs that are retained in the job history.

### papplPrinterSetMaxPreservedJobs

Set the maximum number of preserved\
                                       jobs for the printer.

```
void papplPrinterSetMaxPreservedJobs (
    pappl_printer_t *printer,
    int max_preserved_jobs
);
```

This function sets the maximum number of aborted, canceled, or completed jobs that are preserved (with document data) in the job history.

### papplPrinterSetNextJobID

Set the next "job-id" value.

```
void papplPrinterSetNextJobID (
    pappl_printer_t *printer,
    int next_job_id
);
```

This function sets the next unique positive integer identifier that will be used for a job.

- 5

  Note: This function is normally only called once to restore the previous

- 5

  state of the printer.

### papplPrinterSetOrganization

Set the organization name.

```
void papplPrinterSetOrganization (
    pappl_printer_t *printer,
    const char *value
);
```

This function sets the printer's organization name.  If **NULL** the value is cleared.

### papplPrinterSetOrganizationalUnit

Set the organizational unit name.

```
void papplPrinterSetOrganizationalUnit (
    pappl_printer_t *printer,
    const char *value
);
```

This function sets the printer's organizational unit name.  If **NULL** the value is cleared.

### papplPrinterSetPrintGroup

Set the print authorization group, if any.

```
void papplPrinterSetPrintGroup (
    pappl_printer_t *printer,
    const char *value
);
```

This function sets the printer's authorization group.  If **NULL**, the group is cleared.

- 5

  Note: The authorization group is only used if the system is created with a

- 5

  named authorization service.

### papplPrinterSetReadyMedia

Set the ready (loaded) media.

```
bool  papplPrinterSetReadyMedia (
    pappl_printer_t *printer,
    int num_ready,
    pappl_media_col_t *ready
);
```

This function validates and sets the printer's ready (loaded) media.

### papplPrinterSetReasons

Add or remove values from\
                              "printer-state-reasons".

```
void papplPrinterSetReasons (
    pappl_printer_t *printer,
    pappl_preason_t add,
    pappl_preason_t remove
);
```

This function updates the printer state reasons bitfield by clearing any bit values in the "remove" argument and setting any bit values in the "add" argument.

### papplPrinterSetSupplies

Set/update the supplies for a printer.

```
void papplPrinterSetSupplies (
    pappl_printer_t *printer,
    int num_supplies,
    pappl_supply_t *supplies
);
```

This function updates the supply information for the printer.

### papplPrinterSetUSB

Set the USB vendor and product IDs for a printer.

```
void papplPrinterSetUSB (
    pappl_printer_t *printer,
    unsigned vendor_id,
    unsigned product_id,
    pappl_uoptions_t options,
    const char *storagefile,
    pappl_pr_usb_cb_t usb_cb,
    void *usb_cbdata
);
```

This function sets the USB vendor and product IDs for a printer as well as specifying USB gadget options when the printer is registered with the USB device controller.

The **usb\_cb** argument specifies a processing callback that is called for every byte of data sent from the USB host and which is responsible for interpreting the data, writing data to the device, and handling back-channel data.

- 5

  Note: USB gadget functionality is currently only available when running

- 5

  on Linux with compatible hardware such as the Raspberry Pi Zero and 4B.

## STRUCTURES

### pappl\_icon\_s

Printer PNG icon structure

```
struct pappl_icon_s
{
  const void *data;
  size_t datalen;
  char filename[256];
};
```

### pappl\_media\_col\_s

Media details structure

```
struct pappl_media_col_s
{
  int bottom_margin;
  int left_margin;
  int left_offset;
  int right_margin;
  int size_length;
  char size_name[64];
  int size_width;
  char source[64];
  int top_margin;
  int top_offset;
  pappl_media_tracking_t tracking;
  char type[64];
};
```

### pappl\_pr\_driver\_data\_s

Printer driver data

```
struct pappl_pr_driver_data_s
{
  const char *bin[PAPPL_MAX_BIN];
  int bin_default;
  bool borderless;
  int bottom_top;
  pappl_color_mode_t color_default;
  pappl_color_mode_t color_supported;
  pappl_content_t content_default;
  int darkness_configured;
  int darkness_default;
  int darkness_supported;
  pappl_pr_delete_cb_t delete_cb;
  pappl_duplex_t duplex;
  void *extension;
  const char *features[PAPPL_MAX_VENDOR];
  pappl_finishings_t finishings;
  pappl_raster_type_t force_raster_type;
  const char *format;
  pappl_dither_t gdither;
  bool has_supplies;
  pappl_icon_t icons[3];
  pappl_pr_identify_cb_t identify_cb;
  pappl_identify_actions_t identify_default;
  pappl_identify_actions_t identify_supported;
  bool input_face_up;
  pappl_kind_t kind;
  int left_offset_supported[2];
  int left_right;
  char make_and_model[128];
  const char *media[PAPPL_MAX_MEDIA];
  pappl_media_col_t media_default;
  pappl_media_col_t media_ready[PAPPL_MAX_SOURCE];
  pappl_label_mode_t mode_configured;
  pappl_label_mode_t mode_supported;
  int num_bin;
  int num_features;
  int num_media;
  int num_resolution;
  int num_source;
  int num_type;
  int num_vendor;
  ipp_orient_t orient_default;
  bool output_face_up;
  pappl_dither_t pdither;
  int ppm;
  int ppm_color;
  pappl_pr_printfile_cb_t printfile_cb;
  ipp_quality_t quality_default;
  pappl_raster_type_t raster_types;
  pappl_pr_rendjob_cb_t rendjob_cb;
  pappl_pr_rendpage_cb_t rendpage_cb;
  pappl_pr_rstartjob_cb_t rstartjob_cb;
  pappl_pr_rstartpage_cb_t rstartpage_cb;
  pappl_pr_rwriteline_cb_t rwriteline_cb;
  pappl_scaling_t scaling_default;
  pappl_sides_t sides_default;
  pappl_sides_t sides_supported;
  const char *source[PAPPL_MAX_SOURCE];
  int speed_default;
  int speed_supported[2];
  pappl_pr_status_cb_t status_cb;
  int tear_offset_configured;
  int tear_offset_supported[2];
  pappl_pr_testpage_cb_t testpage_cb;
  int top_offset_supported[2];
  pappl_media_tracking_t tracking_supported;
  const char *type[PAPPL_MAX_TYPE];
  const char *vendor[PAPPL_MAX_VENDOR];
  int x_default;
  int x_resolution[PAPPL_MAX_RESOLUTION];
  int y_default;
  int y_resolution[PAPPL_MAX_RESOLUTION];
};
```

### pappl\_pr\_options\_s

Combined print job options

```
struct pappl_pr_options_s
{
  int copies;
  int darkness_configured;
  pappl_dither_t dither;
  pappl_finishings_t finishings;
  unsigned first_page;
  cups_page_header_t header;
  unsigned last_page;
  pappl_media_col_t media;
  unsigned num_pages;
  int num_vendor;
  ipp_orient_t orientation_requested;
  char output_bin[64];
  pappl_color_mode_t print_color_mode;
  pappl_content_t print_content_optimize;
  int print_darkness;
  ipp_quality_t print_quality;
  pappl_scaling_t print_scaling;
  int print_speed;
  int printer_resolution[2];
  pappl_sides_t sides;
  cups_option_t *vendor;
};
```

## TYPES

### pappl\_color\_mode\_t

Bitfield for IPP "print-color-mode" values

```
typedef unsigned pappl_color_mode_t;
```

### pappl\_content\_t

Bitfield for IPP "print-content-optimize" values

```
typedef unsigned pappl_content_t;
```

### pappl\_default\_cb\_t

papplIterateDefaults callback

```
typedef void (*pappl_default_cb_t)(ipp_attribute_t *attr, void *data);
```

### pappl\_duplex\_t

Duplex printing support

```
typedef enum pappl_duplex_e pappl_duplex_t;
```

### pappl\_finishings\_t

Bitfield for IPP "finishings" values

```
typedef unsigned pappl_finishings_t;
```

### pappl\_icon\_t

Printer PNG icon structure

```
typedef struct pappl_icon_s pappl_icon_t;
```

### pappl\_identify\_actions\_t

Bitfield for IPP "identify-actions" values

```
typedef unsigned pappl_identify_actions_t;
```

### pappl\_job\_cb\_t

papplIterateXxxJobs callback function

```
typedef void (*pappl_job_cb_t)(pappl_job_t *job, void *data);
```

### pappl\_kind\_t

Bitfield for IPP "printer-kind" values

```
typedef unsigned pappl_kind_t;
```

### pappl\_label\_mode\_t

Bitfield for IPP "label-mode-xxx" values

```
typedef unsigned short pappl_label_mode_t;
```

### pappl\_media\_col\_t

Media details structure

```
typedef struct pappl_media_col_s pappl_media_col_t;
```

### pappl\_media\_tracking\_t

Bitfield for IPP "media-tracking" values

```
typedef unsigned short pappl_media_tracking_t;
```

### pappl\_pr\_delete\_cb\_t

Printer deletion callback

```
typedef void (*pappl_pr_delete_cb_t)(pappl_printer_t *printer, pappl_pr_driver_data_t *data);
```

### pappl\_pr\_identify\_cb\_t

Identify-Printer callback

```
typedef void (*pappl_pr_identify_cb_t)(pappl_printer_t *printer, pappl_identify_actions_t actions, const char *message);
```

### pappl\_pr\_printfile\_cb\_t

Print a "raw" job callback

```
typedef bool (*pappl_pr_printfile_cb_t)(pappl_job_t *job, pappl_pr_options_t *options, pappl_device_t *device);
```

### pappl\_pr\_rendjob\_cb\_t

End a raster job callback

```
typedef bool (*pappl_pr_rendjob_cb_t)(pappl_job_t *job, pappl_pr_options_t *options, pappl_device_t *device);
```

### pappl\_pr\_rendpage\_cb\_t

End a raster page callback

```
typedef bool (*pappl_pr_rendpage_cb_t)(pappl_job_t *job, pappl_pr_options_t *options, pappl_device_t *device, unsigned page);
```

### pappl\_pr\_rstartjob\_cb\_t

Start a raster job callback

```
typedef bool (*pappl_pr_rstartjob_cb_t)(pappl_job_t *job, pappl_pr_options_t *options, pappl_device_t *device);
```

### pappl\_pr\_rstartpage\_cb\_t

Start a raster page callback

```
typedef bool (*pappl_pr_rstartpage_cb_t)(pappl_job_t *job, pappl_pr_options_t *options, pappl_device_t *device, unsigned page);
```

### pappl\_pr\_rwriteline\_cb\_t

Write a line of raster graphics callback

```
typedef bool (*pappl_pr_rwriteline_cb_t)(pappl_job_t *job, pappl_pr_options_t *options, pappl_device_t *device, unsigned y, const unsigned char *line);
```

### pappl\_pr\_status\_cb\_t

Update printer status callback

```
typedef bool (*pappl_pr_status_cb_t)(pappl_printer_t *printer);
```

### pappl\_pr\_testpage\_cb\_t

Print a test page callback

```
typedef const char * (*pappl_pr_testpage_cb_t)(pappl_printer_t *printer, char *buffer, size_t bufsize);
```

### pappl\_pr\_usb\_cb\_t

Raw USB IO callback

```
typedef ssize_t (*pappl_pr_usb_cb_t)(pappl_printer_t *printer, pappl_device_t *device, void *buffer, size_t bufsize, size_t bytes, void *data);
```

### pappl\_raster\_type\_t

Bitfield for IPP "pwg-raster-document-type-supported" values

```
typedef unsigned pappl_raster_type_t;
```

### pappl\_scaling\_t

Bitfield for IPP "print-scaling" values

```
typedef unsigned pappl_scaling_t;
```

### pappl\_sides\_t

Bitfield for IPP "sides" values

```
typedef unsigned pappl_sides_t;
```

### pappl\_uoptions\_t

USB gadget options bitfield

```
typedef unsigned pappl_uoptions_t;
```

## SEE ALSO

[**pappl**(1)](/pappl/1.md), [**pappl-client**(3)](/pappl-client/3.md), [**pappl-device**(3)](/pappl-device/3.md), [**pappl-job**(3)](/pappl-job/3.md), [**pappl-log**(3)](/pappl-log/3.md), **pappl-mainline**(3), [**pappl-makeresheader**(1)](/pappl-makeresheader/1.md), [**pappl-printer**(3)](/pappl-printer/3.md), [**pappl-resource**(3)](/pappl-resource/3.md), [**pappl-system**(3)](/pappl-system/3.md), https://www.msweet.org/pappl

## COPYRIGHT

Copyright © 2019-2022 by Michael R Sweet.

**PAPPL** is licensed under the Apache License Version 2.0 with an (optional) exception to allow linking against GPL2/LGPL2 software (like older versions of CUPS), so it can be used *freely* in any project you'd like. See the files "LICENSE" and "NOTICE" in the source distribution for more information.
