PHPackages                             alanmastro/ghostscript - 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. alanmastro/ghostscript

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

alanmastro/ghostscript
======================

Bugfixed version of Meyfarth/Ghostscript-PHP script

0.4.2(11y ago)02051[1 PRs](https://github.com/alanmastro/Ghostscript-PHP/pulls)MITPHPPHP &gt;=5.3.3

Since Nov 27Pushed 11y ago1 watchersCompare

[ Source](https://github.com/alanmastro/Ghostscript-PHP)[ Packagist](https://packagist.org/packages/alanmastro/ghostscript)[ RSS](/packages/alanmastro-ghostscript/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (8)Used By (0)

Ghostscript PHP driver
======================

[](#ghostscript-php-driver)

[![Build Status](https://camo.githubusercontent.com/dd27df04160f926a8f0ebd5208ad6070926f817b9eb65ab03e79c26fef8520dc/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f616c6368656d792d66722f47686f73747363726970742d5048502e706e67)](http://travis-ci.org/alchemy-fr/Ghostscript-PHP)

API usage
=========

[](#api-usage)

To instantiate Ghostscript driver, the easiest way is :

```
$transcoder = Ghostscript\Transcoder::create();
```

You can customize your driver by passing a `Psr\Log\LoggerInterface` or configuration options.

Available options are :

- `gs.binaries` : the path (or an array of potential paths) to the ghostscript binary.
- `timeout` : the timeout for the underlying process.

```
$transcoder = Ghostscript\Transcoder::create(array(
    'timeout' => 42,
    'gs.binaries' => '/opt/local/gs/bin/gs',
), $logger);
```

To process a file to PDF format, use the `toPDF` method :

Third and fourth arguments are respectively the first page and the number of page to transcode.

```
$transcoder->toPDF('document.pdf', 'first-page.pdf', 1, 1);
```

To render a file to Image, use the `toImage` method :

```
$transcoder->toImage('document.pdf', 'output.jpg');
```

To specify the output resolution and format :

```
# 400 is a good quality for jpeg. Default is 200. Default format is 'png16m'
$transcoder->toImage('document.pdf', 'output.jpg', 400, 'jpeg');
```

Silex service provider :
------------------------

[](#silex-service-provider-)

A [Silex](silex.sensiolabs.org) Service Provider is available, all parameters are optionals :

```
$app = new Silex\Application();
$app->register(new Ghostscript\GhostscriptServiceProvider(), array(
    'ghostscript.configuration' => array(
        'gs.binaries' => '/usr/bin/gs',
        'timeout'     => 42,
    )
    'ghostscript.logger' => $app->share(function () {
        return $app['monolog']; // use Monolog service provider
    }),
));

$app['ghostscript.pdf-transcoder']->toImage('document.pdf', 'image.jpg');
```

License
=======

[](#license)

Released under the MIT License

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80.6% 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 ~125 days

Recently: every ~171 days

Total

7

Last Release

4159d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cff328ecddd20b890ac321fbb27d9c0fc23843e302805b5b777deb85facb113e?d=identicon)[marco.bicchi](/maintainers/marco.bicchi)

---

Top Contributors

[![romainneutron](https://avatars.githubusercontent.com/u/137574?v=4)](https://github.com/romainneutron "romainneutron (29 commits)")[![Meyfarth](https://avatars.githubusercontent.com/u/2035429?v=4)](https://github.com/Meyfarth "Meyfarth (6 commits)")[![joinsrl](https://avatars.githubusercontent.com/u/204360736?v=4)](https://github.com/joinsrl "joinsrl (1 commits)")

---

Tags

pdfghostscript

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/alanmastro-ghostscript/health.svg)

```
[![Health](https://phpackages.com/badges/alanmastro-ghostscript/health.svg)](https://phpackages.com/packages/alanmastro-ghostscript)
```

###  Alternatives

[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

7.3k87.6M273](/packages/barryvdh-laravel-dompdf)[tecnickcom/tcpdf

TCPDF is a PHP class for generating PDF documents and barcodes.

4.5k101.8M468](/packages/tecnickcom-tcpdf)[mpdf/mpdf

PHP library generating PDF files from UTF-8 encoded HTML

4.7k77.1M486](/packages/mpdf-mpdf)[knplabs/knp-snappy

PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage.

4.5k68.3M56](/packages/knplabs-knp-snappy)[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M100](/packages/spatie-browsershot)[smalot/pdfparser

Pdf parser library. Can read and extract information from pdf file.

2.7k34.5M215](/packages/smalot-pdfparser)

PHPackages © 2026

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