jmleroux/pdf-merger
Composer 安装命令:
composer require jmleroux/pdf-merger
包简介
PDF File Merger for PHP 7
README 文档
README
Original written by http://pdfmerger.codeplex.com/team/view
Forked from https://github.com/clegginabox/pdf-merger
Installation
composer require jmleroux/pdf-merger
Example Usage
<?php use Jmleroux\PDFMerger\PDFMerger; $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', 'L'); $pdf->addPDF('samplepdfs/two.pdf', '1-2', 'P'); $pdf->merge('file', 'samplepdfs/TEST2.pdf', 'P');
PDF libraries
You can use either FPDF, TCPDF or tFPDF as the internal PDF library by providing the right parameter to the constructor:
<?php use Jmleroux\PDFMerger\PDFMerger; $pdf = new PDFMerger(); // use FPDF $pdf = new PDFMerger('fpdf'); // use FPDF $pdf = new PDFMerger('tcpdf'); // use TCPDF $pdf = new PDFMerger('tfpdf'); // use tFPDF
Output modes
This merger uses verbose parameter names for the various pdf output modes common to the three libraries:
browser(default): send the pdf binary to the browser. The borwser PDF plug-in is used if available.download: send the pdf to the browser and force a file download with the name given.string: outputs the raw binary string.file: save to a local server file with the name given.
Development
This repo is shipped with a docker-compose file so that you don't need a local version of PHP.
Use make commands to install and run tests:
To install dependencies:
make vendor
To run tests:
make tests
WTF?
Yes, why the fork?
I first made a PR to fix the "slice feature", but I figured out I wanted a library with tests and tags. Plus, I wanted to add docker-compose because I do not have any local PHP installed anymore, so I decided to fork it and start with PHP 7.
jmleroux/pdf-merger 适用场景与选型建议
jmleroux/pdf-merger 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 79.21k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 04 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jmleroux/pdf-merger 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jmleroux/pdf-merger 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 79.21k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-28