PHPackages                             lukasss93/pdf-to-ppm - 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. lukasss93/pdf-to-ppm

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

lukasss93/pdf-to-ppm
====================

PHP wrapper for the pdftoppm command which is part of poppler-utils.

v1.0.2(3y ago)73.0kMITPHPPHP &gt;=7.3

Since Feb 7Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Lukasss93/pdf-to-ppm)[ Packagist](https://packagist.org/packages/lukasss93/pdf-to-ppm)[ GitHub Sponsors](https://github.com/Lukasss93)[ RSS](/packages/lukasss93-pdf-to-ppm/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

[![](https://camo.githubusercontent.com/ebe4405aa85d915b383976ff5fc33892e29f11ea88edde33f33dd4c6e5256e16/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f7064662d746f2d70706d2e706e673f7468656d653d6461726b267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6c756b6173737339332532467064662d746f2d70706d267061747465726e3d746f706f677261706879267374796c653d7374796c655f31266465736372697074696f6e3d5048502b777261707065722b666f722b7468652b706466746f70706d2b636f6d6d616e642b77686963682b69732b706172742b6f662b706f70706c65722d7574696c73266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313235707826696d616765733d70686f746f6772617068)](https://camo.githubusercontent.com/ebe4405aa85d915b383976ff5fc33892e29f11ea88edde33f33dd4c6e5256e16/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f7064662d746f2d70706d2e706e673f7468656d653d6461726b267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6c756b6173737339332532467064662d746f2d70706d267061747465726e3d746f706f677261706879267374796c653d7374796c655f31266465736372697074696f6e3d5048502b777261707065722b666f722b7468652b706466746f70706d2b636f6d6d616e642b77686963682b69732b706172742b6f662b706f70706c65722d7574696c73266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313235707826696d616765733d70686f746f6772617068)

 [![](https://camo.githubusercontent.com/4d1a92d990bdc4b90d040be12585b646ee50f9770b1bcd66169a4ec1b13e729a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c756b6173737339332f7064662d746f2d70706d)](https://camo.githubusercontent.com/4d1a92d990bdc4b90d040be12585b646ee50f9770b1bcd66169a4ec1b13e729a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c756b6173737339332f7064662d746f2d70706d) [![Packagist Version](https://camo.githubusercontent.com/58099d6cf50eec5fb6d6c30437e90fc4ab9e524cbe2788c14b13a28999a2991f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c756b6173737339332f7064662d746f2d70706d)](https://camo.githubusercontent.com/58099d6cf50eec5fb6d6c30437e90fc4ab9e524cbe2788c14b13a28999a2991f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c756b6173737339332f7064662d746f2d70706d) [![Packagist Downloads](https://camo.githubusercontent.com/2dac7493a3f33f29e238d8933d904628790b6c3ce0e240e7a4319ca7b4b45241/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c756b6173737339332f7064662d746f2d70706d)](https://camo.githubusercontent.com/2dac7493a3f33f29e238d8933d904628790b6c3ce0e240e7a4319ca7b4b45241/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c756b6173737339332f7064662d746f2d70706d) [![GitHub](https://camo.githubusercontent.com/7fbd23c0a119f27e6264457f6de26f2991fc472735ed5bd042af6e41eaa94e52/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6c756b6173737339332f7064662d746f2d70706d)](https://camo.githubusercontent.com/7fbd23c0a119f27e6264457f6de26f2991fc472735ed5bd042af6e41eaa94e52/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6c756b6173737339332f7064662d746f2d70706d) [![](https://camo.githubusercontent.com/3d86407add0c56b47f3fc34b7859078c5c5a3f8494599e6734ab4f26eee367b7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c756b6173737339332f7064662d746f2d70706d2f72756e2d74657374732e796d6c)](https://camo.githubusercontent.com/3d86407add0c56b47f3fc34b7859078c5c5a3f8494599e6734ab4f26eee367b7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c756b6173737339332f7064662d746f2d70706d2f72756e2d74657374732e796d6c) [ ![](https://camo.githubusercontent.com/595abc324b0ae7b5821aaac7080b310a18de8fc314570d52488e75f7665917dd/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6c756b6173737339332f7064662d746f2d70706d3f746f6b656e3d50424f4d353446333857) ](https://codecov.io/gh/Lukasss93/pdf-to-ppm)

**Convert a pdf to an image**
PHP wrapper for the [pdftoppm](http://linux.die.net/man/1/pdftoppm) command which is part of [poppler-utils](http://en.wikipedia.org/wiki/Poppler_(software)).

Requirements
------------

[](#requirements)

Behind the scenes this package leverages [pdftoppm](http://linux.die.net/man/1/pdftoppm). You can verify if the binary installed on your system by issueing this command:

```
which pdftoppm
```

If it is installed it will return the path to the binary.

To install the binary you can use this command on Ubuntu or Debian:

```
apt-get install poppler-utils
```

On a mac you can install the binary using brew

```
brew install poppler
```

If you're on RedHat or CentOS use this:

```
yum install poppler-utils
```

Available packages:

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require lukasss93/pdf-to-ppm
```

Usage
-----

[](#usage)

Converting a pdf to an image is easy.

```
use Lukasss93\PdfToPpm\PdfToPpm;

$pdf = PdfToPpm::create()->setPdf($pathToPdf);
$pdf->saveImage($pathToWhereImageShouldBeStored); // it will save the first page
```

If the path you pass to `saveImage` has the extensions `ppm`, `jpg`, `png` or `tif` the image will be saved in that format. Otherwise the output will be a jpg.

Converting all pdf pages:

```
use Lukasss93\PdfToPpm\PdfToPpm;

$pdf = PdfToPpm::create()->setPdf($pathToPdf);
$pdf->saveAllPagesAsImages($pathToWhereImageShouldBeStored);
```

### Other methods

[](#other-methods)

You can get the total number of pages in the pdf:

```
$pdf->getNumberOfPages(); //returns an int
```

By default the first page of the pdf will be rendered. If you want to render another page you can do so:

```
$pdf->setPage(2)
    ->saveImage($pathToWhereImageShouldBeStored); // it saves the second page
```

You can override the output format:

```
$pdf->setOutputFormat('png')
    ->saveImage($pathToWhereImageShouldBeStored); // the output wil be a png, no matter what
```

You can set the resolution (default: 144):

```
$pdf->setResolution(200); // sets the resolution
```

You can save image to grayscale:

```
$pdf->setGray(true); // sets the grayscale
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security
--------

[](#security)

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

License
-------

[](#license)

The MIT License (MIT). Please see [LICENSE.md](.github/LICENSE.md) file for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 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 ~240 days

Total

3

Last Release

1441d ago

### Community

Maintainers

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

---

Top Contributors

[![Lukasss93](https://avatars.githubusercontent.com/u/4071613?v=4)](https://github.com/Lukasss93 "Lukasss93 (45 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lukasss93-pdf-to-ppm/health.svg)

```
[![Health](https://phpackages.com/badges/lukasss93-pdf-to-ppm/health.svg)](https://phpackages.com/packages/lukasss93-pdf-to-ppm)
```

###  Alternatives

[mpdf/mpdf

PHP library generating PDF files from UTF-8 encoded HTML

4.7k77.1M493](/packages/mpdf-mpdf)[sensiolabs/gotenberg-bundle

A Symfony bundle that provides seamless integration with Gotenberg for generating PDFs and screenshots from various sources (HTML, Markdown, Office documents, URLs) with a clean, builder-based API.

210210.4k2](/packages/sensiolabs-gotenberg-bundle)[pontedilana/php-weasyprint

PHP library allowing PDF generation from an url or a html page. Wrapper for Kozea/WeasyPrint.

761.1M7](/packages/pontedilana-php-weasyprint)

PHPackages © 2026

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