Re: convert PDF to Image with Imagick PHP Module
| From: | Johannes Schlüter | Date: | Fri, 12 Oct 2007 17:03:25 +0000 |
| Subject: | Re: convert PDF to Image with Imagick PHP Module | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-4895@lists.php.net to get a copy of this message | ||
On Fri, 2007-10-12 at 17:39 +0100, Scott MacVicar wrote:
> You either don't have ghostscript installed or its not installed properly.
>
> The code you give works fine for me.
In my tests it worked with some PDF files but not with all while I
couldn't really see a difference. There are, of course, obious reasons,
like a password protection. But I had problems with different documents,
created in the same series, too...
But to your code: I think you have to define the page, something like:
$im->readImage( "./".$uploadfile."[0]" );
for the first page. A really good resource is mikko's blog, see
http://valokuva.org/?p=7
johanns
> Scott
>
> Robert Hassing wrote:
> > Hi
> >
> > Is there a way to convert an PDF to an Image using the Imagick PHP Module
> > (2.0.0)
> >
> > i tried it but an error comes up:
> >
> > the code:
> > $uploadfile="some.pdf";
> > $convertfile=some.jpg";
> >
> > $im = new Imagick();
> > $im->readImage( "./".$uploadfile."" );
> > $im->writeImage( "./".$convertfile."" );
> > $im->destroy();
> >
> > the error:
> >
> > Fatal error: Uncaught exception 'ImagickException' with message 'Postscript
> >
> > delegate failed `./some.pdf'' in
> > /home/orgidee.org/www/admin/content/cms_imke_nieuws.php:17
> > Stack trace: #0 /home/orgidee.org/www/admin/content/cms_imke_nieuws.php(17):
> > Imagick->readimage('/home/orgidee.o...') #1
> > /home/orgidee.org/www/admin/content/cms_imke.php(34):
> > include('/home/orgidee.o...') #2 /home/orgidee.org/www/admin/index.php(150):
> > include('/home/orgidee.o...') #3 {main} thrown in
> > /home/orgidee.org/www/admin/content/cms_imke_nieuws.php on line 17
> >
> > Hope anyone can help me out here
> >
> > Robert