PostScript FAQ/Using Ghostscript

What is Ghostscript and where can I get it?
Ghostscript is a common open source software suite, which is based on an interpreter for Adobe Systems' page description language PostScript and their Portable Document Format (PDF). The suite is developed by Artifex Software and the worldwide community, it is mainly used for the rasterization and rendering of document pages to display or print them, and for the conversion between PostScript and PDF. It includes sets of free PostScript fonts and is used in many third party applications and GUIs.

Details and software downloads see Ghostscript.

How to create compressed CMYK TIFF?
Ghostscript have five TIFF devices for color management. And five TIFF compression devices, which produce only b/w images.

gs -sDEVICE=tif32nc -sOutputFile=tiger.tiff -dEPSCrop examples/tiger.eps

What CJK fonts work on Ghostscript?
Unprotected CJK fonts work on Ghostscript just fine. It is not possible to install CSL (Adobe's CID Support Library) but most PostScript programs don't need it. CSL simulates OCF structures for the jobs that assume OCF fonts on the interpreter and manipulate them directly.

Heisei and KozMin CIDFonts are unprotected proprietary fonts developed by Adobe Systems. The installer that comes with the fonts runs on Mac and installs the fonts to a network printer using PAP protocol. To install the fonts on Ghostscript you need to copy CIDFont files to Resource/CIDFont/ directory.

The CIDFont resources are hidden in resource forks of invisible files in Mac file system. get-mac-cidfont extracts all CIDFont resources from the input file (normally ) to a directory. The program also works on Windows NT.

How to avoid JPEG compression in PDF?
Ghostscript has overly aggressive heuristic identifying the images for JPEG compression. Using  operator one can manually select compression algorithm. Ghostscript accepts most distiller parameters (PDF 0.6M) as command line arguments in addition to  operator.

ps2pdf -dAutoFilterColorImages#false -dColorImageFilter#/FlateEncode \ -dAutoFilterGrayImages#false -dGrayImageFilter#/FlateEncode foo.ps foo.pdf

Ghostscript developers recognize this as a problem. The fix is expected real soon now.

Ghostscript fails with /invalidfont in findfont?
Most likely Ghostscript cannot access any fonts at all. To check what directories are searched for fonts, use gs -h or gswin32c -h

How to create a semi-transparent object?
Adobe introduced semi-transparent objects in PDF 1.4. Many new RIP's (including Ghostscript) accept PDF 1.4 directly. So there is no need for the transparency features in PostScript.


 * Ghostscript supports PDF 1.4 in v. 8.00 and up
 * Adobe CPSI supports PDF 1.4 in v. 3015 and up

Standard PostScript has opaque color model. Newer objects completely obscure the objects underneath but parts of the new object can be excluded from painting by clipping path. On level 3 PostScript a sampled image can be used for clipping another sampled image. On level 2 a similar effect can be achieved by painting pattern color through the image mask.

Very limited transparency effects can be also achieved by overprinting spot colors and pure process colors.

PDF 1.4 interpreter in Ghostscript is implemented in extended PostScript language. The extensions are visible to the regular PostScript files and can be used to the same effect. The interface is partly documented in doc/language.htm. Read the source code for details.

PostScript output interferes with redirected device output.
PostScript files that write to stdout will interfere with device output to stdout. That is why since v.7.04 Ghostscript can assign the PostScript %stdout output to a file, leaving the actual stdout 'clean' for use as device output such as with  or

For instance, to discard PS %stdout output, such as from the '=' operator, when Ghostscript is being used as a filter the correct command line is:

gs -q -sstdout=/dev/null -sOutputFile=- - | ...

With a little help from bash, named pipes can be used in place of regular files, avoiding all stdout-stderr problems.

gs -sDEVICE=pswrite -o >(wc) -c showpage

How to fix a file generated by a pswrite device
Adobe PostScript interpreters and Ghostscript v. 8.55 and higher fail with  on files with non-standard page sizes generated by old versions of Ghostscript with Subversion revisions 1225 to 2334. The affected code executes, which is not allowed by PostScript language.

The following  resource can be installed on the PostScript interpreter to work around the problem. To activate the  you need to copy it to  directory on the printer or host-based interpreter. The PostScript root directory on a host-based interpreter likely to be different from the system root. The file name doesn't matter but  is suggested. For a one-time replacement you can also prepend the file to your job file.

Ghostscript can not run my files
You try to learn postscript but you can not do: $ gs GS>(test.ps)run stack dump from gs here .... Current allocation mode is local Last OS error: Permission denied ... GS> Since version 9.50 additional safety features are active. Now you need: $ gs -dNOSAFER