Package Data | |
---|---|
Maintainer Username: | webklex |
Maintainer Contact: | github@webklex.com (Malte Goldenbaum) |
Package Create Date: | 2017-02-17 |
Package Last Update: | 2024-07-04 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-18 03:02:28 |
Package Statistics | |
---|---|
Total Downloads: | 1,229,781 |
Monthly Downloads: | 65,177 |
Daily Downloads: | 2,900 |
Total Stars: | 128 |
Total Watchers: | 5 |
Total Forks: | 52 |
Total Open Issues: | 27 |
Via Composer
$ composer require webklex/laravel-pdfmerger
Add the service provider to the providers array in config/app.php
.
'providers' => [
...
Webklex\PDFMerger\Providers\PDFMergerServiceProvider::class
],
'aliases' => [
...
'PDFMerger' => Webklex\PDFMerger\Facades\PDFMergerFacade::class
]
A basic usage example:
use Webklex\PDFMerger\Facades\PDFMergerFacade as PDFMerger;
$oMerger = PDFMerger::init();
$oMerger->addPDF('/path/to/project/vendors/webklex/laravel-pdfmerger/src/PDFMerger/examples/pdf_one.pdf', [2]);
$oMerger->addPDF('/path/to/project/vendors/webklex/laravel-pdfmerger/src/PDFMerger/examples/pdf_two.pdf', 'all');
$oMerger->merge();
$oMerger->save('merged_result.pdf');
...add raw content data:
$oMerger->addString(file_get_contents('/path/to/project/vendors/webklex/laravel-pdfmerger/src/PDFMerger/examples/pdf_two.pdf'), [1]);
...select the pages you want to merge:
$oMerger->addPDF($file, 'all'); //Add all pages
$oMerger->addPDF($file, [1]); //Add page one only
$oMerger->addPDF($file, [2]); //Add page two only
$oMerger->addPDF($file, [1, 3]); //Add page one and three only
...merge files together but add blank pages to support duplex printing:
$oMerger->duplexMerge();
...stream the merged content:
$oMerger->stream();
...download the merged content:
$oMerger->download();
..get the raw content data:
echo $oMerger->output();
...set the filename if you don't want to do it later:
$oMerger->setFileName('example.pdf');
Please see CHANGELOG for more information what has changed recently.
$ composer test
If you discover any security related issues, please email github@webklex.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.