fcarbah/pdfmerger

PHP5 的 PDF 文件合并工具

v1.0.6 2019-07-04 01:08 UTC

This package is auto-updated.

Last update: 2024-09-04 12:00:32 UTC


README

使用 Setasign/FPDI-FPDF https://github.com/Setasign/FPDI-FPDF

要安装,请将以下行添加到您的 composer.json 中

"fcarbah/pdf-merger": "^1.0"

或者

composer require fcarbah/pdf-merger: "^1.0"

示例用法

use Fcarbah\Classes\PdfMerger;
use Fcarbah\Classes\Orientation;
use Fcarbah\Classes\OutputFormat;

$pdf = new PdfMerger();

$pdf->addPdf('samplepdfs/one.pdf', '1, 3, 4');
$pdf->addPdf('samplepdfs/two.pdf', '1-2');
$pdf->addPdf('samplepdfs/three.pdf', 'all');

//You can optionally specify a different orientation for each PDF
$pdf->addPdf('samplepdfs/one.pdf', '1, 3, 4', Orientation::POTRAIT);
$pdf->addPdf('samplepdfs/two.pdf', '1-2', Orientation::LANDSCAPE);

$pdf->merge(OutPutFormat::STRING, 'samplepdfs/TEST2.pdf', Orientation::POTRAIT);
 
// This will be used for every PDF that doesn't have an orientation specified