I'm trying to crop a PDF that is purposely being output over sized since the program outputting it doesn't know the size of it's contents. On the FreeBSD system in question there is Ghostscript v7.07 installed. Based on the existing answer on another question (Cropping a PDF using Ghostscript 9.01) and adapting it to v7.07 documentation (http://ghostscript.com/doc/7.07/Readme.htm) I've tried the below replacing the -o with -sOutputFile= since it doens't recognize the -o.
gs \
-dNOPAUSE \
-dBATCH \
-sDEVICE=pdfwrite \
-c "[/CropBox [0 6785 433 7128]" \
-c " /PAGES pdfmark" \
-sOutputFile=testout.pdf \
testin.pdf \
and i've also tried
gs \
-dNOPAUSE \
-dBATCH \
-sDEVICE=pdfwrite \
-dDEVICEWIDTHPOINTS=433 \
-dDEVICEHEIGHTPOINTS=343 \
-dFIXEDMEDIA \
-c "0 6785 translate" \
-c "0 0 433 343 rectclip" \
-sOutputFile=testout.pdf \
testin.pdf \
My problem is that in both cases i just get the below message
**** Unable to open the initial device, quitting.
When searching for that error it mostly seemed to be due to the output file location not having write privileges or something similar to that, but that doesn't appear to be the case because I've chmod my folder to 777. The thing that drove me here is that if i remove the postscript command lines (-c) like below it outputs the testout.pdf file just fine (but obviously not cropped or translated to the correct position).
gs \
-dNOPAUSE \
-dBATCH \
-sDEVICE=pdfwrite \
-sOutputFile=testout.pdf \
testin.pdf \
and
gs \
-dNOPAUSE \
-dBATCH \
-sDEVICE=pdfwrite \
-dDEVICEWIDTHPOINTS=433 \
-dDEVICEHEIGHTPOINTS=343 \
-dFIXEDMEDIA \
-sOutputFile=testout.pdf \
testin.pdf \
I thought maybe 7.07 simply didn't support those commands since it doesn't seem to matter what i put within the -c it always ends up giving that error if the -c is there at all, but it is present in the 7.07 documentation (http://ghostscript.com/doc/7.07/Use.htm#General_switches) and it's not like it's giving me a -c is unknown error, so i'm at a loss. I figure I'm either doing something wrong, or there is something wrong with the ghostsciprt installation or it's dependencies. Any help anyone could give me would be greatly appreciated.