1. Go to this page and download the library: Download ttbooking/phpgs library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ttbooking / phpgs example snippets
use Webit\PHPgs\ExecutorBuilder;
use Webit\PHPgs\Input;
use Webit\PHPgs\Output;
use Webit\PHPgs\Options\Options;
use Webit\PHPgs\Options\Device;
/** @var \Webit\PHPgs\Executor $executor */
$executor = ExecutorBuilder::create()->setGhostScriptBinary('/path/to/the/binary/of/gs')->build();
$input = Input::singleFile('/path/to/your/input_file');
$output = Output::create('/path/to/your/tempdir/output.pdf');
// Please note Options class is immutable (every change creates a new instance)
$options = Options::create(Device::pdfWrite())
// set predefined options (see Options class for all predefined options)
->withNoTransparency()
->useCropBox()
->useCIEColor()
// change any option you need
->withOption('-dWhatever', 'value of whatever');
$executor->execute($input, $output, $options);