softplaceweb/laravel-10-pdf-merger
最新稳定版本:1.1.9
Composer 安装命令:
composer require softplaceweb/laravel-10-pdf-merger
包简介
Laravel Pdf Merger
README 文档
README
A simple Laravel service provider with some basic configuration for including the TCPDF library to allow you to merge PDF's in your Laravel application.
Compatibility from 1.3 to 1.7 versions, if attempt to merge version greater than 1.4 it convert through Ghosthscript.
The final result is a merged pdf file v 1.7
Requirements
- PHP 8.0+
- Ghostscript (gs command on Linux)
Installation
The Laravel PDF Merger service provider can be installed via composer by requiring the softplaceweb/laravel-10-pdf-merger package in your project's composer.json.
composer require softplaceweb/laravel-10-pdf-merger
for lumen, you should add the following lines:
$app->register(Softplaceweb\PdfMerger\PdfMergerServiceProvider::class); class_alias(Softplaceweb\PdfMerger\Facades\TCPDF::class, 'PDF');
That's it! You're good to go.
Here is a little example:
use Softplaceweb\PdfMerger\Facades\PdfMerger; PdfMerger::addPDF('path/to/pdf1.pdf', 1) ->addPDF('path/to/pdf2.pdf', 'all') ->merge() ->save('new_file_name.pdf', 'browser');
or sending pdf's as array ...
use Softplaceweb\PdfMerger\Facades\PdfMerger; PdfMerger::addPDF([ [ 'filePath' => 'path/to/pdf1.pdf', 'pages' => 1, ], [ 'filePath' => 'path/to/pdf2.pdf', ], ]) ->merge() ->save('new_file_name.pdf', 'browser');
You can extend functionality for this class and for a list of all available function take a look at the TCPDF Documentation
Configuration
Laravel Pdf Merger comes with some basic configuration. If you want to override the defaults, you can publish the config, like so:
php artisan vendor:publish --provider="Softplaceweb\PdfMerger\PdfMergerServiceProvider"
Now access config/pdf-merger.php to customize.
- use_original_header is to used the original
Header()from TCPDF.- Please note that
PdfMerger::setHeaderCallback(function($pdf){})overrides this settings.
- Please note that
- use_original_footer is to used the original
Footer()from TCPDF.- Please note that
PdfMerger::setFooterCallback(function($pdf){})overrides this settings.
- Please note that
Credits
统计信息
- 总下载量: 1.47k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-06-13