pipook
pipook

Reputation: 27

Convert PDF to TIFF, convert from ImageMagick

I need help to convert a PDF file to TIFF file, I do this with PHP and ImageMagick from Linux, like this

exec('convert -density 110 * -compress LZW out.tiff');

But this sometimes fail, so I need to know the best way to convert a PDF to a TIFF, without lost quality, or if someone knows a better way to do this.

Thanks.

Upvotes: 0

Views: 2047

Answers (1)

Eduardo Salazar
Eduardo Salazar

Reputation: 187

Try Ghostscript, here you have an example.

<?php

$outputTiff = "/var/www/html/document.tiff";
$inputPDF = "/var/www/html/document.pdf";

//Execute the ghost script that takes the PDF as an input and saves it as tiff.
$response = exec("gs -SDEVICE=tiffg4 -r600x600 -sPAPERSIZE=letter -sOutputFile=$outputTiff -dNOPAUSE -dBATCH  $inputPDF");

?>

Upvotes: 1

Related Questions