From b749561cb789b67f18fa800882e63d8fc408d7e9 Mon Sep 17 00:00:00 2001 From: Dave Nash Date: Mon, 30 Mar 2015 11:53:30 +0100 Subject: [PATCH 1/2] Added ability to include multiple input files --- src/Ghostscript/Transcoder.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Ghostscript/Transcoder.php b/src/Ghostscript/Transcoder.php index babd319..0ce5730 100644 --- a/src/Ghostscript/Transcoder.php +++ b/src/Ghostscript/Transcoder.php @@ -51,9 +51,9 @@ public function toImage($input, $destination, $res = 200, $format = 'png16m') } /** - * Transcode a PDF to another PDF + * Transcode PDFs to another PDF * - * @param string $input The path to the input file. + * @param mixed $input The path(s) to the input file(s). * @param string $destination The path to the output file. * @param integer $pageStart The number of the first page. * @param integer $pageQuantity The number of page to include. @@ -64,6 +64,10 @@ public function toImage($input, $destination, $res = 200, $format = 'png16m') */ public function toPDF($input, $destination, $pageStart = null, $pageQuantity = null) { + if (!is_array($input)) { + $input = array($input); + } + $commandParam = array( '-sDEVICE=pdfwrite', '-dNOPAUSE', @@ -76,7 +80,7 @@ public function toPDF($input, $destination, $pageStart = null, $pageQuantity = n $commandParam[] = sprintf('-dFirstPage=%d', $pageStart); $commandParam[] = sprintf('-dLastPage=%d', ($pageStart + $pageQuantity - 1)); } - $commandParam[] = $input; + $commandParam = array_merge($commandParam, $input); try { $this->command($commandParam); From cec4b7fa1eeeb1fc3b99d0766c9c2e571f51915d Mon Sep 17 00:00:00 2001 From: Dave Nash Date: Mon, 30 Mar 2015 12:01:06 +0100 Subject: [PATCH 2/2] Updated composer.json --- composer.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index b9f56cf..c992fd9 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { - "name": "alanmastro/ghostscript", + "name": "ministryofjustice/ghostscript", "type": "library", - "description": "Bugfixed version of Meyfarth/Ghostscript-PHP script", + "description": "Bug-fixed and updated version of Meyfarth/Ghostscript-PHP script", "keywords": ["ghostscript", "pdf"], "license": "MIT", "authors": [ @@ -18,6 +18,10 @@ { "name": "Sébastien GARCIA", "email" : "garcia.sebastien@hotmail.fr" + }, + { + "name": "Dave Nash", + "email" : "dave.nash@teaandcode.com" } ], "require": {