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 an error message saying:
Uncaught exception 'ImagickException' with message 'unable to open image
If I change:
$im = new imagick('/images/test.pdf[0]');
to:
$im = new imagick('/images/test.pdf');
I get the following error:
Uncaught exception 'ImagickException' with message 'Unable to read the file
I am sure the path to my PDF is correct and I'm not sure how to solve this. Can anyone help me out with this?