tags:

views:

995

answers:

2

I am on Windows XP.

I am using ImageMagick (MagickNet) to convert PDF's to TIF's.

My problem is that when I load a PDF in the MagicNet.Image object, it doesn't throw an error, but when I look at the properties, it is obvious it didn't load the PDF (it doesn't contain any data).

My guess is that ImageMagick isn't talking to Ghostscript.

Any ideas?

--I forgot to mention, I did install Ghost Script, and I added its bin folder to the PATH

A: 

Did you make sure to install Ghostscript? It's not included by default with the ImageMagick packages.

davr
+1  A: 

Maybe you've already done something like this, but to make sure that you've got the problem isolated to ImageMagick and GhostScript (as opposed to MagickNet, which is just a wrapper), can you see if ImageMagick's command-line convert.exe is able to convert your PDF to TIFF? I've never seen convert.exe fail to do something that can be done by an API-based methodology (I haven't used MagickNet, but I've used the convert.exe utility extensively, and used the ImageMagickObject COM DLL via interop). For a simple test, it should be as simple as:

c:\PATH_TO_IMAGEMAGICK\convert YourInput.pdf YourOutput.tif

If that works, your ImageMagick and GhostScript installations are basically OK, and something needs to be done in MagickNet or your app; if it doesn't work, there's something wrong with your ImageMagick and/or GhostScript installation/configuration.

If it turns out that MagickNet is the problem, using ImageMagickObject to convert via interop isn't too bad. You just create one instance, then call "convert" on it as if it were a static method with parameters that are pretty much the same as the ones for command line convert.exe:

ImageMagickObject.MagickImage img = new MagickImage();

object[] parms = new object[2];
parms[0] = "YourInput.pdf";
parms[1] = "YourOuput.tif";
img.Convert(ref parms);
kcrumley