tomsgu / pdf-merger-bundle
Symfony bundle that integrates tomsgu/pdf-merge lib.
Installs: 137 201
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 3
Forks: 2
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.2 || ^8.0
- symfony/framework-bundle: ^4.0 || ^5.0 || ^6.0 || ^7.0
- tomsgu/pdf-merger: 0.*
Requires (Dev)
- symfony/phpunit-bridge: ^4.0 || ^5.0 || ^6.0
README
Symfony bundle that integrates tomsgu/pdf-merger.
Installation
composer require tomsgu/pdf-merger-bundle
Usage
use Tomsgu\PdfMerger\PdfMerger; class MergePdfs { private $merger; public function __construct(PdfMerger $merger) { $this->merger = $merger; } public function mergePdfs() { $pdfCollection = new PdfCollection(); $pdfCollection->addPdf('filename.pdf', PdfFile::ALL_PAGES, PdfFile::ORIENTATION_PORTRAIT); $pdfCollection->addPdf('filename2.pdf', '1-4,9', PdfFile::ORIENTATION_LANDSCAPE); $pdfCollection->addPdf('filename3.pdf'); /** * Available modes: MODE_FILE, MODE_DOWNLOAD, MODE_STRING, MODE_BROWSER * Orientation: This is a fallback if the orientation wasn't specified when adding pdf. */ $this->merger->merge($pdfCollection, 'output.pdf', PdfMerger::MODE_FILE, PdfFile::ORIENTATION_LANDSCAPE); } }