Get no. of pages before print in cups

406 Views Asked by At

What I have done:-

  • I am using cups4j api and I am getting the print job attributes(Job ID, Job Name, Page Size, Job sender, Creation date and Completion date) of the print job that are being sent to the printer.

What I want:-

  • total no. of pages that are being sent for print.

Problem facing:-

  • I am getting total no. of pages only when the job is completed.
  • I want to get the total no. of pages before the print gets completed that is as soon as the print job is sent.
1

There are 1 best solutions below

1
On BEST ANSWER

I have found answer to this question. There are different states that the print process goes through. We get total pages only when the job reaches the processing state. -pending, pending-held, processing, processing-stopped, aborted, canceled, completed. we can get the jobs when they are at the processing stage using cups4j api. After that we can use its attributes and also hold or move the job according to our requirement. what we can do is make changes in the cups api like adding job state enum like processing and create its jar and use that in our project.