Is this the best way to get the size of a Paper via CUPS?

Posted by Lawrence Johnston on Stack Overflow See other posts from Stack Overflow or by Lawrence Johnston
Published on 2010-03-20T07:28:08Z Indexed on 2010/03/20 7:31 UTC
Read the original article Hit count: 180

Filed under:
|
|
|

I've got a CUPS job control file. I need to get the actual dimensions of the print that was made.

This is the way I've figure out to do it: Get the paper name using the media attribute. (e.g. Letter) Get the printer uri from the printer-uri attribute. (e.g. ipp://localhost/printers/MyPrinter) Get the printer name by passing the printer uri to the IPP_GET_PRINTER_ATTRIBUTES operation and getting the printer-name attribute. (e.g. MyPrinter) Get the path to the PPD passing the printer name to the the cupsGetPPD method. Open the PPD passing the path to the PPD to the ppdOpenFile method. Get the paper size by passing the PPD and paper name to the ppdPageSize method.

This will work, but it seems a bit roundabout. Is there a more efficient way of getting what I need?

© Stack Overflow or respective owner

Related posts about cups

Related posts about ppd