在 PHP 中按页面范围将 PDF 拆分为块 [英] Split PDF into chunks by page range in Php

查看:132
本文介绍了在 PHP 中按页面范围将 PDF 拆分为块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以在浏览了许多包,如 TCPDF、FPDP、DOM2PDF 和许多其他优秀的 php pdf 包后,我在任何允许按页面范围拆分 pdf 文件的包中都找不到此功能.例如,我想从 20-100 或 30-50 页拆分 pdf.或从第 20-100 页的 pdf 创建一个 pdf.那么有没有具有此功能的库?

so after browsing through many packages like TCPDF, FPDP, DOM2PDF and many other excellent php pdf packages, I couldn't find this feature in any packages where it allows to split the pdf file by page range. for example I want to split the pdf from page 20-100 or 30-50. or create a pdf from a pdf ranging from page 20-100. so is there any library that has this feature ?

推荐答案

PDFMerger 有这个功能,我个人喜欢它的简单.

PDFMerger has this functionality, and I personally enjoy its simplicity.

$pdf = new PDFMerger;
$pdf->addPDF('pdf1.pdf','20-100');
$pdf->addPDF('pdf2.pdf','30-50');
$pdf->merge(); // output PDF, you can specify additional parameters here

这篇关于在 PHP 中按页面范围将 PDF 拆分为块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆