2017 © Pedro Peláez
 

yii2-extension yii2-inquid-google-print

Print documents and views using Google Cloud Print service.

image

inquid/yii2-inquid-google-print

Print documents and views using Google Cloud Print service.

  • Sunday, February 25, 2018
  • by gogl92
  • Repository
  • 1 Watchers
  • 2 Stars
  • 72 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 1 Versions
  • 18 % Grown

The README.md

DEPRECATED

This project will be archived soon due to the fact that Google Cloud Print is discontinued, please stay tuned for the PrintNode libraries as we use them as an alternative for printing., (*1)

Yii Framework , (*2)

Donate, (*3)

Yii2 Google Cloud Print

Print documents and views using Google Cloud Print service., (*4)

Installation

The preferred way to install this extension is through composer., (*5)

Either run, (*6)

php composer.phar require --prefer-dist inquid/yii2-inquid-google-print "*"

or add, (*7)

"inquid/yii2-inquid-google-print": "*"

to the require section of your composer.json file., (*8)

Configuration

    //Inquid Components
    'GoogleCloudPrint' => [
                'class' => 'inquid\googlecloudprint\GoogleCloudPrint',
                'refresh_token' => '', // '' - if don't use  refresh token offline, then this field must be empty 
                'client_id' => '...',
                'client_secret' => '...',
                'grant_type' => 'refresh_token',
                'redirect_uri' =>'http://yourdomain.com/googlecloudauth', // http://yourdomain.com/?r=googlecloudauth
                'default_printer_id' => '__google__docs'
     ],

     //Inquid controllerMap
     'controllerMap' => [
             'googlecloudauth' => 'inquid\googlecloudprint\GooglecloudauthController',
      ],

Usage

Once the extension is installed, simply use it in your code by :, (*9)

    /* Check Refresh Token */
    Yii::$app->GoogleCloudPrint->checkRefreshTokenSession(Yii::$app->request->getAbsoluteUrl());

    /* Get printers as an array */
   $printers = Yii::$app->GoogleCloudPrint->getPrinters();

    /* Render a GridView with the printers  */
   echo Yii::$app->GoogleCloudPrint->renderPrinters();


    /* print html code */
    //Yii::$app->GoogleCloudPrint->sendPrintToPrinterContent("__google__docs", "job3", "<b>boba</b>", "text/html");

    /* If default printer is not sent, system will take the default printer in the configuration file */
    //$result = Yii::$app->GoogleCloudPrint->sendPrintToPrinterContent("", "job3", "<b>boba</b>", "text/html");

    /* Send pdf file to print */
   $result = Yii::$app->GoogleCloudPrint->sendFileToPrinter("", "Simple pdf", Yii::getAlias('@vendor').'/inquid/yii2-inquid-google-print/simple.pdf', 'application/pdf');

   /* Check if print works */
    if (isset($result['status'])) {
             echo "it works!";
     }

AUTHORIZED REDIRECT URI

For use with requests from web server: http://yourdomain.com?r=googlecloudauth or pretty URL http://yourdomain.com/googlecloudauth/, (*10)

if use online token you can logout by URL: http://yourdomain.com?r=googlecloudauth/remove or pretty URL http://yourdomain.com/googlecloudauth/remove, (*11)

SUPPORT

paypal, (*12)

The Versions

25/02 2018

dev-master

9999999-dev

Print documents and views using Google Cloud Print service.

  Sources   Download

LGPL-3.0+

The Requires

 

by Inquid

extension yii2