使用PHP将PDF转换为JPG图像
问题描述:
我正在使用ImageMagik尝试将PDF的内容转换为JPG,但不断获得一个空的jpg。我确保所有测试的perms都是777,所以我有点迷失如何继续。
I am using ImageMagik to try and convert the contents of a PDF to JPG, but keep getting an empty jpg. I have made sure the perms are 777 on everything for testing so I am a little lost how to continue.
这是我正在运行的脚本
<?php
exec('convert testfile.pdf output.jpg', $output, $return_var);
?>
答
试试这个。
<?php
$pdf = 'testfile.pdf';
$save = 'output.jpg';
exec('convert "'.$pdf.'" -colorspace RGB -resize 800 "'.$save.'"', $output, $return_var);
?>