Is this the best way to get the size of a Paper via CUPS?
- by Lawrence Johnston
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?