承接 sun/pdf 相关项目开发

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

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

sun/pdf

Composer 安装命令:

composer require sun/pdf

包简介

Sun PDF is the pdf generating tools for the serious PHP developers.

README 文档

README

Total Downloads Latest Stable Version Latest Unstable Version License

Sun PDF is the pdf generating tools for the serious PHP developers.

Installation Process

Just copy PDF folder somewhere into your project directory. Then include Sun PDF autoload file.

require_once('/path/to/PDF/autoload.php');

Sun PDF is also available via Composer/Packagist.

composer require sun/pdf

Basic Uses

Downloading PDF

$pdf = new Sun\PDF;
$pdf->download("<h1>Hello world</h1>");

Viewing PDF In The Browser

$pdf = new Sun\PDF;
$pdf->stream("<h1>Hello world</h1>");

Getting PDF Output

$pdf = new Sun\PDF;
$pdf->output("<h1>Hello world</h1>");

Changing Configuration

In the Sun PDF I used PhantomJS. You can change all the configuration of the PhantomJS. To change PhantomJS configuration, you need to pass your own configuration file into Sun PDF constructor.

$pdf = new Sun\PDF("/path/to/SunPdf.js");

Please, click This Link to know about all the configuration of the PhantomJS.

If you do not wish to pass HTML codes as plain string, you can pass your HTML/PHP file into all the method of the Sun PDF. To use default template engine features you need to setup everything before use. All you have to do for setup is -

$pdf = new Sun\PDF(null, "/path/to/views");

I used Twig template engine, click This Link to know about Twig template engine.

Generating PDF With Template Engine

$pdf = new Sun\PDF(null, "/path/to/views");

// download pdf 
$pdf->download("/path/to/views/test.php", ['name' => 'Iftekher Sunny']);

// viewing pdf in the browser
$pdf->stream("/path/to/views/test.php", ['name' => 'Iftekher Sunny']);

Integration In Laravel Framework

Add the ServiceProvider to the providers array in config/app.php

Sun\Provider\PDFServiceProvider::class,

Add the facade to the aliases array in config/app.php

'PDF'   =>  Sun\Facade\PDFFacade::class,

Integration In Planet Framework

Add the provider in the config/provider.php file.

Sun\Provider\PDFProvider::class,

Add the alien in the config/alien.php file.

'PDF'   =>  Sun\Alien\PDFAlien::class,

License

This package is licensed under the MIT License

统计信息

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

GitHub 信息

  • Stars: 21
  • Watchers: 7
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-12-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固