Samir Bhatt
Samir Bhatt

Reputation: 3261

Set paper size A4 while printing from google cloud print API

I have integrated Google cloud printing API in android application. I am printing image from GCP. Everything is working fine. I want to set paper size using API. Is that feasible?

Currently i am sending following data :

**URL :**...cloudprint/submit

**Param :** 
printerid
file
title
contentType

As per google document, we can use ticket param for that. not sure what to send in this key.

Any help appreciated.

Upvotes: 1

Views: 802

Answers (1)

Anirudh Saria
Anirudh Saria

Reputation: 21

We need to pass the A4 specifications to the G.C.Printer. You need to pass ticket in the path parameter along with printerid, file, title, contentType and should look like this:

ticket :   {"version":"1.0","print":{"media_size":{"width_microns":210000,"height_microns":297000,"is_continuous_feed":false,"vendor_id":"ISO_A4"}}}

(^above are the specs of A4 media size)

Your params should look like this:

printerid : <printerid>
content: <content>
title : <title>
contentType: <contentType>
ticket :   {"version":"1.0","print":{"media_size":{"width_microns":210000,"height_microns":297000,"is_continuous_feed":false,"vendor_id":"ISO_A4"}}}

Also, this works perfectly for GCP version 2.0

Ticket params is basically the settings we send to G.C.Printer and by default, it sends media type as "NA_LETTER". We can override the default settings by sending the ticket parameter to trigger the print.

GCP parses the ticket and uses the key value accordingly. If any key is wrong, it throws "unable to parse ticket" error.

Upvotes: 1

Related Questions