PDF Screengrab

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
MikeyMike
Posts: 1
Joined: 2013-11-21T01:08:23-07:00
Authentication code: 6789

PDF Screengrab

Post by MikeyMike »

I've been running the following code with no problems for a little while, but recently it's become a bit buggy.

It should take a grab of the first page of a PDF and creating a JPG for it. It works with some PDFs but not others and I can't work out why.

My code;

Code: Select all

exec("/usr/bin/convert 'sample.pdf' -thumbnail 200 'output.jpg' 2>&1", $array);
Any ideas or help appreciated. Our server is running the version 6.8.7-6.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: PDF Screengrab

Post by Bonzo »

I would try changing 'sample.pdf' to 'sample.pdf[0]' as this should directly select the first page.

Are you getting any errors - what happens if it does not create an image of the first page?
Post Reply