tony2 tony2 - 1 year ago 135
PHP Question

Convert PDF to JPG image with PHP

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.

Here is the script I am running


exec('convert testfile.pdf output.jpg', $output, $return_var);


Answer Source

Try this.

    $pdf = 'testfile.pdf';
    $save = 'output.jpg';

    exec('convert "'.$pdf.'" -colorspace RGB -resize 800 "'.$save.'"', $output, $return_var);

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download