承接 inquid/yii2-inquid-google-print 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

inquid/yii2-inquid-google-print

Composer 安装命令:

composer require inquid/yii2-inquid-google-print

包简介

Print documents and views using Google Cloud Print service.

README 文档

README

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.

Yii Framework

Donate

Yii2 Google Cloud Print

Print documents and views using Google Cloud Print service.

Installation

The preferred way to install this extension is through composer.

Either run

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

or add

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

to the require section of your composer.json file.

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 :

    /* 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/

LOGOUT LINK

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

SUPPORT

paypal

统计信息

  • 总下载量: 647
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0
  • 更新时间: 2017-05-21