I read somewhere that TCPDF was capable of s开发者_StackOverflowplitting a PDF into individual pages or images. But there's no mention of this in the documentation or an example of how to do it. Can anyone shed some light on this and if it does't recommend a PHP based one I could use to achieve this.
I'm trying to split a large PDF into high res images.
AFAIK this is not possible with pure TCPDF - you can combine it with fpdi (V 1.2.1 and up!) to achieve this.
Other option to do what you want (with explanations, sample source etc.):
- fpdf together with fpdi
- http://metacpan.org/pod/PDF::Reuse (perl-based)
- http://metacpan.org/pod/PDF::Extract (perl-based)
- http://www.pdflabs.com/docs/pdftk-man-page/ (commandline-based)
Here's an ugly little PHP script I run on the command line to 'explode' large multipage PDF files using pdftk
click to see phpburst php script
I created it about 5 years ago, and I'm sure it could be made much prettier, but it works.
pdftk is unfortunately a bit dated. If you use file encryption from a recent version of Adobe Acrobat you'll have to 'downgrade' any passwords to older levels, or pdftk won't be able to open them. The script here does not include username/password support, but basically if you edit the two lines which read
$command = "pdftk " . $filePath . " cat 3-end output " . $pagesFilePath;
and add
input_pw yourpassword
in front of cat, it will read most encrypted/password protected PDFs.
精彩评论