jjclane/laravel-print-node 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

jjclane/laravel-print-node

Composer 安装命令:

composer require jjclane/laravel-print-node

包简介

Print using PrintNode in Laravel. http://www.printnode.com

README 文档

README

Laravel Wrapper for PrintNode API. More about PrintNode can be found here: http://www.printnode.com

Laravel 5

This package has been written in Laravel 5.4 but should support previous versions of Laravel 5.

Installation

You can pull this package in through Composer.

composer require jjclane/laravel-print-node

You will need to add the following lines to config/app.php

'providers' => [
    ...
    Infernobass7\PrintNode\PrintNodeServiceProvider::class,
    ...
]

Next you will want to publish the config file.

php artisan vendor:publish --provider="Infernobass7\PrintNode\PrintNodeServiceProvider"

#Configuration The config files comes with two sections out of the box. The first is auth, which is required in order for the package to work. The username is either the API Key or the email address. If you use the API Key you should not provide a password. However, if you use an email address, you must provide the password too. The second section is the configuration options for printing. These will be used as a default should you not specify any while creating a PrintJob.

return [
    'auth' => [
        /*
         * Use this to set either API Key or email
         */
        'username' => '',
        
        /*
         * Do not set this if you are using API Key
         */
        'password' => ''
    ],
    
    'options' => [
        /*
         *  * = Options only available when installed client is running on a OSX Machine
         */
//      'bin' => , // String
//      'collate' => , // Boolean
//      'copies' => , // Integer
//      'dpi' => , // String
//      'duplex' => , // String - "long-edge" or "short-edge"
//      'fit_to_page' => , // * Boolean
//      'media' => , //String
//      'nup' => , // * String - Print Multiple Pages on One Sheet
//      'pages' => , // String - Specific Set of pages from the PDF. Format explained here https://printnode.com/docs/api/curl/#parameters
//      'paper' => , // String - Named paper size
//      'rotate' => // Integer - Rotate Page specified degrees ( accepted values: 90, 180, or 270 )
    ]
];

#Usage

##Printer This class handles retrieving list of Printers from PrintNode.

/*
 * Will return a collection of Printer Objects 
 */
Printer::all();
 
/*
 * Will return the specific printer Object based on the ID.
 * The ID can retrieved from PrintNode's service.
 */
$printer = Printer::get($printer_id);

/*
 * Retrieve a list of all PrintJobs previously printed on the Printer
 */
$previousJobs = $printer->getPrintJobs(); 
 
/*
 * Retrieve a specific print job previousl printed on the Printer
 */
$previousJob = $printer->getPrintJob($id);

##Print Job This class handles retrieving and creating new PrintJobs.

/*
 * Create a new PrintJob
 */
$job = new PrintJob($attributes = []);
 
/*
 * Sends the print job to the specified Printer
 */
$job->print(Printer $printer);
// Alternatively
$printer->print(PrintJob $job);

/*
 * Fluent Setters to create PrintJob
 */
 
/*
 * Grabs file based on the path of the storage disk defined in Storage Configuration 
 * Set contentType to either 'raw_base64' or 'pdf_base64'
 */
$job->setFile($path, $disk = 'local', $raw = false);

/*
 * Sets the content to the URI provided
 * Sets Credentials for basic Authentication type
 */
$job->setUri($uri, $credentials = null, $raw = false);
// Alternatively 
$job->setUri($uri)->setAuthentication($credentials, $basic = true);

/*
 * 
 */
$job->setOptions($options = []);

/*
 * Please note the next two methods are not the same.
 */

/*
 * Sets the number of times that the PrintJob is going to be sent to the Printer
 */
$job->setQuantity(int $qauntity);

/*
 * Sets the number of copies that are printed per PrintJob
 */
$job->setCopies(int $quantity);

/*
 * Sets the source name to display on PrintNode
 */
$job->setSource($name);

/*
 * Sets how long in seconds the PrintJob will sit in the queue waiting to be printed
 * Afterwards it will be deleted
 */
$job->setExpireAfter(int $seconds);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2020-08-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固