PHPackages                             karkowg/php-mupdf - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. karkowg/php-mupdf

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

karkowg/php-mupdf
=================

Minimal PDF to image converter using MuPDF

v2.0.1(1y ago)202.8k↓29.2%3[1 PRs](https://github.com/dotgksh/php-mupdf/pulls)MITPHPPHP ^8.0

Since Jul 21Pushed 1y ago1 watchersCompare

[ Source](https://github.com/dotgksh/php-mupdf)[ Packagist](https://packagist.org/packages/karkowg/php-mupdf)[ Docs](https://github.com/karkowg/php-mupdf)[ GitHub Sponsors](https://github.com/karkowg)[ RSS](/packages/karkowg-php-mupdf/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (3)Versions (29)Used By (0)

 [![Package banner](https://camo.githubusercontent.com/03ad55e89137fb45317f446d0e654afe8742ec59bef5fb09f6c8eb8b921d067b/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f676b73682532467068702d6d757064662e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6b61726b6f77672532467068702d6d75706466267061747465726e3d776967676c65267374796c653d7374796c655f31266465736372697074696f6e3d4d696e696d616c2b5044462b746f2b696d6167652b636f6e7665727465722b7573696e672b4d75504446266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313735707826696d616765733d70686f746f6772617068267769647468733d31303026686569676874733d313030)](https://camo.githubusercontent.com/03ad55e89137fb45317f446d0e654afe8742ec59bef5fb09f6c8eb8b921d067b/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f676b73682532467068702d6d757064662e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6b61726b6f77672532467068702d6d75706466267061747465726e3d776967676c65267374796c653d7374796c655f31266465736372697074696f6e3d4d696e696d616c2b5044462b746f2b696d6167652b636f6e7665727465722b7573696e672b4d75504446266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313735707826696d616765733d70686f746f6772617068267769647468733d31303026686569676874733d313030)

php-mupdf
=========

[](#php-mupdf)

Minimal PDF to image converter using [MuPDF](https://mupdf.com/docs/mutool.html). Heavily inspired by [spatie/image-to-pdf](https://github.com/spatie/pdf-to-image).

[![Latest Version on Packagist](https://camo.githubusercontent.com/e216b4bc974f40ac63505b652d3b0d1ea71dfdd95fd5a83c2a8cf53131519c61/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b61726b6f77672f7068702d6d757064662e737667)](https://packagist.org/packages/karkowg/php-mupdf)[![GitHub Tests Action Status](https://camo.githubusercontent.com/fd1062b8e0ec6fb37aee253873bfde52a43ce16d74e5705b6270a6919a6e0c5c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6b61726b6f77672f7068702d6d757064662f74657374732e796d6c3f6272616e63683d6d61696e)](https://github.com/dotgksh/php-mupdf/actions?query=workflow%3Atests+branch%3Amain)[![License](https://camo.githubusercontent.com/fa8db701e0ec2ae65605ae57ecfa306f3c793669f61b362b9ef72aa8f7f08514/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6b61726b6f77672f7068702d6d757064662e737667)](https://github.com/dotgksh/php-mupdf/blob/main/LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/2b11110426a6dcd777d18868175390818de28eed9f2a683930ff9f37ef5432e1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b61726b6f77672f7068702d6d757064662e737667)](https://packagist.org/packages/karkowg/php-mupdf)

Install
-------

[](#install)

Via Composer

```
$ composer require karkowg/php-mupdf
```

Usage
-----

[](#usage)

### Convert all the pages to jpg

[](#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

[](#convert-a-single-page-to-png)

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

$pdf
    ->setPage(2)
    ->setOutputFormat('png')
    ->saveImage('./images/page-2.png');
```

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

[mutool](https://mupdf.com/releases/index.html)
-----------------------------------------------

[](#mutool)

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');
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Gustavo Karkow](https://github.com/karkowg)
- \[All Contributors\]\[link-contributors\]

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~31 days

Recently: every ~0 days

Total

28

Last Release

552d ago

Major Versions

v1.1.0 → v2.0.02022-08-12

v2.0.1 → v3.0.0-rc12024-11-08

PHP version history (2 changes)v1.0.0PHP ^7.4|^8.0

v2.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/d1a8ad2e8cad0e133fd62d56397d613fc11abcf9482502d402f2696b45a079d8?d=identicon)[karkowg](/maintainers/karkowg)

---

Top Contributors

[![karkowg](https://avatars.githubusercontent.com/u/14905932?v=4)](https://github.com/karkowg "karkowg (21 commits)")

---

Tags

jpgmupdfmutoolpdfpdf-converterphppdfconvertimagepdf-to-imagekarkowgmutoolmupdfphp-mupdf

###  Code Quality

TestsPest

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/karkowg-php-mupdf/health.svg)

```
[![Health](https://phpackages.com/badges/karkowg-php-mupdf/health.svg)](https://phpackages.com/packages/karkowg-php-mupdf)
```

###  Alternatives

[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M102](/packages/spatie-browsershot)[spatie/pdf-to-image

Convert a pdf to an image

1.4k15.2M64](/packages/spatie-pdf-to-image)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
