byggmann/php-pdf-merge

PHP PDF 合并器

3.0.0 2022-01-26 15:03 UTC

This package is auto-updated.

Last update: 2024-09-26 21:22:56 UTC


README

PHP PDF 合并库。

使用 composer 安装

composer require byggmann/php-pdf-merge

亮点

自动设置方向的 PDF 合并。

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

用法

// Autoload composer classes...

// 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') // sets orientation automatically, "all" pages default 
  ->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');

就这样!

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