PHPackages                             gravitymedia/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. gravitymedia/ghostscript

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

gravitymedia/ghostscript
========================

Ghostscript is an object oriented Ghostscript binary wrapper for PHP.

2.4.0(2y ago)30244.8k—6.7%17[1 PRs](https://github.com/GravityMedia/Ghostscript/pulls)MITPHPPHP ^8.0

Since Aug 25Pushed 2y ago1 watchersCompare

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

READMEChangelog (6)Dependencies (6)Versions (9)Used By (0)

Ghostscript
===========

[](#ghostscript)

[![Latest Version on Packagist](https://camo.githubusercontent.com/205fa79a9b4d1cbca89b4816daa1bbf9670616396deeea1448696b2029c6ee4a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f677261766974796d656469612f67686f73747363726970742e737667)](https://packagist.org/packages/gravitymedia/ghostscript)[![Software License](https://camo.githubusercontent.com/194459b7f322331ac3a065327c6200ff8629e64de5cbefc7f4f726aa38e43e1e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f677261766974796d656469612f67686f73747363726970742e737667)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/1cdeaca7016a56248f5aa352cbc0ffabb7c2cf8c780ee7afe33fa1079480850c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f477261766974794d656469612f47686f73747363726970742f63692e79616d6c)](https://github.com/GravityMedia/Ghostscript/actions/workflows/ci.yaml)[![Coverage Status](https://camo.githubusercontent.com/8535ae4dce666f15c2d912db32f44691b3395ebedfeeaf66d3502bb2a36a6996/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f477261766974794d656469612f47686f73747363726970742e737667)](https://scrutinizer-ci.com/g/GravityMedia/Ghostscript/code-structure)[![Quality Score](https://camo.githubusercontent.com/68d6c7c68281434f61029e9992f64647482386f8007048ec000cc3bd08b62b68/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f477261766974794d656469612f47686f73747363726970742e737667)](https://scrutinizer-ci.com/g/GravityMedia/Ghostscript)[![Total Downloads](https://camo.githubusercontent.com/25d332025cdbb214edd3dda0e86eda74c0082b755e8bd87a3911ea9d1076defb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f677261766974796d656469612f67686f73747363726970742e737667)](https://packagist.org/packages/gravitymedia/ghostscript)

Ghostscript is an object oriented Ghostscript binary wrapper for PHP.

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

[](#requirements)

This library has the following requirements:

- PHP 8.0+
- Ghostscript 9.00+

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

[](#installation)

Install Composer in your project:

```
$ curl -s https://getcomposer.org/installer | php
```

Require the package via Composer:

```
$ php composer.phar require gravitymedia/ghostscript:v2.4
```

Usage
-----

[](#usage)

This is a simple usage example how to convert an input PDF to an output PDF.

```
// Initialize autoloader
require_once __DIR__ . '/vendor/autoload.php';

// Import classes
use GravityMedia\Ghostscript\Ghostscript;
use Symfony\Component\Process\Process;

// Define input and output files
$inputFile = '/path/to/input/file.pdf';
$outputFile = '/path/to/output/file.pdf';

// Create Ghostscript object
$ghostscript = new Ghostscript([
    'quiet' => false
]);

// Create and configure the device
$device = $ghostscript->createPdfDevice($outputFile);
$device->setCompatibilityLevel(1.4);

// Create process
$process = $device->createProcess($inputFile);

// Print the command line
print '$ ' . $process->getCommandLine() . PHP_EOL;

// Run process
$process->run(function ($type, $buffer) {
    if ($type === Process::ERR) {
        throw new \RuntimeException($buffer);
    }

    print $buffer;
});
```

Testing
-------

[](#testing)

Clone this repository, install Composer and all dependencies:

```
$ php composer.phar install
```

Run the test suite:

```
$ php composer.phar test
```

Generating documentation
------------------------

[](#generating-documentation)

Clone this repository, install Composer and all dependencies:

```
$ php composer.phar install
```

Generate the documentation to the `build/docs` directory:

```
$ php composer.phar doc
```

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Daniel Schröder](https://github.com/pCoLaSD)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity47

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~196 days

Total

6

Last Release

796d ago

Major Versions

1.0.0 → 2.0.02022-01-18

PHP version history (2 changes)1.0.0PHP ^7.1

2.0.0PHP ^8.0

### Community

Maintainers

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

---

Top Contributors

[![schroedan](https://avatars.githubusercontent.com/u/4107232?v=4)](https://github.com/schroedan "schroedan (19 commits)")[![pionl](https://avatars.githubusercontent.com/u/1878831?v=4)](https://github.com/pionl "pionl (8 commits)")[![BreiteSeite](https://avatars.githubusercontent.com/u/2171105?v=4)](https://github.com/BreiteSeite "BreiteSeite (8 commits)")[![julietgar](https://avatars.githubusercontent.com/u/2846595?v=4)](https://github.com/julietgar "julietgar (7 commits)")[![alexandre-castelain](https://avatars.githubusercontent.com/u/19281292?v=4)](https://github.com/alexandre-castelain "alexandre-castelain (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![wsilva94](https://avatars.githubusercontent.com/u/30603134?v=4)](https://github.com/wsilva94 "wsilva94 (1 commits)")[![fgilio](https://avatars.githubusercontent.com/u/6857732?v=4)](https://github.com/fgilio "fgilio (1 commits)")[![guilhermecfviana](https://avatars.githubusercontent.com/u/17053653?v=4)](https://github.com/guilhermecfviana "guilhermecfviana (1 commits)")

---

Tags

ghostscriptgravitymedia

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M82](/packages/symplify-monorepo-builder)[spatie/typescript-transformer

This is my package typescript-transformer

3706.5M16](/packages/spatie-typescript-transformer)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[shivas/versioning-bundle

Symfony application versioning, simple console command to manage version (with providers e.g. git tag) of your application using Semantic Versioning 2.0.0 recommendations

1121.2M1](/packages/shivas-versioning-bundle)[eclipxe/cfdiutils

PHP Common utilities for Mexican CFDI 3.2, 3.3 &amp; 4.0

141129.9k6](/packages/eclipxe-cfdiutils)[shyim/danger-php

Port of danger to PHP

8544.9k](/packages/shyim-danger-php)

PHPackages © 2026

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