GPL Ghostscript 9.54: Unrecoverable error, exit code 255 - ghostscript

android 9, in adb shell, gs command is good, but in Android Studio ,using Runtime.getRuntime().exec("gs -dNOPAUSE -dNOSAFER -dBATCH -dPARANOIDSAFER -dNOINTERPOLATE -sDEVICE=pxlmono -sOutputFile=11.pcl 22.pdf"); then out error:
GPL Ghostscript 9.50: **** Could not open temporary file /tmp/gs_ptKBo1
GPL Ghostscript 9.50: Could not open the scratch file /tmp/gs_ptKBo1.
./base/gdevp14.c:6710: gs_pdf14_device_push(): Fatal
GPL Ghostscript 9.50: Unrecoverable error, exit code 255
why?thank you!

Related

Is there a way to convert a ps file with ghostscript on Windows without access to the command prompt (cmd)?

I hope that I find the right words to explain my problem. I want to convert an adobe illustrator file to png on a Windows machine where I have no admin rights, no Adobe Illustrator and no access to the cmd.
On my Ubuntu machine I can easily use something like
gs -dNOPAUSE -dBATCH -dEPSFitPage -sDEVICE=png16m -r600 -sOutputFile=test.png ai.ai
But on the Windows Machine I could only install Ghostscript 9.5, which starts into a GUI with a prompt that says "GS>". I never used that, so I just thought that I could write something like
-dNOPAUSE -dBATCH -dEPSFitPage -sDEVICE=png16m -r600 -sOutputFile=test.png ai.ai
But then I get only error messages and after some reading I found out that this interpreter is something different where people can put thinks on a stack or so. Can I somehow use this GS interpreter to do what my gs on the Linux machine did from the shell?
Best regards
Martin
PS: Windows 10 machine, whatelse do you need?

Making Graphic Magick detect Ghostscript for reading pdf on Windows. How to change Ghostscript invocation name on WINDOWS CMD to 'gs'?

My OS is Windows 10. What I did for Ghostscript installation:
I installed Ghostscript (v9.53.3)
I added Ghostscript bin folder location to my environment PATH variable. (C:\Program Files\gs\gs9533\bin)
I restarted my machine.
After this step, my cmd is able to recognize "gswin64c" command. However, "gs" is not recognized. According to Ghostscript examples, the 'gs' command should work. What must I do to make "gs" command recognized? Should I be worried here?
Now, to my Graphics Magick Problem:
I am also using Graphic Magick v1.3.36 (GM) on my machine. My GM does not have the delegate for pdf format even after I installed Ghostscript as mentioned above. As seen in this error which shows every time I try to convert a pdf file to images using gm.
C:\program files\graphicsmagick-1.3.36-q16\gm.exe convert: No decode delegate for this image format (file1.pdf)
My suspicion is that the 'gs' command is not recognized in windows and this is causing GM to be unable to detect Ghostscript.
I would value any suggestion of how to make GM work with ghostscript on my windows machine. Thank you.
UPDATE (5th March 2021)
I found out that changing the command to gs for Ghostscript does not fix GM's pdf delegate problem -- GM still cannot detect Ghostscript!! My suspicion above is wrong.
I was struggling with "GM's pdf delegate problem" too. And I found out that GraphicsMagick uses the Ghostscript Fonts (also known as "URW Fonts") to support the standard set of Adobe Postscript fonts like "Helvetica" and "Times Roman".
Download fonts from here Ghostscript Fonts and paste downloaded folder fonts to the folder with Ghostscript files **C:Program Files\gs\gs9.27**. Here you could find more information.
After installing ghostscript and adding it's path to environment variables and checking it by running gswin64c command.
Update the delegates.mgk file present at C:\Program Files\GraphicsMagick-1.3.34-Q16
The delegates.mgk entry looks somewhat like this by default-
<delegate decode="pdf" encode="eps" mode="bi" command='"#PSDelegate#" -q -dBATCH -dSAFER -dMaxBitmap=50000000 -dNOPAUSE -sDEVICE=#GSEPSDevice# "-sOutputFile=%o" -- "%i" -c quit' />
Note the #PSDelegate# env variable in the command, Just find and replace all the #PSDelegate# with the path gswin64c at all places. After this Graphic Magick will start delegating the tasks to Ghostscript.
Also there's a issue with Graphic Magick v1.3.36 for windows, as mentioned by one of the maintainers here
So try installing an older version.
A similar issue has been explained on this question as well.

Window pops up when batch printing PDF with Ghostscript

I'm using GS 9.15 to batch print some PDF's on a windows machine. This is the command I'm using:
gswin64 -dNoCancel=true -dBATCH -dNOPAUSE -dNOSAFER -q -sDEVICE=ljet4d -sOutputFile=%printer%[printer path] "[pdf path]"
Although this works a window pops up during the print and then closes.
Any way to hide it?
Use gswin64c (command line version) instead of gswin64 (windowed version).

how to invoke fonts dir in ghostscript

I am trying to create a PDF out of a text file with Courier as font and trying to use gswin32c.exe on Windows, but unnable to pass parameters correctly, I think. The gswin32c.exe is the Windows exe of Ghostscript.
Here is my command:
gswin32c.exe -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sFONTPATH="C:\Temp\Fonts2\" -sOUTPUTFILE="C:\Temp\Outputfile.pdf" A1401227.TXT
I don't get a output file, why? How can I trigger the Font, pass the fonts dir?
Not getting an output file is nothign to do with the presence or absence of fonts.
You appear to be sending a text file to GS, which it can't handle (unless this is hand-crafted PostScript).
Most likely you are generating an error, but because you have specified -dBATCH the application exits immediately after displaying it, so you can't see it. Try it without that switch.

Opening Mode(Initial View) for the PDF File is missing Using Ghostscript

To Enable the Fastwebview and PDF version to set 1.7 am using Ghostscript.
Input PDF is having the Opening Mode option, After execute the below command Output PDF is not set with the Opening mode.
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dFastWebView=true -dCompatibilityLevel=1.7 -sOutputFile=output.pdf input.pdf
Kindly let me know how to handle this.

Resources