2017 © Pedro Peláez
 

library ghostscript

image

org_heigl/ghostscript

  • Monday, April 2, 2018
  • by heiglandreas
  • Repository
  • 4 Watchers
  • 9 Stars
  • 3,990 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 6 Forks
  • 2 Open issues
  • 13 Versions
  • 12 % Grown

The README.md

Org_Heigl\Ghostscript

CI Coverage Status Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require, (*1)

A PHP-wrapper to the Ghostscript-CLI, (*2)

The main reason to create this library was to create images from PDF- or Postscript-files. As those Files can be either in RGB- or in CMYK-Colorspace the library tries to handle colors so that the original file and the image are close in color-impression. This is especially important as f.e. PNG is RGB-only while JPEG can be either in RGB or CMYK., (*3)

Multipaged PDF-Files will create multiple images! To not overwrite your image-files the filename will be passed to sprintf to create a filename containing the number of the page. The one and only parameter will be the number of the page., (*4)

Why another Ghostscript-Wrapper?

There are currently 2 other wrappers around that both didn't meet the requirements I had:, (*5)

While the gravitymedia library concentrates more on creating PDFs from input-media the alchemy library is not easily extendable and doesn't handle the parameters to finetune Ghostscript the way I needed them., (*6)

So this library tries to handle most of the important switches to ghostscript and also allows you to extend the library by implementing your own driver using the DriverInterface. More information on that will be shown in the Documentation, (*7)

Installation

This package is best installed using composer., (*8)

composer require org_heigl/ghostscript

Documentation

You can find the documentation for the library at https://heiglandreas.github.io/Org_Heigl_Ghostscript, (*9)

Usage

<?php
use Org_Heigl\Ghostscript\Ghostscript;

// Create the Ghostscript-Wrapper
$gs = new Ghostscript ();

// Set the output-device
$gs->setDevice('jpeg')
// Set the input file
   ->setInputFile('path/to/my/ps/or/pdf/file')
// Set the output file that will be created in the same directory as the input
   ->setOutputFile('output')
// Set the resolution to 96 pixel per inch
   ->setResolution(96)
// Set Text-antialiasing to the highest level
   ->setTextAntiAliasing(Ghostscript::ANTIALIASING_HIGH);
// Set the jpeg-quality to 100 (This is device-dependent!)
   ->getDevice()->setQuality(100);
// convert the input file to an image
if (true === $gs->render()) {
    echo 'success';
} else {
    echo 'some error occured';
}

The Versions

02/04 2018

1.0.0

1.0.0.0

  Sources   Download

22/02 2018

dev-master

9999999-dev

A PHP-Wrapper around the Ghostscript-CLI

  Sources   Download

MIT

The Development Requires

22/02 2018

2.3.1

2.3.1.0

A PHP-Wrapper around the Ghostscript-CLI

  Sources   Download

MIT

The Development Requires

22/02 2018

dev-fixstrpos

dev-fixstrpos

A PHP-Wrapper around the Ghostscript-CLI

  Sources   Download

MIT

The Development Requires

22/02 2018

dev-introduceBuildStages

dev-introduceBuildStages

A PHP-Wrapper around the Ghostscript-CLI

  Sources   Download

MIT

The Development Requires

18/10 2017

2.3.0

2.3.0.0

A PHP-Wrapper around the Ghostscript-CLI

  Sources   Download

MIT

The Development Requires

16/06 2017

dev-feature/allowBetterFilenameControl

dev-feature/allowBetterFilenameControl

A PHP-Wrapper around the Ghostscript-CLI

  Sources   Download

MIT

The Development Requires

16/06 2017

dev-fixCsIssues

dev-fixCsIssues

A PHP-Wrapper around the Ghostscript-CLI

  Sources   Download

MIT

The Development Requires

05/04 2017

2.2.1

2.2.1.0

A PHP-Wrapper around the Ghostscript-CLI

  Sources   Download

MIT

The Development Requires

14/02 2017

2.2.0

2.2.0.0

A PHP-Wrapper around the Ghostscript-CLI

  Sources   Download

MIT

The Development Requires

06/06 2016

2.1.0

2.1.0.0

A PHP-Wrapper around the Ghostscript-CLI

  Sources   Download

MIT

The Development Requires

25/05 2016

2.0.0

2.0.0.0

A PHP-Wrapper around the Ghostscript-CLI

  Sources   Download

MIT

The Development Requires

25/05 2016

2.0.0beta

2.0.0.0-beta

A PHP-Wrapper around the Ghostscript-CLI

  Sources   Download

MIT

The Development Requires