Open Standard Print API (PAPI)

Purpose

 

The Open Standard Print API (PAPI) is a set of open standard C functions that can be called by application programs to use the print spooling facilities available in Linux (NOTE:  this interface is being proposed as a print standard for Linux, but there is really nothing Linux-specific about it and it could be adopted on other platforms).  This provides a common print API that applications can use without having to know the distribution or underlying print system  on which they are running.

 

The functions provided under PAPI are primarily oriented towards print submission applications, but the functions also allow for print system monitoring or operation applications.

 

A high level diagram that shows the position of PAPI in the overall architecture can be found here:

ftp://ftp.pwg.org/pub/pwg/fsg/architecture/papi/papi-Overview.jpg

 

The PAPI specification can be found at:

ftp://ftp.pwg.org/pub/pwg/fsg/spool/papi-latest.pdf

 

Goals

 

·         Provide a common print API that application can use without having to know the distribution or underlying print system on which they are running.

·         Use the IPP/Printer Working Group (PWG) semantic model as a basis for the API.

·         Allow implementation of the API on top of any type of printing system, whether or not it is based on the IPP/PWG semantic model.

 

Interfaces

 

·         PAPI provides an interfaces to applications in the form of the functions it defines. 

·         The PAPI function names follow the convention “papiObjectAction”, where “Object” is the object and “Action” is the operation to be performed (e.g. “papiPrinterQuery”).

·         The PAPI functions are grouped as follows:

o        Service API: controls creation, setting of options, and destruction of a print service session

o        Printer API: list, query, and control printers

o        Job API: submit, list, query, and control print jobs

o        Attributes API: create, modify, and access attributes used in the Printer and Job APIs

o        Miscellaneous API: other functions

·         A particular implementation of PAPI is built on the interfaces and protocols specific to the underlying print system (e.g. an implementation to run on top of the Common UNIX Printing System (CUPS) would use IPP to interface to the CUPS spooler).

 

Flow or Sequence

 

There are many different possible sequences of PAPI function calls.  Here is a simple example sequence of an application using the Job Ticket API and then submitting a print job (to a known printer) using the job ticket to specify the print options.

 

1)       The application creates a job ticket through a sequence of calls to the Job Ticket API.

2)       papiServiceCreate is called to create a PAPI print service session.

3)       papiJobSubmit is called, specifying a reference to the generated job ticket.

4)       papiJobGetAttributeList is called to get the attributes associated with the submitted job.

5)       papiAttributeListGetInteger is called to get the job ID assigned to the submitted job (this may be displayed to the end-user or recorded by the application).

6)       papiJobFree is called to free the resources associated with the returned job object.

7)       papiServiceDestroy is called to end the print service session and free any resources associated with it.