Hello,
i am trying to convert pdf files (or 1 page of a pdf file) to jpg to make a previeuw of the pdf availeble.
I am doing this with ImageMagick and Ghostscript.
When i do this in a cmd on my windows server it works perfectly.
When i try to do it in a php file it does not do anything.
the command i am using is this:
<?
exec("convert 1.pdf[0] 1.jpg");
?>
could somebody please tel me what i am doing wrong?
convert pdf to jpg
convert pdf to jpg
Last edited by ayahuasca on 2007-02-06T08:51:06-07:00, edited 1 time in total.
Re: convert pdf to jpg
I have not used pdf but as far as I can tell you are trying to convert layer 0 to a jpg ?
Have you tried:
Have you tried:
Code: Select all
exec("convert '1.pdf[0]' 1.jpg");
Re: convert pdf to jpg
Yes i have tried it, doesn't work.
What i am doing is convert page 1 of the pdf to jpg.
I am wondering if exec() does work. Is there mayby a simpel command to check if exec does anything?
What i am doing is convert page 1 of the pdf to jpg.
I am wondering if exec() does work. Is there mayby a simpel command to check if exec does anything?
Re: convert pdf to jpg
Problem solved.
The big secret is to restart your server after completing the installation script of ImageMagick and Ghostscript!
Anywayz, Thanks for trying...
The big secret is to restart your server after completing the installation script of ImageMagick and Ghostscript!
Anywayz, Thanks for trying...
Re: convert pdf to jpg
I'm working on the same thing, trying to get a thumbnail of the first page to show. I'm posting another topic especially for it.
However, as to your problem: add "-debug exception" to your command; it'll show you what's going on. A typical command, with debug looks like this:
$command= "/usr/local/bin/convert -debug exception $precomm $fpfile $comm $tb_fpfile";
exec($command, $convert_array, $code); Note the $convert_array; that's where your debug message is
My guess is that path to "convert" is not correct.
However, as to your problem: add "-debug exception" to your command; it'll show you what's going on. A typical command, with debug looks like this:
$command= "/usr/local/bin/convert -debug exception $precomm $fpfile $comm $tb_fpfile";
exec($command, $convert_array, $code); Note the $convert_array; that's where your debug message is
My guess is that path to "convert" is not correct.
Re: convert pdf to jpg
I had the same problem. I solved it by replacing the exec() command by the popen() function. Maybe this will be your solution as wel.. Good luck!