Forum Moderators: coopster

Message Too Old, No Replies

upload PDF and save as images?

         

carsten888

10:05 am on Dec 21, 2008 (gmt 0)

10+ Year Member



I want to build something that requires an pdf to be uploaded and saved as images.

is that possible at all?

coopster

1:46 pm on Dec 23, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You can allow file upload and analyze the file type to try and determine whether or not it is a PDF. Are you saying that you would then like to "scan" the first page of the PDF as an image? Or perhaps all the PDF pages as images?

carsten888

7:10 am on Dec 24, 2008 (gmt 0)

10+ Year Member



I would like to save each page of the pdf as an image to be used for a flippingbook.

coopster

12:45 pm on Dec 24, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



OK, understood. I use the open source package ImageMagick [imagemagick.org] for most all advanced image conversion.

McBlack

9:21 pm on Dec 24, 2008 (gmt 0)

10+ Year Member



I'm not sure if this would work, but try something like this with ImageMagick, as coopster said above.

<?php
exec( "convert input.pdf -size 1024x768 output.png -resize 1024x768" );
?>

of course... assuming you have it installed on your server, which most servers do.

[edited by: McBlack at 9:21 pm (utc) on Dec. 24, 2008]

carsten888

7:51 am on Dec 25, 2008 (gmt 0)

10+ Year Member



I'm not sure if this would work, but try something like this with ImageMagick, as coopster said above.

<?php
exec( "convert input.pdf -size 1024x768 output.png -resize 1024x768" );
?>

of course... assuming you have it installed on your server, which most servers do.

imageMagick should be able to work with pdf's. see: [imagemagick.org...]

I check my php info and on one domain it seems installed. so I run the above code with a input.pdf in the same dir, had the dir on writeble and nothing happens when the file was run. (I was expecting it should create png's in the same dir)