First of all the GCP documentation incorrectly states that you can retrieve the printer capabilities with the /list service interface. That doesn't work. You have to call the /printer service which does return the printer capabilities. The capabilities are simply a list of JSONs each describing a printer parameter and the possible values that parameter can take. Sometimes it can contain some additional information as well. Here is for example a small extract of the page sizes supported by my HP:
"name": "psk:PageMediaSize",
"psf:SelectionType": "psk:PickOne",
"psk:DisplayName": "Paper Size",
"type": "Feature",
"options": [
{
"psk:MediaSizeWidth": "215900",
"name": "psk:NorthAmericaLetter",
"psk:MediaSizeHeight": "279400",
"psk:DisplayName": "Letter"
},
{
"psk:MediaSizeWidth": "215900",
"name": "psk:NorthAmericaLegal",
"psk:MediaSizeHeight": "355600",
"psk:DisplayName": "Legal"
}
]
By looking at the POST request that Chrome sends from the GCP dialog I have found out that the /submit service does not use a capabilities parameter at all. It actually uses the parameter called ticket to specify the print job settings. The format of the parameter is quite simple, it is a JSON that looks like this:
{
"version":"1.0",
"print":{
"color":{"vendor_id":"psk:Color","type":0},
"duplex":{"type":0},
"page_orientation":{"type":1},
"copies":{"copies":1},
"dpi":{"horizontal_dpi":600,"vertical_dpi":600},
"media_size":{"width_microns":148000,"height_microns":210000,"is_continuous_feed":false},
"collate":{"collate":true},
"vendor_ticket_item":[
//Printer specific settings here, from the capabilities:
{"id":"psk:JobInputBin","value":"ns0000:Tray3"},
{"id":"psk:PageICMRenderingIntent","value":"psk:Photographs"},
{"id":"psk:PageMediaType","value":"ns0000:Auto"},
{"id":"psk:JobOutputBin","value":"ns0000:Auto"},
//etc.
]
}
}
The first part of the parameters corresponds to the basic settings from the print dialog and they are quite self-explanatory and the values are easy to change. The vendor_ticket_item array is a bit more complicated. It contains id/value pairs described by the printer capabilities we retrieved earlier. The id will contain the name of the parameter from the capabilities and the value will contain the name of one of the records in the parameter options, or a numeric value etc, as described in the capabilities.
That should work just fine for most parameters, but if you get stuck and can't figure out the correct values you can always open a sample document in Chrome and print it. Pick a GCP printer and then click "Print using Google Cloud Print dialog..." and from the "Advanced options" make the exact settings that you need. Using something like Fiddler extract the value of the ticket parameter from POST request Chrome does to the /cloudprint/submit service.