jurosh/pdf-merge

PHP PDF 合并器

2.1.0 2021-03-28 19:57 UTC

This package is not auto-updated.

Last update: 2024-09-23 11:51:29 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');

就是这样!

享受它,如果你喜欢请留下星标 :)