flaurent/pdf-merge

PHP PDF 合并器

2.1.0 2021-03-28 19:57 UTC

This package is auto-updated.

Last update: 2024-09-25 21:07:10 UTC


README

PHP PDF 合并库。

使用 composer 安装

composer require jurosh/pdf-merge

应添加依赖

"jurosh/pdf-merge": "^2.0"

亮点

支持纵向/横向合并 PDF。

在 Laravel4 & Laravel5 框架中测试过(但也可以作为独立工具使用)。

使用方法

// Autoload composer classses...

// and now we can use library
$pdf = new \Jurosh\PDFMerge\PDFMerger;

// add as many pdfs as you want
$pdf->addPDF('path/to/source/file.pdf', 'all', 'vertical')
  ->addPDF('path/to/source/file1.pdf', 'all')
  ->addPDF('path/to/source/file2.pdf', 'all', 'horizontal');

// call merge, output format `file`
$pdf->merge('file', 'path/to/export/dir/file.pdf');

这就完成了!

享受并如果喜欢的话留下星标 :)