Server side printing with Google Cloud Print API from a PHP application
It took me quite some time to figure out how to print properly from a web application. I will explain here how I did it, so you don't have to spend the same time.
Google Cloud Print API uses OAuth 2.0 for authorization.
As explained [here] on the Google Developer page, the best way to use OAuth with the Google API is with a Google service account. Create a service account as explained on the Google Developer page.
To use OAuth a library is required. Google has published the [Google API PHP client library]. If you want to use the examples from the Developer pages, you need to use version 1 of the library. In this article I use version 2 of the library.