michaelrsweet / pappl

PAPPL - Printer Application Framework
https://www.msweet.org/pappl
Apache License 2.0
307 stars 49 forks source link

Add mechanism to count copies for all rendering paths / document formats #265

Closed wifiprintguy closed 1 year ago

wifiprintguy commented 1 year ago

There is currently no high level facility that counts copies, only impressions. Lacking this makes implementing features such as "Job Proof and Suspend" (IPP Enterprise Printing Extensions v2.0) difficult because the logic gets pushed down to lower levels and individual document rendering pipelines, which can lead to inconsistent behavior.

Describe the solution you'd like Add "copies" and "copies_completed" to _pappl_job_s. Streaming document formats (PWG Raster) complicate because the copies are usually just resent as additional pages. Implementing support for the "job-pages-per-set" Job Template attribute (5100.1) for streaming formats will help with this and the logic for counting the copies if it isn't supported already.

It might also be good to have a "rstartcopy_cb" and/or "rendcopy_cb" callbacks for drivers.

Describe alternatives you've considered I tried writing driver code but whether my callbacks get called depends on the document format and some document formats don't hit my driver. Counting impressions doesn't work if the driver doesn't know the total number of pages in the document(s), which requires the driver to be able to parse the document format, which is not always otherwise needed.

Additional context n/a

michaelrsweet commented 1 year ago

While we can't extend the driver callbacks in a 1.x series, I think we can expose this in a way that allows the driver to pause processing and resume later as needed.

michaelrsweet commented 1 year ago

[master 109207d] Add papplJobGetCopies/Completed and papplJobSetCopiesCompleted APIs (Issue #265)

michaelrsweet commented 1 year ago

[master d7d8e02] Update raster path to count copies properly (Issue #265)