ps2pdf: PostScript-to-PDF converter

Table of contents

For other information, see the Ghostscript overview.


ps2pdf is a work-alike for the functionality (but not the user interface) of Adobe's Acrobat DistillerTM product: it converts PostScript files to Portable Document Format (PDF) files.

ps2pdf is implemented as a very small command script (batch file) that invokes Ghostscript, selecting a special "output device" called pdfwrite. In order to use ps2pdf, the pdfwrite device must be included as a device list when Ghostscript was built; see the documentation on building Ghostscript for details. The pdfwrite device is currently included in the makefiles for all platforms.


The usage for ps2pdf is

ps2pdf output.pdf

or, on Unix systems and some versions of Windows NT and OS/2


which is equivalent to

ps2pdf input.pdf

The ps2pdf command script assumes that the Ghostscript executable is named gs. On DOS and MS Windows where the command-line executable has a different name, you must edit the script ps2pdf.bat if the DOS executable is named gs386: look for the line that says

set PS2PDFGS=gs

and change it to

set PS2PDFGS=gs386

Note that to run ps2pdf on MS Windows, you need the DOS executable: the Windows Program Manager's "run command doesn't allow you to run .bat files. Alternatively you can run the "console mode" Windows executable by changing the line above to

set PS2PDFGS=gswin32c


The most serious limitation of ps2pdf is that text in any font other than the fourteen Adobe base fonts (Courier, Times, and Helvetica families, Symbol, and Zapf Dingbats) is converted to bitmaps. ps2pdf also may convert strings to bitmaps if the string is in one of those base fonts but contains a character that uses a non-standard encoding.

ps2pdf implements setdistillerparams, and recognizes all of the parameters documented in Adobe Technical Note #5151 except for the ImageDict parameters, but only a subset have an effect:

Parameters    Effective      Ignored

General   ASCII85EncodePages, CompatibilityLevel, CompressPages, CoreDistVersion, LZWEncodePages (see below), UseFlateCompression   AutoRotatePages, ImageMemory, PreserveHalftoneInfo, PreserveOPIComments, PreserveOverprintSettings, TransferFunctionInfo, UCRandBGInfo
General image   AutoFilterxxxImages (see below), xxxImageDepth, xxxImageDownsampleType, xxxImageFilter, xxxImageResolution, DownsamplexxxImages, EncodexxxImages, MonoImageDict   AntiAliasxxxImages, xxxACSImageDict, ColorImageDict, GrayImageDict
Color image   ConvertCMYKImagesToRGB   ColorConversionStrategy, ConvertImagesToIndexed

Because of Unisys's threats regarding the Welch patent, ps2pdf cannot actually use LZW compression: instead, it treats all requests for LZW compression as calling for Flate compression if UseFlateCompression is true and CompatibilityLevel >= 1.2, and ignores them otherwise.

AutoFilterxxxImages doesn't examine the image to decide between JPEG and LZW/Flate compression: it always uses LZW/Flate compression.

Known problems

Some PDF files created using ps2pdf work with Adobe Acrobat on Unix but fail using the MS Windows version of Acrobat. One error that has been observed using versions of Acrobat reader for Windows is: "There was an error processing a page. A rasterizer error occurred." This error has been observed using both Acrobat version 2.1 and the Alpha 2 release of Adobe Amber. (Adobe may have fixed this problem by now.)

ps2pdf does not yet process the new PDF 1.2 (Acrobat 3.x) BP, EP, SP, and OBJ and related pdfmarks. If the application uses these pdfmark commands (and few applications do), some material may be lost from the output file.

Benefits of using ps2pdf

Despite the limitations of ps2pdf, the class of "suitable" documents is a large one. Many users report that the combination of ps2pdf with Acrobat is superior to using a generic PostScript viewer (psview or ghostview), particularly for documents with many pages where the navigational support in PDF files reduces the overhead involved in navigating conventional PostScript documents.

For certain documents, ps2pdf is much faster than Adobe Distiller, and may be suitable for run-time conversions. [George White remarks "I haven't seen a head to head comparison, but Distiller seems slower when running on what should be a faster system (for instance, Distiller on a PPC Mac vs a 25 MHz 68040 NeXT running ps2pdf), so I think this is fair -- also, one of Mark Doyle's postings indicated that Distiller was not fast enough for use as a run-time server. In contrast, I find that I can use ps2pdf as a post-processor during routine document creation."]


Thanks to George N. White III <> of the Ocean Sciences Division of the Bedford Institute of Oceanography in Dartmouth, Nova Scotia for extensive testing of early versions of ps2pdf, and for contributing most of this writeup.

Copyright © 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.

This file is part of Aladdin Ghostscript. See the Aladdin Free Public License (the "License") for full details of the terms of using, copying, modifying, and redistributing Aladdin Ghostscript.

Ghostscript version 5.50, 16 September 1998