Skip to content

Instantly share code, notes, and snippets.

@nansenat16
Created August 14, 2012 07:01
Show Gist options
  • Save nansenat16/3347084 to your computer and use it in GitHub Desktop.
Save nansenat16/3347084 to your computer and use it in GitHub Desktop.
Use ImageMagick Convert PDF to PNG with 300dpi
<?php
$pdf_dir='./pdf';
$pdf_dir=realpath($pdf_dir);
$imgcov='"C:\Program Files\ImageMagick-6.7.8-Q16\convert.exe" -density 300 "%s" "%s"';
$f=opendir($pdf_dir);
while(($name=readdir($f))!==false){
$file=$pdf_dir.'\\'.$name;
if(!is_dir($file)){
//echo $file."\n";
$cmd=sprintf($imgcov,$file,$file.'.png');
echo $cmd."\n\n";
exec($cmd);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment