I'm trying to convert a PDF to TIFF but I get the following exception when I try to read the PDF file:
This is my code:
The device in question (pamcmyk32) is available in my installation. I checked with the command gswin32.exe -h:
An unhandled exception of type 'ImageMagick.MagickDelegateErrorException' occurred in Magick.NET.Wrapper-x86.dll
Additional information: MagickTest.vshost.exe: PDFDelegateFailed `[ghostscript library 8.61] -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pamcmyk32" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r300x300" -dUseCIEColor "-sOutputFile=C:/Users/s44u3r/AppData/Local/Temp/magick-10984wkqj-iXpHBFv%d" "-fC:/Users/s44u3r/AppData/Local/Temp/magick-10984AiKiZFwuIAsw" "-fC:/Users/s44u3r/AppData/Local/Temp/magick-10984PjgBvWjAk2Gv"': Unknown device: pamcmyk32
Unrecoverable error: undefined in .uninstallpagedevice
Operand stack:
defaultdevice
@ error/pdf.c/InvokePDFDelegate/271
I have installed Ghostscript 8.71 and I'm using Visual Studio Express 2013 on Windows 7. Magick.NET is version 7.0.0.0018-Q16-x86.This is my code:
MagickReadSettings settings = new MagickReadSettings();
settings.Density = new PointD(300, 300);
using (MagickImageCollection images = new MagickImageCollection())
{
// Add all the pages of the pdf file to the collection
images.Read(fileInfo.FullName, settings);
int page = 1;
foreach (MagickImage image in images)
{
image.Format = MagickFormat.Tiff;
image.Write(fileInfo.Directory.FullName + "\\MyImage.Page" + page + ".tif");
page++;
}
}
The exception occurs at the line images.Read().The device in question (pamcmyk32) is available in my installation. I checked with the command gswin32.exe -h:
GPL Ghostscript 8.71 (2010-02-10)
Copyright (C) 2010 Artifex Software, Inc. All rights reserved.
Usage: gs [switches] [file1.ps file2.ps ...]
Most frequently used switches: (you can use # in place of =)
-dNOPAUSE no pause after page | -q `quiet', fewer messages
-g<width>x<height> page size in pixels | -r<res> pixels/inch resolution
-sDEVICE=<devname> select device | -dBATCH exit after last file
-sOutputFile=<file> select output file: - for stdout, |command for pipe,
embed %d or %ld for page #
Input formats: PostScript PostScriptLevel1 PostScriptLevel2 PostScriptLevel3 PDF
Default output device: display
Available devices:
bbox bit bitcmyk bitrgb bj10e bj200 bjc600 bjc800 bmp16 bmp16m bmp256
bmp32b bmpgray bmpmono bmpsep1 bmpsep8 cdeskjet cdj550 cdjcolor cdjmono
declj250 deskjet devicen display djet500 djet500c eps9high eps9mid epson
epsonc epswrite ibmpro ijs jetp3852 jpeg jpegcmyk jpeggray laserjet lbp8
lj250 ljet2p ljet3 ljet3d ljet4 ljet4d ljetplus m8510 mswindll mswinpr2
necp6 nullpage pamcmyk32 pbm pbmraw pcx16 pcx24b pcx256 pcxcmyk pcxgray
pcxmono pdfwrite pgm pgmraw pgnm pgnmraw pj pjxl pjxl300 pkmraw png16
png16m png256 pngalpha pnggray pngmono pnm pnmraw ppm ppmraw ps2write
psdcmyk psdrgb psmono pswrite pxlcolor pxlmono r4081 spotcmyk st800
stcolor svg t4693d2 t4693d4 t4693d8 tek4696 tiff12nc tiff24nc tiff32nc
tiff48nc tiff64nc tiffcrle tiffg3 tiffg32d tiffg4 tiffgray tifflzw
tiffpack tiffsep tiffsep1 txtwrite uniprint
Search path:
. ; C:\Program Files\ghostscript\gs8.71\lib ;
C:\Program Files\ghostscript\fonts ; %rom%Resource/Init/ ; %rom%lib/ ;
c:/gs/gs8.71/Resource/Init ; c:/gs/gs8.71/lib ;
c:/gs/gs8.71/Resource/Font ; c:/gs/fonts
Initialization files are compiled into the executable.
For more information, see c:/gs/gs8.71/doc/Use.htm.
Please report bugs to bugs.ghostscript.com.
Any ideas what I'm doing wrong?