I've taken help from the following link:
Conversion PDF to PNG or JPEG is very very slow using ImageMagick
Tried to convert a .pdf
file to .png
from the top answer given to the above question.
When I executed the following command from terminal, it worked.
gs -o /Users/dhiwatdg/Desktop/terror2.png -sDEVICE=pngalpha -dLastPage=1 -quality=200 -r72 /Users/dhiwatdg/Desktop/one.pdf
i.e., my first page of one.pdf
was converted to terror.png
But when I tried to do the same using a php script, it was not working and following is my code:
exec("gs -o /Users/dhiwatdg/Desktop/terror2.png -sDEVICE=pngalpha -dLastPage=1 -quality=200 -r72 /Users/dhiwatdg/Desktop/one.pdf");
I think the server was not able to recognise gs
. How do I sort this out?