I`m currently trying to run the readimage() function on PDFs.
Here is the current code:
$image = new Imagick();
$image->readImage($file_to_read);
// etc...
Thing is, most PDFs work fine with this code. But for certain PDFs, PHP just hangs at the function call, throwing no exceptions nor causing a fatal error. Does anybody have an idea as to why or a workaround?
Thanks.
edit: I just ran $ gs -dNOPAUSE -sDEVICE=jpeg -r144 -sOutputFile=p%03d.jpg 8Jun2015.pdf
on the non-working pdf and it converted the image to jpg correctly. But readimage() still doesn't work on the same file.
Turns out I have to specify the file path. The following code works.
If it still doesn't work, you can "clean" the PDF using gs. Something like this: