jmleroux/pdf-merger 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jmleroux/pdf-merger

最新稳定版本:v2.0.0

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.

统计信息

  • 总下载量: 76.13k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-28