I am using Ghostscript to compress some large pdf files on rails.So, to kale it work on rails I am using backtick to make it as a system command. Its showing some error like this: GPL Ghostscript 9.15: Unrecoverable error, exit code 1 My code is: input_file = oldpath(myfile) gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=#{newpath(myfile)} input_file
(In reply to shilpi.kayal from comment #0) > I am using Ghostscript to compress some large pdf files on rails.So, to kale > it work on rails I am using backtick to make it as a system command. Its > showing some error like this: > > GPL Ghostscript 9.15: Unrecoverable error, exit code 1 > > My code is: > input_file = oldpath(myfile) > gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=#{newpath(myfile)} > input_file We're going to need to see the input file as well, there's nothing I can say without it.
(In reply to Ken Sharp from comment #1) > (In reply to shilpi.kayal from comment #0) > > I am using Ghostscript to compress some large pdf files on rails. No, you aren't. You may be using Ghostscript to produce a *new* PDF file which has different compression to an existing PDF file, buyt you are not compressing the original file. > > it work on rails I am using backtick to make it as a system command. I have no idea what 'backtick' is, or how to use it, please supply a command line for Ghostscript, not some arcane programming language usage. > > My code is: > > input_file = oldpath(myfile) > > gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=#{newpath(myfile)} > > input_file Actually, this looks like the input and output files are the same, that's not going to work.
Created attachment 11431 [details] This is the input file
This same command is working fine with terminal.
(In reply to shilpi.kayal from comment #4) > This same command is working fine with terminal. Well, then I don't see how I can help you. If the command (which you still haven't supplied) works from the terminal then I cannot reproduce your problem. It seems to me that the problem must lie in your program. Perhaps the command line you are using at the terminal is not the same as the one in your application.
There is a strong chance that the problem is (or is related to) permissions or other environment settings when Ghostscript is called from the rails environment. I would assume, like PHP, the rails environment runs as its own user, so you probably need to look at the permissions available to the "real" user when Ghostscript runs successfully and the user under which the rails environment runs, and assess the differences. The first step would be to look at the GS related environment variable, then at things like read/write permissions for the temp directory, the directory into which you want Ghostscript to write it's output, and the directory (and file) from which you want Ghostscript to read its input. (NOTE: we know about Ghostscript, *not* rails, or php etc etc......)
Since this apparently works from a command line, this is not a Ghostscript bug. If you can find a way to demonstrate the problem which we can reproduce feel free to reopen the bug, remembering to supply the information required.