Reputation: 662
I have installed the latest version of ghostscript on windows 7 (gswin64). I am trying to convert PDF from older version to a new version. I need to run the command from the 'CMD' window. I tried running this gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=new-pdf1.5.pdf C:\folder\original.pdf and also tried putting the file path into double quotes like "C:\folder\original.pdf".
It does not work. Can you tell me what I am doing wrong?
Upvotes: 1
Views: 5592
Reputation: 662
I have posted the command I used. Thank you for help KenS in initiating my research. I cannot post the PDF's as it is proprietary content. But it did upgrade the PDF.
gswin64.exe -sDEVICE=pdfwrite -dCompatibilityLevel=1.3 -dNOPAUSE \
-dBATCH -sOutputFile=C:\folder\new.pdf C:\folder\old.pdf
Next issue which I need to figure out: How do I call this process in C# .NET? I need to do the following:
Upload a file using the Upload control (thats simple) Take the stream of the uploaded file and pass the binary stream through ghostscript which will convert the version of the PDF. --> How do I pass a stream through ghostscript? Since Ghostscript needs a file saved on the hard drive and will write it back to the hard drive? It has to be done in the memory stream upon uploading the File?
Upvotes: 1
Reputation: 31141
In what way 'does not work' ? Please state the entire command line, including the input file, the order is important.
Did you get an error ? If so what error ? Did you get anything at all in the back channel ?
Why are you using -dQUIET when trying to debug a problem ? You want all the information Ghostscript can give you about the problem, so drop that.
Please note that Ghostscript does not 'convert' PDF files, and that setting the CompatibilityLevel to 1.5 doesn't really do much. It simply limits the features the pdfwrite device has available to it.
If the input doesn't require higher level features, then the pdfwrite device won't use them. Since your input is a lower version of PDF, it won't use those features and so although the version in the header will be 1.5 the actual content will consist of the lower version features.
You could get the same effect by using a binary-capable editor to change the version in the original PDF file to 1.5.
Upvotes: 1