2017 © Pedro PelĂĄez
 

library ghostscript

Ghostscript is an object oriented Ghostscript binary wrapper for PHP.

image

gravitymedia/ghostscript

Ghostscript is an object oriented Ghostscript binary wrapper for PHP.

  • Wednesday, August 17, 2016
  • by pCoLaSD
  • Repository
  • 1 Watchers
  • 5 Stars
  • 260 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 1 Versions
  • 2 % Grown

The README.md

Ghostscript

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads, (*1)

Ghostscript is an object oriented Ghostscript binary wrapper for PHP., (*2)

Requirements

This library has the following requirements:, (*3)

  • PHP 8.0+
  • Ghostscript 9.00+

Installation

Install Composer in your project:, (*4)

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

Require the package via Composer:, (*5)

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

Usage

This is a simple usage example how to convert an input PDF to an output PDF., (*6)

// 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

Clone this repository, install Composer and all dependencies:, (*7)

$ php composer.phar install

Run the test suite:, (*8)

$ php composer.phar test

Generating documentation

Clone this repository, install Composer and all dependencies:, (*9)

$ php composer.phar install

Generate the documentation to the build/docs directory:, (*10)

$ php composer.phar doc

Contributing

Please see CONTRIBUTING for details., (*11)

Credits

License

The MIT License (MIT). Please see License File for more information., (*12)

The Versions

17/08 2016

dev-master

9999999-dev https://github.com/GravityMedia/Ghostscript

Ghostscript is an object oriented Ghostscript binary wrapper for PHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

ghostscript gravitymedia