[RESOLVED] Can't convert from pdf to png

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
letmeconvert
Posts: 3
Joined: 2018-11-27T14:06:57-07:00
Authentication code: 1152

[RESOLVED] Can't convert from pdf to png

Post by letmeconvert »

I am using Win10.

This is my IM version:
"magick --version
Version: ImageMagick 7.0.8-14 Q16 x64 2018-10-24 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype gslib heic jng jp2 jpeg lcms lqr lzma openexr pangocairo png ps raw rsvg tiff webp xml zlib"

If I try to convert with
"magick.exe -density 300 output.pdf output.png"
I just get
"magick.exe: FailedToExecuteCommand `"gswin32c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r300x300" "-sOutputFile=C:/Users/One/AppData/Local/Temp/magick-7932g538CkzkOdAI%d" "-fC:/Users/One/AppData/Local/Temp/magick-7932pIZ3zvgme0fK" "-fC:/Users/One/AppData/Local/Temp/magick-7932MtoegBu23Flb"' (Das System kann die angegebene Datei nicht finden.
) @ error/delegate.c/ExternalDelegateCommand/475.
magick.exe: PDFDelegateFailed `Das System kann die angegebene Datei nicht finden.
' @ error/pdf.c/ReadPDFImage/795."

I tried different filenames and convert, I am also sure there is a output.pdf in the folder I am executing the commands.
What am I missing?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Can't convert from pdf to png

Post by snibgo »

I suspect you haven't installed Ghostscript.
snibgo's IM pages: im.snibgo.com
letmeconvert
Posts: 3
Joined: 2018-11-27T14:06:57-07:00
Authentication code: 1152

Re: Can't convert from pdf to png

Post by letmeconvert »

snibgo wrote: 2018-11-27T14:21:17-07:00 I suspect you haven't installed Ghostscript.
What is that and where do I get it?
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Can't convert from pdf to png

Post by dlemstra »

.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Can't convert from pdf to png

Post by fmw42 »

You have Ghostscript as indicated by gslib

"magick --version
Version: ImageMagick 7.0.8-14 Q16 x64 2018-10-24 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype gslib heic jng jp2 jpeg lcms lqr lzma openexr pangocairo png ps raw rsvg tiff webp xml zlib"

But there have been recent policy changes that restrict reading of PDF files due to a Ghostscript bug that has subsequently been fixed. You may want to download the latest Ghostscript.

To fix the issue you need to edit your policy.xml file

See https://stackoverflow.com/questions/528 ... 3#52863413
letmeconvert
Posts: 3
Joined: 2018-11-27T14:06:57-07:00
Authentication code: 1152

Re: Can't convert from pdf to png

Post by letmeconvert »

Thanks guys.
I installed ghostscript and added the line to policy.xml, and now it works.

Also the ghostscript license doesn't seem to be too bad, every client can just install their own version of ghostscript, so my use case won't break their policy if I understood it correctly.

Im farily new here so I don't know how to set a post to answered if there is a way to do that.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Can't convert from pdf to png

Post by fmw42 »

You just edit your top original post's title. I will do it for you this time.
Post Reply