sinanbekar/pdf-merger

PHP 7.3 & PHP 8 的 PDF 文件合并器

v1.0.0 2022-02-13 12:27 UTC

This package is auto-updated.

Last update: 2024-09-13 18:00:53 UTC


README

最初由 http://pdfmerger.codeplex.com/team/view 编写

不够完美,但做了一些改动。

安装

composer require sinanbekar/pdf-merger

示例用法

$pdf = new \SB\PDFMerger\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', 'L');
$pdf->addPDF('samplepdfs/two.pdf', '1-2', 'P');

$pdf->merge('file', 'samplepdfs/TEST2.pdf', 'P');

// REPLACE 'file' WITH 'browser', 'download', 'string', or 'file' for output options
// Last parameter is for orientation (P for protrait, L for Landscape). 
// This will be used for every PDF that doesn't have an orientation specified

测试

./vendor/bin/phpunit --configuration phpunit.xml
./vendor/bin/psalm