PHP Classes

PHP Google Cloud Print API: Print documents using a Google Cloud printer

Recommend this page to a friend!

  Author Author  
Picture of Yasir Siddiqui
Name: Yasir Siddiqui is available for providing paid consulting. Contact Yasir Siddiqui .
Classes: 14 packages by
Country: Pakistan Pakistan
Age: 39
All time rank: 3163 in Pakistan Pakistan
Week rank: 40 Up1 in Pakistan Pakistan Up
Innovation award
Innovation award
Nominee: 8x

Winner: 1x


  Detailed description   Download Download .zip .tar.gz   Install with Composer Install with Composer  
This class can print documents using a Google Cloud printer.

It can send HTTP requests to the Google Accounts API to login in a Google account using a given user email address and his password to obtain a OAuth token.

The class can use the obtained token to send HTTP requests to the Google Cloud Print API to perform several types of operations.

Currently it can retrieve the list of available cloud printers, as well send a given document file to be printed in one of the printers.

Details

Google Cloud Print

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

1) Create Google API project and get OAuth credentials.

Create Google OAuth Credentials

1) Create new project and get the corresponding OAuth credentials using Google developer console https://console.developers.google.com/

2) Select APIS & AUTH –> credentials from the left menu.

3) 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.

4) 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.

For Online Access hit index.php

Online access requires authorization every time you need to send print to printer once token in Session gets expired.

For Offline Access (when you want to send prints without user presence) hit offlineAccess.php

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


  Classes of Yasir Siddiqui  >  PHP Google Cloud Print API  >  Download Download .zip .tar.gz  >  Support forum Support forum (7)  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: PHP Google Cloud Print API
Base name: google-cloud-print
Description: Print documents using a Google Cloud printer
Version: 1.19
PHP version: 5.0
License: BSD License
All time users: 1164 users
All time rank: 3247
Week users: 1 user
Week rank: 257 Up
 
  Groups   Rate classes User ratings   Applications   Files Files  

  Groups  
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Printing Document generation and preparation for printing View top rated classes
Group folder image Web services Web data clipping, SOAP or XML-RPC clients and servers View top rated classes


  Recommendations  

How can PHP print document without showing a preview
Printer report ticket


  Innovation Award  
PHP Programming Innovation award nominee
June 2013
Number 3


Prize: One book of choice by Packt
Google Cloud Print is a service that allows finding printers accessible via the Web and print documents using printers with authorized access.

This PHP class can be used to find and send documents to available printers using the Google Cloud Print service.

Manuel Lemos

  User ratings  
RatingsUtility Consistency Documentation Examples Tests Videos Overall Rank
All time: Perfect (100%) Good (93%) Sufficient (75%) Good (87%) - - Sufficient (75%) 132
Month: Not yet rated by the users

  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  Files folder image Files  
File Role Description
Accessible without login Plain text file Config.php Conf. Configuration script
Accessible without login Plain text file cron.php Example Example script
Accessible without login Plain text file example.php Example Example script
Plain text file GoogleCloudPrint.php Class Class source
Plain text file HttpRequest.Class.php Class Class source
Accessible without login Plain text file index.php Example Example script
Plain text file oAuthRedirect.php Class Class source
Accessible without login Plain text file offlineAccess.php Appl. Application script
Accessible without login Plain text file offlineToken.php Appl. Application script
Accessible without login Plain text file README.md Doc. Documentation

Install with Composer Install with Composer - Download Download all files: google-cloud-print.tar.gz google-cloud-print.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
  Files folder image Files  
File Role Description
Accessible without login Plain text file Config.php Conf. Configuration script
Accessible without login Plain text file cron.php Example Example script
Accessible without login Plain text file example.php Example Example script
Plain text file GoogleCloudPrint.php Class Class source
Plain text file HttpRequest.Class.php Class Class source
Accessible without login Plain text file index.php Example Example script
Plain text file oAuthRedirect.php Class Class source
Accessible without login Plain text file offlineAccess.php Appl. Application script
Accessible without login Plain text file offlineToken.php Appl. Application script
Accessible without login Plain text file README.md Doc. Documentation

Install with Composer Install with Composer - Download Download all files: google-cloud-print.tar.gz google-cloud-print.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.