当前位置 : 主页 > 网络编程 > PHP >

使用使用 imagebrick将pdf转成图片

来源:互联网 收集:自由互联 发布时间:2021-06-30
?php$pdf_file = './pdf/demo.pdf';$save_to = './jpg/demo.jpg'; //make sure that apache has permissions to write in this folder! (common problem)//execute ImageMagick command 'convert' and convert PDF to JPG with applied settingsexec('convert
<?php
$pdf_file   = './pdf/demo.pdf';
$save_to    = './jpg/demo.jpg';     //make sure that apache has permissions to write in this folder! (common problem)
//execute ImageMagick command 'convert' and convert PDF to JPG with applied settings
exec('convert "'.$pdf_file.'" -colorspace RGB -resize 800 "'.$save_to.'"', $output, $return_var);
if($return_var == 0) {              //if exec successfuly converted pdf to jpg
    print "Conversion OK";
}
else print "Conversion failed.<br />".$output;
?>
网友评论