How to Convert PDF to JPEG Image using PHP

In this tutorial How to Convert PDF to JPEG using imagick extension. I am going to show you how we can convert PDF to JPEG and its a 4 lines script and very easy and simple to understand. ImageMagick software suite allow us to create, read, edit, and compose bitmap images easily. We use PHP imagick extension which is mostly built-in in PHP installation so no need to include any thing.

Steps For How to Convert PDF to JPEG Image using PHP

Step 1. Load imagick extension

$imagick = new Imagick();

 Step 2. Load PDF file

$imagick->readImage('mytest.pdf');

 Step 3. Create Output Image

$imagick->writeImage('output.jpg');

In above all steps all code here

<?php
$imagick = new Imagick();
$imagick->readImage('mytest.pdf');
$imagick->writeImage('output.jpg');
?>

You can found any error like this “Class ‘Imagick’ not found”

And if you like this tutorials please share it with your friends via Email or Social Media.

Leave a Reply

Your email address will not be published. Required fields are marked *