Page 1 of 1

problem trying do convert some pdf's to jpg

Posted: 2009-07-27T12:45:16-07:00
by cescaliante
Hi All,

I've got a problem trying do convert some .pdf's to jpg on my Software.

If I try to upload some smallers pdf works fine, but when I try to upload some biggests pdf my convert didn't work... In my program I call the PHP function exec("convert -quality 100 -scale 600x800 /home/logo411/public_html/upload/extra_files/pdf_4a6dd5040df71.pdf[0] /home/logo411/public_html/upload/image_files/543804039e8f4bb1c00e26143fb90cf0.jpg");

When I tried to connect in my SSH server on SHELL COMMAND LINE works fine ... But when I try to configure a crontab to execute my sh file with this code didn't work too:

#!/bin/sh
convert -quality 100 -scale 600x800 /home/logo411/public_html/upload/extra_files/pdf_4a6dd5040df71.pdf[0] /home/logo411/public_html/upload/image_files/543804039e8f4bb1c00e26143fb90cf0.jpg
exit 0

And I got this message error:

Error: /syntaxerror in readxref
Operand stack:

Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1 3 %oparray_pop 1 3 %oparray_pop 1 3 %oparray_pop --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval--
Dictionary stack:
--dict:1072/1123(ro)(G)-- --dict:0/20(G)-- --dict:93/200(L)-- --dict:93/200(L)-- --dict:97/127(ro)(G)-- --dict:229/230(ro)(G)-- --dict:14/15(L)--
Current allocation mode is local


The pdf file that I'm using. -> <a href="http://rapidshare.com/files/260722522/K ... ml">PDF</a>


Anyone knows what happens ?

Thanks.




This is my ghostscript and imagemagick version:

GNU Ghostscript 7.07 (2003-05-17)
Copyright (C) 2003 artofcode LLC, Benicia, CA. All rights reserved.

Version: ImageMagick 6.4.6 2009-03-31 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC

Re: problem trying do convert some pdf's to jpg

Posted: 2009-07-27T14:33:32-07:00
by Bonzo
What happens if you change the code to this. As from version 6? the image should be called first.

Code: Select all

convert /home/logo411/public_html/upload/extra_files/pdf_4a6dd5040df71.pdf[0]  -scale 600x800  -quality 100 /home/logo411/public_html/upload/image_files/543804039e8f4bb1c00e26143fb90cf0.jpg

Re: problem trying do convert some pdf's to jpg

Posted: 2009-07-28T07:00:52-07:00
by cescaliante
I changed the code, but still happen the same error... What I can't believe is why When i run in a shell command works fine but when the crontab of linux call the same sh file occur this error, Can be the environment variables ?

Thanks :)

Re: problem trying do convert some pdf's to jpg

Posted: 2009-07-28T10:52:31-07:00
by Bonzo
It has been proved before that something that works in shell does not always work in the code and it tends to be an install/path problem.