Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand All @@ -18,6 +18,10 @@
{
"name": "Sébastien GARCIA",
"email" : "garcia.sebastien@hotmail.fr"
},
{
"name": "Dave Nash",
"email" : "dave.nash@teaandcode.com"
}
],
"require": {
Expand Down
10 changes: 7 additions & 3 deletions src/Ghostscript/Transcoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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',
Expand All @@ -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);
Expand Down