Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert pdf to jpg using ImageMagick without Ghostscript

I'm trying to convert pdf to jpg using ImageMagick php. It seems that ImageMagick needs Ghostscript to work with pdfs however my shared hosting provider does not allow the installation of Ghostscript since it makes use of shell_exec() and exec().

So my question is. Can I convert pdf to jpg with ImageMagick without Ghostscript. If not is there an alternative. I'm doing this using the wordpress platform fyi.

like image 404
ion Avatar asked Feb 05 '13 10:02

ion


People also ask

Does ImageMagick require ghostscript?

Installation requirements on non-Windows platforms ¶ The amount of file formats supported by Imagick depends entirely upon the amount of formats supported by your ImageMagick installation. For example, Imagemagick requires ghostscript to conduct PDF operations.

Can ImageMagick convert PDF?

ImageMagick is a great customizable tool for converting PDF files to individual image files with a single command.


1 Answers

PDF is not a raster image format it is a special language to describe an image. So to convert it to the raster format you need a RIP (Raster image processor).

ImageMagick uses GhsotScript for that. So you can't do it with ImageMagick without GhostScript. You can use GhostScript to render PDF to JPG from command line running gswin32.exe (even without ImageMagic) or from your software using gsdll32.dll.

Also another way is to use Adobe ActiveX component from your software. Usually it is already installed on Windows with Adobe Acrobat.

Here is a good explanation and many ways to render PDF

like image 65
valex Avatar answered Sep 20 '22 23:09

valex