I have a PHP site that requires PDF to image conversion, and we're obviously using imagemagick for it. However, right now we're trying to move to different hosting, and it seems like I will not be able to install imagemagick package on the new hosting to do the same thing as we do now.
So the question is - is there any way to convert PDF to image with either pure PHP means, or with anything else that can be just popped into DOCUMENT_ROOT and do not need to be properly installed into the system.
This is a Linux system, but I have no idea what distribution, and I can't check as my rights in this system are really limited.
thanks Alex.
"[...] requires PDF to image conversion, and we're obviously using imagemagick for it."
This is not obvious at all.
Because ImageMagick cannot convert PDF to images all by itself. It requires to use Ghostscript as its 'delegate'. So you may have installed ImageMagick, but not installed Ghostscript and it will not work.
Vice versa, you could have Ghostscript installed but not ImageMagick -- and you could still easily convert PDF to images. For instance, convert to JPEG with resolution 144 DPI (without specifying one, you'd get 72 DPI):
gs \
-o out.jpg \
-sDEVICE=jpeg \
-r144 \
in.pdf
Also, you are free to install Ghostscript wherever you want.
(BTW: I'd keep my hands off a hosting provider who does not offer a ImageMagick nor Ghostscript installation, let alone not allow to install it yourself...)
On linux systems statically linked things can work without external library dependencies. So if you could get/create a statically linked imagemagick executable, you could use it directly under docroot. Probably it isnt so trivial.
Or you could use remote sites for doing the conversion for you. Like: http://pdf2jpg.net/ (For posting to upload forms like this curl will be usefull.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With