I have a shell script that I've been using to merge PDFs, and prior to today, it seems to have been working fine.
Now when I run, I get the message: GPL Ghostscript 9.06: Unrecoverable error, exit code 1
It produces a blank PDF instead of the merged PDF. Here is my code:
<?php
$pdf1 = "file_1.pdf";
$pdf2 = "file_2.pdf";
$fileArray= array($pdf1,$pdf2);
$datadir = "/usr/pdf_merge/merged";
$outputName = $datadir."merged_new.pdf";
$cmd = "gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$outputName ";
//Add each pdf file to the end of the command
foreach($fileArray as $file) {
$cmd .= $file." ";
}
$result = shell_exec($cmd);
Any ideas what could be wrong?
I'm running Apache with Debian.
Thanks