LinuxCommandLibrary

ps2ps

Convert PostScript files to simpler PostScript

SYNOPSIS

ps2ps [options] input.ps [output.ps]
ps2ps [options] - [output.ps]

PARAMETERS

-dCompatibilityLevel=N
    Converts the PostScript file to Language Level N (e.g., 1, 2, or 3) for compatibility.

-dEPSCrop
    Crops the output PostScript to the bounding box specified by `%%BoundingBox` comments in the input. Useful for EPS files.

-rX
-rXxY

    Sets the resolution for rendering bitmap images and rasterizing vector graphics within the PostScript output.

-sOutputFile=file
    Specifies the name of the output PostScript file. If omitted, output might go to standard output or a default name.

-dSAFER
    Runs Ghostscript in a safer mode, disabling file system access and shell escapes, recommended for untrusted input.

-dNOPAUSE
    Disables prompts for user interaction (e.g., for page advancement) during processing.

-dBATCH
    Exits after processing the input file, rather than entering an interactive Ghostscript prompt.

DESCRIPTION

ps2ps is a utility designed to convert or optimize PostScript language files. It acts as a convenient front-end to the Ghostscript interpreter, using specific options to read an input PostScript file and write a new PostScript file as output. Its primary uses include converting PostScript files between different language levels (e.g., PostScript Level 2 to Level 1), simplifying complex PostScript, or "distilling" PostScript for specific purposes like embedding in other documents or preparing for older printers. It effectively re-interprets and re-generates the PostScript code, often leading to smaller file sizes or improved compatibility. ps2ps is particularly useful for preparing PostScript files that might have issues with certain viewers or printers, or for reducing the complexity of the PostScript structure.

CAVEATS

ps2ps is a wrapper script around the Ghostscript interpreter, so its behavior depends on the installed Ghostscript version and configuration.
It might not perfectly preserve all PostScript features, especially when down-converting language levels or simplifying complex constructs.
The re-interpretation process can sometimes slightly alter the visual appearance, particularly with unusual fonts or advanced transparency features.

COMMON USE CASES

ps2ps is frequently used to convert PostScript files to an older language level (e.g., PostScript Level 2 to Level 1) for compatibility with legacy printers or viewers. It's also employed to "distill" PostScript, which involves cleaning up and optimizing the file, often reducing its size or fixing minor structural issues, making it suitable for embedding in other documents or for further processing within a workflow.

HISTORY

ps2ps is a component of the Ghostscript suite of utilities. Ghostscript, initially developed by Aladdin Enterprises in the late 1980s, has a long history as a PostScript and PDF interpreter. ps2ps emerged as a convenient script to leverage Ghostscript's capabilities specifically for PostScript-to-PostScript conversions, such as language level conversion and optimization. It has since become a standard utility included with Ghostscript distributions on Unix-like operating systems, with its development mirroring the continuous evolution of Ghostscript itself.

SEE ALSO

gs(1), ps2pdf(1), pdf2ps(1), eps2eps(1)

Copied to clipboard