PDF ( v > 1.5 ) to Image on LINUX
FIRST OF ALL: I know there are a lot of related to开发者_如何学Cpics out there, but none seem to tell me anything new, none seem to work with pdf 1.6, or cost less then 500$ :) )
So, I have many pdf-s on a Linux Machine, they are all > 20 MB large, and all PHP v1.6; I need to convert the first page into a thumbnail
I tried: 1) PHP Libraries out there. None of them work with PDF > 1.5, or cost very much 2) GS + Imagick. Tried the latest version, works only sometimes and takes about 8 minutes per pdf. 3) PDF::EXTRACT or other CPAN PERL modules. Same problem with PDF > 1.5
I preferr a php solution ( although I really doubt there is one ), but a command line solution, java solution, perl solution, c++ solution, I'll set up a cron to do the processing.
Best Regards, Gabriel
You may use evince-thumbnailer
.
It's use is as simple as evince-thumbnailer input.pdf output.png
. You can easily call it from PHP and gather it's output.
Using Ghostscript via the command line, you can interpret any PDF or PS-file, and send it to a "device". A device might be an actual printer, or it might create another file.
Here's an example command to convert the first page of the PDF file "magazine.pdf" to a JPEG image named "cover.jpg", in 250ppi resolution.
$gs -sDEVICE=jpeg -sOutputFile=cover.jpg -dBATCH -dNOPAUSE \
-q -r250 -dFirstPage=1 -dLastPage=1 magazine.pdf
精彩评论