![]() ![]() This means that PostScript programs (like viewJPEG.ps) are not permitted to access arbitrary files from disk. However, since version 9.50 the default behaviour of Ghostscript is SAFER, rather than NOSAFER. Assuming all the files are in the right place. If you do this: gswin64c -sDEVICE=pdfwrite -o myFile.pdf "C:\Program Files\gs\gs9.52\lib\viewjpeg.ps" -c "(Test-JPG.jpg) viewJPEG" -f Noice the () surrounding the filename, those are missing from your command lines. If you read viewjpeg.ps it actually has an example usage in the comments: % Usage example: Your third command line doesn't even use viewjpeg.ps so it tries to read the JPEG contents as PostScript which, unsurprisingly, also doesn't work. It also doesn't supply a fully qualified path to viewjpeg.ps so it probably fails unable to find viewjpg.ps. The second command line is essentially the same, just wrapped in "" so it also doesn't work. "Test-JPG.jpg viewJPEG" isn't valid PostScript (there is no operator or function called Test-JPG.jpg" in the PostScript language or the ViewJPEG.ps program), so it doesn't work. Your first command line runs viewjpeg,ps then executes the -c switch, which causes the command line to be read as a PostScript program until the next -f. However, PostScript is a programming language and there are helper PostScript programs supplied with Ghostscript which will read some image formats. It does not (currently) directly read any image formats. ![]() Ghostscript is a PostScript interpreter, it also incorporates a PostScript program which will interpree PDF files. Given it's happening with all jpgs I try, I wonder if there's something I've not set up correctly when installing ghostscript? The closest answer I've found otherwise is this question, however the answer there is the second command above, which doesn't work for me. Tried opening the JPG files in other Windows programs - no problems, so there shouldn't be anything wrong with the files themselves.Tried different JPG files - all give the same error.Tried using ghostscript to combine two PDF files - no problems, so Ghostscript is working to some extent.I've tried the following commands: C:\Users\Work\Desktop>gswin64c -sDEVICE=pdfwrite -o myFile.pdf "C:\Program Files\gs\gs9.52\lib\viewjpeg.ps" -c Test-JPG.jpg viewJPEGĬ:\Users\Work\Desktop>gswin64c -sDEVICE=pdfwrite -o out.pdf viewjpeg.ps -c "Test-JPG.jpg viewJPEG" -fĬ:\Users\Work\Desktop>gswin64c -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=output.pdf Test-JPG.jpg GPL Ghostscript 9.52: Unrecoverable error, exit code 1 runexec2 -nostringval-nostringval-nostringval- 2 %stopped_push -nostringval. runexec2 -nostringval-nostringval-nostringval- 2 %stopped_push -nostringval-nostringval-nostringval- false 1 %stopped_push. I'm trying to use Ghostscript v9.52 on a Windows 10 machine, but I get a blank pdf and this error when I try to convert any jpg file to pdf: Error: /undefined in Test-JPG.jpg
0 Comments
Leave a Reply. |