承接 tibonilab/pdf-lumen-bundle 相关项目开发

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

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

tibonilab/pdf-lumen-bundle

最新稳定版本:2.0.3

Composer 安装命令:

composer require tibonilab/pdf-lumen-bundle

包简介

compatibility fork of k98kurz/pdf (dompdf wrapper) for Laravel Lumen

README 文档

README

Compatibility fork of k98jurz/pdf-lumen that is a conversion of Thujohn/Pdf for Laravel Lumen 5.* Simple Dompdf wrapper package (uses Dompdf stable version 0.5)

Installation Lumen >= 5.4.*

Add tibonilab/pdf-lumen-bundle to composer.json.

"tibonilab/pdf-lumen-bundle": "2.0.0" 

Installation Lumen <= 5.3.*

Add tibonilab/pdf-lumen-bundle to composer.json.

"tibonilab/pdf-lumen-bundle": "1.0.0" 

After require right version tag for your Lumen installation run composer update to pull down the latest version of Pdf.

Open up bootstrap/app.php and add the service provider.

 $app->register('tibonilab\Pdf\PdfServiceProvider');

And add the alias.

 class_alias('tibonilab\Pdf\PdfFacade', 'PDF');

Usage

Show a PDF

$app->get('/', function () { $html = '<html><body>' . '<p>Put your html here, or generate it with your favourite ' . 'templating system.</p>' . '</body></html>'; return PDF::load($html, 'A4', 'portrait')->show(); });

Download a PDF

$app->get('/', function () { $html = '<html><body>' . '<p>Put your html here, or generate it with your favourite ' . 'templating system.</p>' . '</body></html>'; return PDF::load($html, 'A4', 'portrait')->download('my_pdf'); });

Returns a PDF as a string

$app->get('/', function () { $html = '<html><body>' . '<p>Put your html here, or generate it with your favourite ' . 'templating system.</p>' . '</body></html>'; $pdf = PDF::load($html, 'A4', 'portrait')->output(); });

Multiple PDFs

for ($i=1;$i<=2;$i++) { $pdf = new \k98kurz\Pdf\Pdf(); $content = $pdf->load(View::make('pdf.image'))->output(); File::put(public_path('test'.$i.'.pdf'), $content); } PDF::clear();

Examples

Save the PDF to a file in a specific folder, and then mail it as attachement. By @w0rldart

define('BUDGETS_DIR', public_path('uploads/budgets')); // I define this in a constants.php file if (!is_dir(BUDGETS_DIR)){ mkdir(BUDGETS_DIR, 0755, true); } $outputName = str_random(10); // str_random is a [Laravel helper](http://laravel.com/docs/helpers#strings) $pdfPath = BUDGETS_DIR.'/'.$outputName.'.pdf'; File::put($pdfPath, PDF::load($view, 'A4', 'portrait')->output()); Mail::send('emails.pdf', $data, function($message) use ($pdfPath){ $message->from('us@example.com', 'Laravel'); $message->to('you@example.com'); $message->attach($pdfPath); });

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固