ps2ps2: Converts Postscript Level 3 or PDF into Postscript Level 2

Table of contents

For other information, see the Ghostscript overview.


Overview

ps2ps2 is a script for converting a PDF or a Postscript Level 3 into Postscript Level 2.

ps2ps2 is implemented as a very small command script (batch file) that invokes Ghostscript, selecting a special "output device" called ps2write. In order to use ps2ps2, the ps2write device must be included in the makefile when Ghostscript was compiled; see the documentation on building Ghostscript for details: this is currently the case on all platforms, in Ghostscript as we distribute it.


Usage

The usage for ps2ps2 is

ps2ps2 [options] input.{ps|eps|pdf} output.ps

Options

The options given on the command line may include any switches that may be used with Ghostscript's PostScript and PDF interpreter (see here for a complete list).

Since ps2write makes use of some printer parameters while converting high level objects into Level 2 objects, we strongly recommend to set those values in accordance with the target printer or other output device. In particular, it is important for Output resolution, -dFIXEDMEDIA, and ProcessColorModel to be set correctly.

Important : If the target printer can't handle some font type, ps2write converts such fonts into bitmap fonts, using the resolution specified when ps2write is invoked. Particularly this always happen with CID fonts, which are not Postscript Level 2 objects. Therefore the page device parameter PageSize must match the target printer, and we recommend to set the PageSize entry of the Policies dictionary to 3, in order to provide a proper page scaling in the Postscript interpreter while ps2write is invoked.

More importantly, options passed to ps2ps2 may include -dparameter=value or -sparameter=string switches for setting "distiller parameters", Adobe's documented parameters for controlling the conversion process. The PostScript setdistillerparams and currentdistillerparams operators are also recognized when running ps2ps2, and provide an equivalent way to set these parameters from within the PostScript input file.

The ps2write device handles the same set of distiller parameters as are handled by the pdfwrite device. See the PostScript-to-PDF converter documentation for a complete description of how to use them to control the document conversion.

The following options may be important for ps2ps2 due to the target printer features:

-dPatternImagemask=boolean,
-dMaxClipPathSize=integer,
-dMaxShadingBitmapSize=integer,
-dHaveTrueTypes=boolean.
See PostScript-to-PDF converter for details. The option -dMaxInlineImageSize=integer Must not be used with ps2ps2.

This set includes of the Acrobat Distiller 5 parameters defined in the DistillerParameters document included in the Acrobat SDK. Default values are same as the printer settings defined in PostScript-to-PDF converter, with these exceptions:

/PreserveHalftoneInfo true,
/TransferFunctionInfo /Preserve,
/MaxViewerMemorySize 8000000,
/CompressPages false,
/CompressFonts false,
/ASCII85EncodePages true,

The following ps2write specific option control the output file compression :

-dCompressEntireFile=boolean
When this parameter is true, the LZWEncode and ASCII85Encode filters are being applied to entire output file. In this case CompressPages should be false to exclude a dual compression. When this parameter is false, those filters applies to the initial procset only, if CompressPages is true. Default value is false.

Ghostscript PS2 Printer Description

Not implemented yet.


Controlling the printer behavior

A few options can be used to control the behavior of the printer or program that reads the result of ps2ps2.

-dRotatePages=boolean.
The printer will rotate pages for a better fitting into the real page size. Default value : false. Must be false if -dSetPageSize=true.
-dFitPages=boolean.
The printer will scale pages down to fit into the real page size. The rendering quality may be poor due to the scaling, especially for fonts which Ghostscript had converted into bitmaps (see the ps2write device parameter HaveTrueTypes; See Options about the PageSize entry of the Policies dictionary while the conversion step). Default value : false. Must be false if -dSetPageSize=true.
-dSetPageSize=boolean.
The printer will try to set page size from the job. Only use with printers which can handle random PageSize. Must be false if -dRotatePages=true or -dFitPages=true.

These correspond to keys in the Postscript userdict of the target printer's virtual memory to control its behavior while executing a job generated with ps2ps2.

These keys can be set when executing ps2ps2 (or using the ps2write device), this 'fixes' the resulting behaviour according to which key has been set. If these keys are not defined during conversion, the resulting PostScript will not attempt any form of media selection. In this case the behaviour can then be modified by setting the keys, either by modifying the resulting PostScript or setting the values in some other manner on the target device.


Limitations

Attempting to generate a device independent Postscript Level 2 is a bad idea. Postscript Level 2 data are device dependent by definition. Let Ghostscript know the features of the specific printer as described in Options while generating a printer job.

ps2ps2 does not generate DSC comments.

ps2ps2 provides simplified interface to Ghostscript command line. It is not possible to use -c option or pass multiple source files. For the unrestricted access to the command line parameters, use Ghostscript directly.

gs -q -dSAFER -dNOPAUSE -dBATCH -sOutputFile=file.ps [more options] \
  -sDEVICE=ps2write
source1.pdf [more files]

Copyright © 2000-2006 Artifex Software, Inc. All rights reserved.

This software is provided AS-IS with no warranty, either express or implied. This software is distributed under license and may not be copied, modified or distributed except as expressly authorized under the terms of that license. Refer to licensing information at http://www.artifex.com/ or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.

Ghostscript version 8.64, 3 February 2009