定制 vianetz/pdf-generator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

vianetz/pdf-generator

最新稳定版本:5.0.0

Composer 安装命令:

composer require vianetz/pdf-generator

包简介

A library that supports method for generating PDF documents based on DomPdf and FPDI.

关键字:

README 文档

README

This library offers an easy-to-use API for PDF generation and merging.
Internally it uses the DomPDF library for PDF generation and FPDI for merging.

More information about this PDF API can also be found on my website.

Usage

Create PDF document from HTML contents

// Create a new pdf instance.
$pdf = \Vianetz\Pdf\Model\PdfFactory::general()->create();

// Create the document. You can return any kind of HTML content here.
$document = new \Vianetz\Pdf\Model\HtmlDocument('<strong>Hello</strong> World!');
 
// Add our document to the pdf. You can add as many documents as you like
// as they will all be merged into one PDF file.
$pdf->add($document);

// Save the resulting PDF to file test.pdf - That's it :-)
$pdf->saveToFile('test.pdf');

Merge a PDF file and a PDF string into one PDF file

// Load some random PDF contents
$pdfString = file_get_contents('test1.pdf');

// Setup things
$pdfMerge = \Vianetz\Pdf\Model\PdfMerge::create();

// Do the merge.
$pdfMerge->mergePdfString($pdfString, 'background.pdf');
$pdfMerge->mergePdfFile('test2.pdf');

// Save the result PDF to file result.pdf.
file_put_contents($fileName, $pdfMerge->toPdf());

Tips & Tricks

  • The string literal __PDF_TPC__ will be replaced with the total page count

Frequently Asked Questions

Please find the Frequently Asked Questions on my website.

Support

If you have any issues or suggestions with this extension, please do not hesitate to contact me.

License

GNU General Public License v3.0
See also LICENSE file.

This extension uses the DomPDF library. For license information please visit the DomPdf repository.
This extension uses the FPDI library. For license information please visit the FPDI repository.

This library uses Semantic Versioning - please find more information at semver.org.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2017-05-06