Home » Php » php – Convert pdf to jpg using ImageMagick without Ghostscript

php – Convert pdf to jpg using ImageMagick without Ghostscript

Posted by: admin July 12, 2020 Leave a comment


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.

How to&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