2

I have been working to create thumbnail for pdf file. I have used below link for installation and configuration of ImageMagick installation and configuration of ImageMagick and code I have used below code to for conversion of pdf file to thumbnail

<?php
 exec("C:/ImageMagick-6.8.0-Q16/convert.exe a.pdf -resize 546x274^ -quality 80 temp.jpg 2>&1", $array);  

?>

It is not converting but it is converting images. The code is

<?php
 exec("C:/ImageMagick-6.8.0-Q16/convert.exe a.jpg -resize 546x274^ -quality 80 temp.jpg 2>&1", $array);  
?>

Can any one please help me to create thumbnail for pdf file .Thanks in advance.

shireasha
  • 151
  • 1
  • 2
  • 10

2 Answers2

0

I use the built in PHP calls on my own server. This works for me.

 if(!file_exists(THUMBS_DIR . $name . "." . $out_format))
    {            
        $im = new imagick();
        $im->setResolution(300,300);
        $im->readImage(ABS_PATH . $path);
        //$im->setImageColorspace(255);
        //$im->adaptiveSharpenImage(2,1);
        //$im->setCompression(Imagick::COMPRESSION_JPEG);
        $im->setCompressionQuality(100);
        $im->resizeImage(700,1000,Imagick::FILTER_LANCZOS,1, TRUE);
        $im->setImageFormat($out_format);
        $im->writeImage(THUMBS_DIR . $name . "." . $out_format);
        $im->clear();
        $im->destroy();
    }
ande8133
  • 11
  • 3
0

A free direct download PDF test file with detailed instructions to solve a "PDF Thumbnail Generation Problem" in TYPO3 CMS is available at Smargasy, Inc. "http://www.smargasy.com/fileadmin/media_data/community/Smargasy_PDF-Thumbnail-Compatibility-Test-File.pdf". The test file helps isolate the problem on systems that use ImageMagick and GhostScript as the image processing and conversion program in a shared hosting environment.

This should also help with your problem since the solution is both the Example PHP scripts and using the example standards compliant PDF file for testing.

Best Regards, Michael Brice