I'm currently using php's imagick to convert some PDF to images - This works well for the small detail that the images are 'chopped' during output.
This is due to the difference in information contained on the PDF vs the actual content dimensions.
The PDF reports to be a 612x792 72ppi document, yet when I export an image from it via preview on the mac, the image is 1651x1275 - How is this possible?
Obviously the export is correct as the image is viewed correctly in those dimensions - Could it be that the PDF was simply wrongly encoded where the width and height were mixed up? How can I detect this via code? Also the image export is of a different (much larger) size, roughly twice the size, this leads me to believe some information isn't being read properly by imagick.
Basically I'd like to know if there is a proper way to determine the actual PDF content size, so that the images exported from it are at the best quality possible.
Thanks!
EDIT: (code added)
<?php
$im = new Imagick();
$im->readImage("SomeTest.pdf");
$im->setImageColorspace(255);
$im->setCompression(Imagick::COMPRESSION_JPEG);
$im->setCompressionQuality(60);
$im->setImageFormat('jpeg');
$im->writeImages("SampleImage.jpg");
?>
The pdf used is the following: http://www.pantone.com/pages/MYP_mypantone/software_downloader.aspx?f=3
Also, here is the output of imagick from the identifyImage() function, which seems a bit wrong looking at the file size.
Array
(
[imageName] => /tmp/magick-XXehkI8e
[format] => PDF (Portable Document Format)
[geometry] => Array
(
[width] => 612
[height] => 792
)
[type] => TrueColor
[colorSpace] => RGB
[resolution] => Array
(
[x] => 72
[y] => 72
)
[units] => Undefined
[fileSize] => 50mb
[compression] => Undefined
[signature] => 9426f3fc4f45afd71941435a37d585d01e01d32458f3ca241e72892c2f7f35d5
)