Page 1 of 1

POSTSCRIPT DELEGATED FAILED!

Posted: 2013-04-23T12:08:29-07:00
by dishelt
IS THERE ANY SOLUTION FOR POSTSCRIPT DELEGATED ERROR?

Re: POSTSCRIPT DELEGATED FAILED!

Posted: 2013-04-23T12:12:09-07:00
by Bonzo
Probably; but with the information you have given I doubt anyone will be able to help!

Re: POSTSCRIPT DELEGATED FAILED!

Posted: 2013-04-24T07:31:54-07:00
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

Re: POSTSCRIPT DELEGATED FAILED!

Posted: 2013-04-24T09:11:22-07:00
by magick
You need to install Ghostscript on your system. ImageMagick leverages Ghostscript to render PDF images.

Re: POSTSCRIPT DELEGATED FAILED!

Posted: 2013-04-24T11:28:19-07:00
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!

Re: POSTSCRIPT DELEGATED FAILED!

Posted: 2013-04-24T12:10:47-07:00
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>";
}
?>
 

Re: POSTSCRIPT DELEGATED FAILED!

Posted: 2013-04-25T08:02:14-07:00
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!

Re: POSTSCRIPT DELEGATED FAILED!

Posted: 2013-04-25T09:46:27-07:00
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");

Re: POSTSCRIPT DELEGATED FAILED!

Posted: 2013-04-25T12:05:26-07:00
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 :(

Re: POSTSCRIPT DELEGATED FAILED!

Posted: 2013-04-30T23:27:40-07:00
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.