I am trying to convert the first page of a PDF to an image file.
I have the following code:
$im = new imagick('/images/test.pdf[0]'); $im->setImageFormat("jpg"); $page=$im->queryFormats(); echo "<pre>"; print_r ($page); echo "</pre>";
However, I get the error message:
Uncaught exception 'ImagickException' with message 'unable to open image
If I changed:
$im = new imagick('/images/test.pdf[0]');
in
$im = new imagick('/images/test.pdf');
I get the following error:
Uncaught exception 'ImagickException' with message 'Unable to read the file
I'm sure the path to my PDF is correct, and I'm not sure how to solve this. Can anyone help me with this?
source share