1

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?

Community
  • 1
  • 1

1 Answers1

0

Please use the following command to check which gs is used by typing this in the terminal:

which gs

This would give you the full path of the executable. In my Ubuntu:

$ which gs
/usr/bin/gs

Hope this helps.

Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252