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

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

julietgar/ghostscript
=====================

Ghostscript is an object oriented Ghostscript binary wrapper for PHP. Forked from https://github.com/GravityMedia/Ghostscript

v2.0(4y ago)0291MITPHP ^8.0

Since Apr 11Compare

[ Source](https://github.com/julietgar/Ghostscript)[ Packagist](https://packagist.org/packages/julietgar/ghostscript)[ Docs](https://github.com/julietgar/Ghostscript)[ RSS](/packages/julietgar-ghostscript/feed)WikiDiscussions Synced today

READMEChangelogDependencies (6)Versions (6)Used By (0)

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

[](#ghostscript)

[![Software License](https://camo.githubusercontent.com/194459b7f322331ac3a065327c6200ff8629e64de5cbefc7f4f726aa38e43e1e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f677261766974796d656469612f67686f73747363726970742e737667)](LICENSE.md)[![Quality Score](https://camo.githubusercontent.com/68d6c7c68281434f61029e9992f64647482386f8007048ec000cc3bd08b62b68/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f477261766974794d656469612f47686f73747363726970742e737667)](https://scrutinizer-ci.com/g/GravityMedia/Ghostscript)

Ghostscript is an object oriented Ghostscript binary wrapper for PHP.

Forked from

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 julietgar/ghostscript:v2.0
```

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 Julietgar\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
```

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

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity65

Established project with proven stability

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

Total

2

Last Release

1639d ago

Major Versions

v1.0 → v2.02022-01-07

PHP version history (2 changes)v1.0PHP ^7.1

v2.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2846595?v=4)[Juliet Garcia](/maintainers/julietgar)[@julietgar](https://github.com/julietgar)

---

Tags

pdfghostscriptjulietgar

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k36.7M156](/packages/spatie-browsershot)[knplabs/knp-snappy

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

4.5k72.4M62](/packages/knplabs-knp-snappy)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[pontedilana/php-weasyprint

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

781.2M17](/packages/pontedilana-php-weasyprint)[mostafaznv/pdf-optimizer

PDF optimization tool for PHP and Laravel applications

172166.2k](/packages/mostafaznv-pdf-optimizer)[imal-h/pdf-box

The most advanced, driver-based PDF manipulation library for PHP v3.0. Supports Ghostscript, Chrome Headless (HTML to PDF), OpenSSL/FPDI (Signing), and PDFtk (Forms).

60415.9k](/packages/imal-h-pdf-box)

PHPackages © 2026

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