Send PDF to a Google cloud printer, specifying your Token and PrinterID. More details to follow.
510
PHP class to print documents using Google Cloud Print using OAuth2.
First of all you have to add printers to Google Cloud Print using your Gmail account and Google Chrome browser. Follow the instructions on the following link to add printer to Google Cloud Print
https://support.google.com/cloudprint/answer/1686197
Google OAuth Prerequisites
Create Google OAuth Credentials
Create new project and get the corresponding OAuth credentials using Google developer console https://console.developers.google.com/
Select APIS & AUTH –> credentials from the left menu.
Click Create new Client ID button. A popup will appear. In Authorized redirect URIs text area enter url that should point to oAuthRedirect.php on your server.
After submitting this form, we can get the client Id, secret key etc.
Replace client_id, client_secret values in $redirectConfig and $authConfig arrays in Config.php file.
You also need to replace redirect_uri in both $redirectConfig and $authConfig arrays. This URL should point to oAuthRedirect.php on your server.
Online access requires authorization every time you need to send print to printer once token in Session gets expired.
Offline access requires authorization only once or unless user has revoked access. You should use offline access when you want to send prints to printer with out the presence of user or send prints to printer using a cron job script.
Once you hit offlineAccess.php you will be redirected to offlineToken.php which will show you your refresh token.
You need to save refresh token to database, file or some cache systems as later on when you will send print to printer in offline mode you need to replace that refrsh token at line # 29 on cron.php
Content type
Image
Digest
Size
172.5 MB
Last updated
over 9 years ago
docker pull livehybrid/cloudprinter