Google cloud printing via PHP

Paradoxis picture Paradoxis · Sep 27, 2014 · Viewed 7.9k times · Source

I'm trying to make an app that automatically prints a PDF after it has been generated for the client. (by his request) I got a cloud printer up and running which works perfectly fine if I try to use it with something like chrome.

All libaries for PHP are extremely outdated (up to 4 years old) and most of them are completely broken or provide little to no documentation on how to use them, and trying to use google's own documentation is even more of a nightmare

The best I could come up with was using this libary: yasirsiddiqui/php-google-cloud-print, mostly because it was the only one I could actually figure out how to use it.

However when I use this to submit a print job the owner of the account (me) gets a warning email that someone suspicious is trying to log into their account and it has been blocked.

Does anyone know if there is a (working) library to do this with, or if there is a command line alternative (preferred) that I could use system() or exec() with?

Note: I have 0% knowledge of python, and using JavaScript to submit these jobs is NOT an option because end users are not allowed to alter the document.


Update [2015/09/08]: For some reason Google doesn't allow printing via some accounts even when using OAuth2, a quick hack to fix this was by simply creating an entirely new account and printing with that.

Answer

Yasir Siddiqui picture Yasir Siddiqui · Feb 17, 2015

I have updated code to use Google OAuth2 and now there will not be any issues related to account blocked or security risk etc. Here is url of updated code https://github.com/yasirsiddiqui/php-google-cloud-print