POSTSCRIPT DELEGATED FAILED!

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
dishelt
Posts: 6
Joined: 2013-04-23T12:06:46-07:00
Authentication code: 6789

POSTSCRIPT DELEGATED FAILED!

Post by dishelt »

IS THERE ANY SOLUTION FOR POSTSCRIPT DELEGATED ERROR?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: POSTSCRIPT DELEGATED FAILED!

Post by Bonzo »

Probably; but with the information you have given I doubt anyone will be able to help!
dishelt
Posts: 6
Joined: 2013-04-23T12:06:46-07:00
Authentication code: 6789

Re: POSTSCRIPT DELEGATED FAILED!

Post by dishelt »

Hi, thanks for answer, my problem is when i want to convert pdf to jpg,png, when i want to convert from command line, its sucessfull, but when i do exec() from php it returns: convert.exe: Postscript delegate failed `c:/a/dr.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/682. [1] => convert.exe: no images defined `c:/a/a.jpg' @ error/convert.c/ConvertImageCommand/3106. ) , i hope yo can help me please , thank you
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: POSTSCRIPT DELEGATED FAILED!

Post by magick »

You need to install Ghostscript on your system. ImageMagick leverages Ghostscript to render PDF images.
dishelt
Posts: 6
Joined: 2013-04-23T12:06:46-07:00
Authentication code: 6789

Re: POSTSCRIPT DELEGATED FAILED!

Post by dishelt »

Hi!, i have installed ghost, but i dont know what to do to imagick can recognize ghost, i can do it from console, but from php nope. I hope you can help me!! please!
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: POSTSCRIPT DELEGATED FAILED!

Post by Bonzo »

I assume you are on Windows using something like XAMPP?

From memory you need to install Ghostscript before Imagemagick.

Have you restarted the PC?

Have you tried putting the pdf in the same folder as the code?

Code: Select all

exec("convert dr.pdf dr.jpg");
What command are you using.

Run this code and it will give you a lot of information including a list of deligates Imagemagick knows about.

Code: Select all

<?php
// Build the array of items to be used
exec("convert -list list", $IMarray, $code);

// Start the loop to find and display the results
foreach ($IMarray as $value) {
echo "<br>system (\"convert -list $value\")";
echo "<pre>";
system("convert -list $value");
echo "</pre><hr>";
}
?>
 
dishelt
Posts: 6
Joined: 2013-04-23T12:06:46-07:00
Authentication code: 6789

Re: POSTSCRIPT DELEGATED FAILED!

Post by dishelt »

Hi!, thanks for yoour help:

im using the command: convert c:/dr.pdf c:/a.jpg, i have given permissions.
i have restarted my computer but nothing,
where do i copy my file when i use: "convert dr.pdf dr.jpg"?
i run the code you said:

Code: Select all

// Build the array of items to be used
exec("convert -list list", $IMarray, $code);

// Start the loop to find and display the results
foreach ($IMarray as $value) {
echo "<br>system (\"convert -list $value\")";
echo "<pre>";
system("convert -list $value");
echo "</pre><hr>";
}
and the delegates return:

Code: Select all

system ("convert -list Delegate")
Path: C:\image\delegates.xml

Delegate                Command
-------------------------------------------------------------------------------
        cgm =>          "ralcgm -d ps "%i." "%o." "%u."
        dot =>          "dot -Tps "%i" -o "%o"
        dvi =>          "dvips -q -o "%o" "%i"
        emf =>          "emfplus.exe -format png "%i" "%o"
        eps<=>ps        "C:/gs/bin/gswin64c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 -sDEVICE=pswrite "-sOutputFile=%o" -- "%i"
        eps<=>pdf       "C:/gs/bin/gswin64c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -sDEVICE=pdfwrite "-sOutputFile=%o" -- "%i"
        fig =>          "/usr/X11R6/bin/fig2dev -L ps "%i" "%o"
       gplt =>          "/bin/echo "set size 1.25,0.62     set terminal postscript portrait color solid; set output "%o"; load "%i"" > "%u";gnuplot %u"
        hpg =>          "hp2xx -q -m eps -f "%o" "%i"
       hpgl =>          "hp2xx -q -m eps -f "%o" "%i"
        htm =>          "html2ps -U -o "%o" "%i"
       html =>          "html2ps -U -o "%o" "%i"
       ilbm =>          "ilbmtoppm "%i" > "%o"
        man =>          "groff -man -Tps "%i" > "%o"
mpeg:decode =>          "ffmpeg.exe" -v -1 -i "%i" -vframes %S -vcodec pam -an -f rawvideo -y "%u.pam"
        pdf<=>eps       "C:/gs/bin/gswin64c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -sDEVICE=epswrite "-sOutputFile=%o" -- "%i"
        pdf<=>ps        "C:/gs/bin/gswin64c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 -sDEVICE=pswrite "-sOutputFile=%o" -- "%i"
        pgp =>          "pgpv -fq "%i"
        png<= launch    "cmd.exe /C start "%m" file:///"%i."
        png<= show      "cmd.exe /C start "%m" file:///"%i."
        png<= win       "cmd.exe /C start "%m" file:///"%i."
        pnm<= ilbm      "ppmtoilbm -24if "%i" > "%o"
        pov =>          "povray "+i"%i"" -D0 +o"%o" +fn%q +w%w +h%h +a -q9 -kfi"%s" -kff"%n"     convert -concatenate %o*.png "%o"
         ps<=>pdf       "C:/gs/bin/gswin64c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 -sDEVICE=pdfwrite "-sOutputFile=%o" -- "%i"
         ps<=>eps       "C:/gs/bin/gswin64c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 -sDEVICE=epswrite "-sOutputFile=%o" -- "%i"
       rgba<= rle       "pnmtorle -o "%o" -v "%i"
       scan =>          "scanimage -d "%i" > "%o"
      shtml =>          "html2ps -U -o "%o" "%i"
        sid =>          "mrsidgeodecode -if sid -i "%i" -of tif -o "%o" > "%u"
        svg =>          "rsvg-convert" -o "%o" "%i"
        txt<=>ps        "enscript -o "%o" "%i"
        wmf =>          "emfplus.exe -format png "%i" "%o"
        xcf =>          "xcftopnm "%i" > "%o"
thankyou for yor help!
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: POSTSCRIPT DELEGATED FAILED!

Post by Bonzo »

If you are using a localhost all your files need to be in the localhost folder in the case of XAMPP that is the htdocs folder.

Put the php file you are running and the image into that folder and see what happens with this code:

Code: Select all

exec("convert dr.pdf dr.jpg");
dishelt
Posts: 6
Joined: 2013-04-23T12:06:46-07:00
Authentication code: 6789

Re: POSTSCRIPT DELEGATED FAILED!

Post by dishelt »

it just return: Array ( [0] => convert.exe: Postscript delegate failed `c:/inetpub/wwwroot/a/dr.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/681. [1] => convert.exe: no images defined `c:/inetpub/wwwroot/a/dr.jpg' @ error/convert.c/ConvertImageCommand/3068. )
i dont know what happen :(
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: POSTSCRIPT DELEGATED FAILED!

Post by anthony »

Sounds like the image is not there. Or you are using forward slashes '/' instead of back slashes (perhaps with doubling for PHP).

try replacing the convert command with a directory listing... see if you can actually see the image in that directory.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply