webstack/qpdf
最新稳定版本:v1.2.0
Composer 安装命令:
composer require webstack/qpdf
包简介
QPDF PHP
README 文档
README
This package can be used to merge (some pages of) PDF files into one PDF using the QPDF library.
Installation
composer require webstack/qpdf
Code examples
Combine two PDF files into one
<?php use Webstack\QPDF\QPDF; require('vendor/autoload.php'); QPDF::createInstance() ->addFile('input-1.pdf') ->addFile('input-2.pdf') ->write('output.pdf');
Combine two PDF files into, specifying which pages to use
<?php use Webstack\QPDF\QPDF; require('vendor/autoload.php'); QPDF::createInstance() ->addPages('input-1.pdf', '1-3') ->addPages('input-2.pdf', '4,5') ->write('output.pdf');
Returns the output instead of writing it to a file
<?php use Webstack\QPDF\QPDF; require('vendor/autoload.php'); QPDF::createInstance() ->addFile('input-1.pdf') ->addFile('input-2.pdf') ->output();
Returns the number of pages in a file
<?php use Webstack\QPDF\QPDF; require('vendor/autoload.php'); QPDF::createInstance()->getNumberOfPages('input-1.pdf');
Tests
To run the tests use the following command
vendor/bin/phpunit --bootstrap vendor/autoload.php tests
Prerequisites
This package utilizes the QPDF library and must be installed on te system.
QPDF is a command-line program that does structural, content-preserving transformations on PDF files. It could have been called something like pdf-to-pdf. It also provides many useful capabilities to developers of PDF-producing software or for people who just want to look at the innards of a PDF file to learn more about how they work.
QPDF installation instructions
Ubuntu
sudo apt-get install -y qpdf
MacOS (using homebrew)
brew install qpdf
统计信息
- 总下载量: 56.15k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-10-14