使用PHP将PDF转换为JPG图像 [英] Convert PDF to JPG image with PHP

查看:904
本文介绍了使用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);

?>

这篇关于使用PHP将PDF转换为JPG图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆