Blog Detail


A Minimal PDF to Image Converter using PHP MuPDF Package cover image

arrow_back A Minimal PDF to Image Converter using PHP MuPDF Package

This package offers a minimal PDF to image converter using MuPDF. It is heavily inspired by spatie/image-to-pdf.


You can install this package via Composer.

$ composer require karkowg/php-mupdf


Convert all the pages to jpg

$pdf = new Karkow\MuPdf\Pdf('path/to/pdf/file');

$pdf->saveAllPagesAsImages('./images/', 'page-');

Convert a single page to png

$pdf = new Karkow\MuPdf\Pdf('path/to/pdf/file');


Please refer to tests/PdfTest.php for other use cases.


A compiled binary (v1.20.0) is available at bin/mutool. If for any reason you want/need to use your own installation, you can do so by passing its path as a 2nd argument to the constructor.

$pdf = new Karkow\MuPdf\Pdf('path/to/pdf/file', 'path/to/mutool');

For more details, Visit Github.

Published at : 02-08-2022

Author : Rizwan Aslam
Rizwan Aslam

I am a highly results-driven professional with 12+ years of collective experience in the grounds of web application development especially in laravel, native android application development in java, and desktop application development in the dot net framework. Now managing a team of expert developers at Codebrisk.

Launch your project

Launch project