I want to convert a pdf to a series of images using magick++. I currently have this code:
Image * img = new Image();
img->read(Tests+"finance-02-2007-multiples.pdf[0]");
Tests is a variable which contains the folder path. The "[0]" means that I want the first page to read in an image.
However, this code snippet does not work. The exception "Magick::ErrorDelegate" appears. I know that ImageMagick uses GhostScript to render the page. Can it be that i need to do something to enalbe GhostScript in ImageMagick first?
Or has someone an ide how to get the code to work?
Thanks so much!
That error is telling you that cannot find GhostScript on your computer.
In order to read a PDF using Magick, you must have GhostScript installed. Magick++ has a (limited) internal support only for writing a pdf. It actually embeds an image in pdf. The reason is that GhostScript is licenced as GPL and cannot be included in Magick, but fortunately can be used if installed by user :).
Magick checks for a GhostScript via registry. Make sure you have installed a verion of GhostScript and that installation has created one of the keys below in HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE.
"SOFTWARE\GPL Ghostscript",
"SOFTWARE\GNU Ghostscript",
"SOFTWARE\AFPL Ghostscript",
"SOFTWARE\Aladdin Ghostscript"
Hope it helps