Recommend this page to a friend! |
Download |
Info | Example | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2024-01-09 (9 months ago) | 68% | Total: 1,171 | All time: 3,242 This week: 61 |
Version | License | PHP version | Categories | |||
google-cloud-print 1.21 | BSD License | 5.0 | PHP 5, Printing, Web services |
Description | Author | |||
This class can print documents using a Google Cloud printer. Innovation Award
|
How can PHP print document without showing a preview
Printer report ticket
<?php |
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.
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
Files (10) |
File | Role | Description |
---|---|---|
Config.php | Conf. | Configuration script |
cron.php | Example | Example script |
example.php | Example | Example script |
GoogleCloudPrint.php | Class | Class source |
HttpRequest.Class.php | Class | Class source |
index.php | Example | Example script |
oAuthRedirect.php | Class | Class source |
offlineAccess.php | Appl. | Application script |
offlineToken.php | Appl. | Application script |
README.md | Doc. | Documentation |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
User Ratings | User Comments (2) | |||||||||||||||||||||||||||||||||||||
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.