Plan 9 from Bell Labs’s /usr/web/sources/plan9/sys/src/cmd/gs/doc/Ps2pdf.htm

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>ps2pdf: PostScript-to-PDF converter</title>
<!-- $Id: Ps2pdf.htm,v 1.88 2005/10/20 19:46:23 ray Exp $ -->
<!-- Originally: ps2pdf.txt -->
<link rel="stylesheet" type="text/css" href="gs.css" title="Ghostscript Style">
</head>

<body>
<!-- [1.0 begin visible header] ============================================ -->

<!-- [1.1 begin headline] ================================================== -->

<h1><tt>ps2pdf</tt>: PostScript-to-PDF converter</h1>

<!-- [1.1 end headline] ==================================================== -->

<!-- [1.2 begin table of contents] ========================================= -->

<h2>Table of contents</h2>

<blockquote><ul>
<li><a href="#Overview">Overview</a>
<li><a href="#Usage">Usage</a>
<li><a href="#Orientation">Setting page orientation</a>
<li><a href="#Options">Options</a>
<li><a href="#PDFX">Creating a PDF/X-3 document</a>
<li><a href="#Limitations">Limitations</a>
<li><a href="#PPD">Ghostscript PDF Printer Description</a>
<li><a href="#Problems">Known problems</a>
<li><a href="#Ps2pdf_vs_AD">Comparison of <b><tt>ps2pdf</tt></b> and Acrobat Distiller</a>
<li><a href="#Acknowledgments">Acknowledgments</a>
</ul></blockquote>

<!-- [1.2 end table of contents] =========================================== -->

<!-- [1.3 begin hint] ====================================================== -->

<p>For other information, see the <a href="Readme.htm">Ghostscript
overview</a>.

<!-- [1.3 end hint] ======================================================== -->

<hr>

<!-- [1.0 end visible header] ============================================== -->

<!-- [2.0 begin contents] ================================================== -->

<h2><a name="Overview"></a>Overview</h2>

<b><tt>ps2pdf</tt></b> is a work-alike for nearly all the functionality (but
not the user interface) of Adobe's Acrobat<small><sup>TM</sup></small>
Distiller<small><sup>TM</sup></small> product: it converts PostScript files
to Portable Document Format (PDF) files.

<p>
<b><tt>ps2pdf</tt></b> is implemented as a very small command script (batch
file) that invokes Ghostscript, selecting a special "output device" called
<b><tt>pdfwrite</tt></b>.  In order to use <b><tt>ps2pdf</tt></b>, the
<b><tt>pdfwrite</tt></b> device must be included in the makefile when
Ghostscript was compiled; see the <a
href="Make.htm#Features_and_devices">documentation on building
Ghostscript</a> for details: this is currently the case on all platforms, in
Ghostscript as we distribute it.

<hr>

<h2><a name="Usage"></a>Usage</h2>

<p>
The usage for <b><tt>ps2pdf</tt></b> is

<blockquote><b><tt>
ps2pdf</tt></b> <em>[options] input.[e]ps output.pdf</em>
</blockquote>

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

<blockquote><b><tt>
ps2pdf</tt></b> <em>input.[e]ps</em>
</blockquote>

<p>
which is equivalent to

<blockquote><b><tt>
ps2pdf</tt></b> <em>input.[e]ps input.pdf</em>
</blockquote>

<p>
There are actually several different <b><tt>ps2pdf</tt></b><em>*</em> scripts:
the name <b><tt>ps2pdf</tt></b> above refers to any of them.

<ul>

<li><b><tt>ps2pdf12</tt></b> produces PDF 1.2 output (Acrobat 3-and-later
compatible).

<li><b><tt>ps2pdf13</tt></b> produces PDF 1.3 output (Acrobat 4-and-later
compatible).

<li><b><tt>ps2pdf14</tt></b> produces PDF 1.4 output (Acrobat 5-and-later
compatible).

<li><b><tt>ps2pdf</tt></b> per se currently produces PDF 1.2 output.
However, this may change in the future.  If you care about the compatibility
level of the output, use <b><tt>ps2pdf12</tt></b>, <b><tt>ps2pdf13</tt></b>,
or <b><tt>ps2pdf14</tt></b>, or use the
<b><tt>-dCompatibilityLevel=</tt></b><em>1.x</em> switch in the command
line.

</ul>

<p>
Note that if you specify a value for <b><tt>PDFSETTINGS</tt></b>, this
chooses PDF 1.3 or 1.4 output depending on the value of
<b><tt>PDFSETTINGS</tt></b>: this overrides the output format specified by
the script name.  You can still specify the output format by using
<b><tt>-dCompatibilityLevel=</tt></b> <em>after</em>
<b><tt>-dPDFSETTINGS=</tt></b>.

<p>
All of these scripts actually call a script named <b><tt>ps2pdfwr</tt></b>
or <b><tt>ps2pdfxx</tt></b>.  The Unix <b><tt>ps2pdfwr</tt></b> script
assumes that the Ghostscript executable is named <b><tt>gs</tt></b>; it is
unlikely that you will need to change this.  The DOS and MS Windows
<b><tt>ps2pdfxx.bat</tt></b> script uses the value of the
<b><tt>GSC</tt></b> environment variable, if defined, as the name of the
executable; otherwise the script assumes the executable is named
<b><tt>gswin32c</tt></b>.  So in these environments, if the executable has a
different name, you must set <b><tt>GSC</tt></b> to the name of the
executable.

<hr>

<h2><a name="Orientation"></a>Setting page orientation</h2>

<p>
By default Ghostscript determines viewing page orientation based on the dominant
text orientation on the page. Sometimes, when the page has text in several
orientations or has no text at all, wrong orientation can be selected.

<p>
Acrobat Distiller parameter <b><tt>AutoRotatePages</b></tt> controls the
automatic orientation selection algorithm. On Ghostscript, besides
input stream, Distiller parameters can be given as command line arguments.
For instance: <b><tt>-dAutoRotatePages=/None</b></tt> or
<b><tt>/All</b></tt> or <b><tt>/PageByPage</b></tt>.

<p>
When there is no text on the page or automatic page rotation is set to
<b><tt>/None</b></tt> an orientation value from setpagedevice is used.
Valid values are: <b><tt>0</b></tt> (portrait),
<b><tt>3</b></tt> (landscape), <b><tt>2</b></tt> (upside down),
and <b><tt>1</b></tt> (seascape). The orientation can be set from the
command line as <b><tt>-c "&lt;&lt;/Orientation 3&gt;&gt; setpagedevice"</b></tt>
using Ghostscript directly but cannot be set in <b><tt>ps2pdf</b></tt>.
See <a href="#Limitations">Limitations</a> below.
</pre>

<p>
Ghostscript passes the orientation values from DSC comments to
<b><tt>pdfwrite</b></tt> driver
but they are effectively ignored there. This appears to be consistent with
Distiller 5 behavior.

<hr>

<h2><a name="Options"></a>Options</h2>

<p>
The <em>options</em> in the command line may include any switches that may
be used with Ghostscript's PostScript and PDF interpreter (see <a
href="Use.htm#Switches">here</a> for a complete list), although almost none
of them are useful with <b><tt>ps2pdf</tt></b>.  The following may be
useful:

<dl>

<dt><b><tt>-r</tt></b><em>resolution</em>
<dd>Sets the resolution for pattern fills and for fonts that must be
converted to bitmaps.

<dt><b><tt>-dProcessColorModel=</tt></b><em>device_color_space</em> <dd>Sets
the color space to be used for device-dependent colors in the
output. <em>device_color_space</em> may be <b><tt>/DeviceGray</tt></b>,
<b><tt>/DeviceRGB</tt></b>, or <b><tt>/DeviceCMYK</tt></b>; the default
value is <b><tt>/DeviceRGB</tt></b>.  Note that this does not affect images:
see <a href="#Limitations">Limitations</a> below.

</dl>

<p>
More importantly, <em>options</em> may include
<b><tt>-d</tt></b><em>parameter</em>=<em>value</em> or
<b><tt>-s</tt></b><em>parameter</em>=<em>string</em> switches for setting
"distiller parameters", Adobe's documented parameters for controlling the
conversion process.  The PostScript <b><tt>setdistillerparams</tt></b> and
<b><tt>currentdistillerparams</tt></b> operators are also recognized when
running <b><tt>ps2pdf</tt></b>, and provide an equivalent way to set these
parameters from within the PostScript input file.

<p>
<b><tt>ps2pdf</tt></b> also recognizes the following options:

<dl>

<dt><b><tt>-dCompressFonts=</tt></b><em>boolean</em>
<dd>Defines whether <b><tt>ps2pdf</tt></b> will compress embedded fonts in
the output.  The default value is <b><tt>true</tt></b>; the
<b><tt>false</tt></b> setting is intended only for debugging.

<dt><b><tt>-dMaxInlineImageSize=</tt></b><em>integer</em>
<dd>Specifies the maximum size of an inline image, in bytes. For images larger
than this size, <b><tt>ps2pdf</tt></b> will create an XObject instead of embedding
the image into the context stream.
The default value is <b><tt>4000</tt></b>.
Note that redundant inline images must be embedded each time they occur in the 
document, while multiple references can be made to a single XObject image. Therefore
it may be advantageous to set a small or zero value if the source document is expected
to contain multiple identical images, reducing the size of the generated PDF.

<dt><b><tt>-dPDFSETTINGS=</tt></b><em>configuration</em>
<dd>Presets the "distiller parameters" to one of four predefined settings:

<ul>

<li><b><tt>/screen</tt></b> selects low-resolution output similar to the
Acrobat Distiller "Screen Optimized" setting.

<li><b><tt>/ebook</tt></b> selects medium-resolution output similar to the
Acrobat Distiller "eBook" setting.

<li><b><tt>/printer</tt></b> selects output similar to the Acrobat Distiller
"Print Optimized" setting.

<li><b><tt>/prepress</tt></b> selects output similar to Acrobat Distiller
"Prepress Optimized" setting.

<li><b><tt>/default</tt></b> selects output intended to be useful across a
wide variety of uses, possibly at the expense of a larger output file.

</ul>

</dl>

<p>
The following option controls a conversion into PDF/X-3:
<p>

<dl>
<dt><b><tt>-dPDFX=</tt></b><em>boolean</em>
<dd>Specifies the generated document to follow the PDF/X-3 standard.
When true, a <b><tt>DefaultRGB</b></tt> <b><tt>ColorSpace</b></tt> resource must be defined, and
options <b><tt>NOSUBSTDEVICECOLORS</b></tt>, <b><tt>NOCIE</b></tt> must not be specified.
Default value is <b><tt>false</b></tt>. 
</dl>

<p>

When generating a PDF/X-3 document, Ghostscript performs the following 
special actions to satisfy the PDF/X-3 standard :
<ul>
<li> All fonts are being embedded.
<li> <b><tt>DeviceRGB</b></tt> color space is being substituted with <b><tt>DefaultRGB</b></tt> color space,
which must be defined in the <b><tt>ColorSpace</b></tt> category.
The easiest way is to provide it in the <b><tt>DefaultRGB</b></tt> file in the resource directory. 
<li> <b><tt>DeviceRGB</b></tt> color values are being passed unchanged.
If an user needs an untrivial color adjustment, an untrivial <b><tt>DefaultRGB</b></tt> color space to be 
defined.
<li> Transfer functions and halftone phases are being skipped.
<li> <b><tt>/PS pdfmark</b></tt> interpretes the <b><tt>DataSource</b></tt> stream or file.
</ul>    


<p>
The following options control a conversion into PDF 1.2:
<p>

<dl>

<dt><b><tt>-dPatternImagemask=</tt></b><em>boolean</em>
<dd>With <b><tt>CompatibilityLevel &LT 1.3 </b></tt> it specifies whether the target viewer
handles <b><tt>ImageMask</b></tt> with a pattern color. Some old viewers,
such as Ghostscript 3.30 fail with such constructs.
Seting this option to false, one can get more compatibility,
but the mask interpolation is lost.
With <b><tt>CompatibilityLevel &GT= 1.3 </b></tt> this option is being ignored.
Default value is <b><tt>false</b></tt>.

<dt><b><tt>-dMaxClipPathSize=</tt></b><em>integer</em>
<dd>Specifies the maximum number of elements in the clipping path
that the target viewer can handle. This option is used only with 
<b><tt>CompatibilityLevel &LT 1.3 </b></tt> and <b><tt>PatternImagemask=false</tt></b>,
and only when converting a mask into a clipping path.
If the clipping path exceeds the specified size,
the masked image and the clipping path is being decomposed into smaller images.
The value of the option counts straight path segments
(curved segments are not used for representing a mask).
Default value is <b><tt>12000</b></tt>.

<dt><b><tt>-dMaxShadingBitmapSize=</tt></b><em>integer</em>
<dd>With <b><tt>CompatibilityLevel &LT 1.3 </b></tt> it specifies 
the maximum number of bytes allowed for representing a shading as a bitmap.
If a shading exceeds this value, the resolution of the output bitmap
is being reduces to fit into the specified frame.
Note that the number of bytes depends on the number of color components
in <b><tt>ProcessColorModel</b></tt>, assumes 8 bits per sample,
and doesn't account an image compression or filtering.
Also note that reducing the resolution results unsmooth shading boundaries.

With <b><tt>CompatibilityLevel &GT= 1.3 </b></tt> this option is being ignored.
Default value is <b><tt>256000</b></tt>.
For the best quality one can set the maximal integer value,
but the output file size may dramatically increase.
Therefore the user should choose a compromise value.

<dt><b><tt>-dHaveTrueTypes=</tt></b><em>boolean</em>
<dd>With <b><tt>CompatibilityLevel &LT 1.3 </b></tt> it specifies 
whether the target viewer can handle TrueType fonts.
If not, TrueType fonts are being converted into raster fonts
with resolution specified in </b></tt>HWResolution</b></tt>.
With <b><tt>CompatibilityLevel &GT= 1.3 </b></tt> this option is being ignored.
Default value is <b><tt>true</b></tt>.

</dl>

<p>
The following option controls a conversion into PDF 1.3:
<p>

<dl>

<dt><b><tt>-dHaveTransparency=</tt></b><em>boolean</em>
<dd>With <b><tt>CompatibilityLevel &GT= 1.4 </b></tt> it specifies 
whether the target viewer can handle PDF 1.4 transparency objects.
If not, transparency objects are being converted into plain images.
Default value is <b><tt>true</b></tt>.

</dl>

<a name="Encryption"></a>
The following switches are used for creating encrypted documents :

<dl>
<dt><b><tt>-sOwnerPassword=</tt></b><em>string</em>
<dd>Defines that the document be encrypted with the specified 
owner password.
</dl>

<dl>
<dt><b><tt>-sUserPassword=</tt></b><em>string</em>
<dd>Defines the user password for opening the document.
If empty, the document can be opened with no password,
but the owner password is required to edit it.
</dl>

<dl>
<dt><b><tt>-dPermissions=</tt></b><em>number</em>
<dd>Defines the PDF permissions flag field. Negative values are allowed
to represent unsigned integers with the highest bit set. See the PDF
Reference manual for the meaning of the flag bits.
</dl>

<dl>
<dt><b><tt>-dEncryptionR=</tt></b><em>number</em>
<dd>Defines the encryption method revision number - either 2 or 3.
</dl>

<dl>
<dt><b><tt>-dKeyLength=</tt></b><em>number</em>
<dd>Defines the length (in bits) of the encryption key.
Must be a multiple of 8 in the interval [40, 128].
If the length isn't 40, <b><tt>-dEncryptionR</tt></b> must be 3.
</dl>


<p>
<b><tt>ps2pdf</tt></b> recognizes all of the Acrobat Distiller 5 parameters
defined in the DistillerParameters document included in the 
<a href="http://partners.adobe.com/public/developer/acrobat/sdk/index.html">Acrobat SDK</a>.
Cells in the table
containing '=' mean that the value of the parameter is the same as in the
"default" column.

<blockquote><table cellpadding=0 cellspacing=0>
<tr valign=bottom>
	<th align=left>Parameter name
	<td>&nbsp;&nbsp;&nbsp;&nbsp;
	<th align=left>Notes
	<td>&nbsp;&nbsp;
	<th align=left>default
	<td>&nbsp;&nbsp;
	<th align=left>screen
	<td>&nbsp;&nbsp;
	<th align=left>ebook
	<td>&nbsp;&nbsp;
	<th align=left>printer
	<td>&nbsp;&nbsp;
	<th align=left>prepress
<tr>	<td colspan=13><hr>
<tr valign=top><td><b><tt>AlwaysEmbed</tt></b><td><td><td><td>[]<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>AntiAliasColorImages</tt></b><td><td><a href="#note_0">(0)</a><td><td>false<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>AntiAliasGrayImages</tt></b><td><td><a href="#note_0">(0)</a><td><td>false<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>AntiAliasMonoImages</tt></b><td><td><a href="#note_0">(0)</a><td><td>false<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>ASCII85EncodePages</tt></b><td><td><td><td>false<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>AutoFilterColorImages</tt></b><td><td><a href="#note_1">(1)</a><td><td>true<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>AutoFilterGrayImages</tt></b><td><td><a href="#note_1">(1)</a><td><td>true<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>AutoPositionEPSFiles</tt></b><td><td><a href="#note_0">(0)</a><td><td>true<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>AutoRotatePages</tt></b><td><td><td><td>/PageByPage<td><td>/PageByPage<td><td>/All<td><td>/None<td><td>/None
<tr valign=top><td><b><tt>Binding</tt></b><td><td><a href="#note_0">(0)</a><td><td>/Left<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>CalCMYKProfile</tt></b><td><td><a href="#note_0">(0)</a><td><td>()<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>CalGrayProfile</tt></b><td><td><a href="#note_0">(0)</a><td><td>()<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>CalRGBProfile</tt></b><td><td><a href="#note_0">(0)</a><td><td>()<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>CannotEmbedFontPolicy</tt></b><td><td><a href="#note_0">(0)</a><td><td>/Warning<td><td>/Warning<td><td>/Warning<td><td>/Warning<td><td>/Error
<tr valign=top><td><b><tt>ColorACSImageDict</tt></b><td><td><td><td><a href="#note_7">(note 7)</a><td><td><a href="#note_10">(note 10)</a><td><td><a href="#note_10">(note 10)</a><td><td><a href="#note_8">(note 8)</a><td><td><a href="#note_9">(note 9)</a>
<tr valign=top><td><b><tt>ColorConversionStrategy</tt></b><td><td><a href="#note_0">(0</a>,<a href="#note_6">6)</a><td><td>/LeaveColorUnchanged<td><td>/sRGB<td><td>/sRGB<td><td>/UseDeviceIndependentColor<td><td>/LeaveColorUnchanged
<tr valign=top><td><b><tt>ColorImageDepth</tt></b><td><td><td><td>-1<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>ColorImageDict</tt></b><td><td><td><td><a href="#note_7">(note 7)</a><td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>ColorImageFilter</tt></b><td><td><td><td>/DCTEncode<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>ColorImageDownsampleThreshold</tt></b><td><td><td><td>1.5<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>ColorImageDownsampleType</tt></b><td><td><a href="#note_3">(3)</a><td><td>/Subsample<td><td>/Average<td><td>/Bicubic<td><td>/Bicubic<td><td>/Bicubic
<tr valign=top><td><b><tt>ColorImageResolution</tt></b><td><td><td><td>72<td><td>72<td><td>150<td><td>300<td><td>300
<tr valign=top><td><b><tt>CompatibilityLevel</tt></b><td><td><td><td>1.4<td><td>1.3<td><td>1.4<td><td>1.4<td><td>1.4
<tr valign=top><td><b><tt>CompressPages</tt></b><td><td><td><td>true<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>ConvertCMYKImagesToRGB</tt></b><td><td><td><td>false<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>ConvertImagesToIndexed</tt></b><td><td><a href="#note_0">(0)</a><td><td>false<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>CoreDistVersion</tt></b><td><td><td><td>4000<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>CreateJobTicket</tt></b><td><td><a href="#note_0">(0)</a><td><td>false<td><td>false<td><td>false<td><td>true<td><td>true
<tr valign=top><td><b><tt>DefaultRenderingIntent</tt></b><td><td><td><td>/Default<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>DetectBlends</tt></b><td><td><a href="#note_0">(0)</a><td><td>true<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>DoThumbnails</tt></b><td><td><a href="#note_0">(0)</a><td><td>false<td><td>false<td><td>false<td><td>false<td><td>true
<tr valign=top><td><b><tt>DownsampleColorImages</tt></b><td><td><td><td>false<td><td>true<td><td>true<td><td>false<td><td>false
<tr valign=top><td><b><tt>DownsampleGrayImages</tt></b><td><td><td><td>false<td><td>true<td><td>true<td><td>false<td><td>false
<tr valign=top><td><b><tt>DownsampleMonoImages</tt></b><td><td><td><td>false<td><td>true<td><td>true<td><td>false<td><td>false
<tr valign=top><td><b><tt>EmbedAllFonts</tt></b><td><td><td><td>true<td><td>false<td><td>true<td><td>true<td><td>true
<tr valign=top><td><b><tt>EmitDSCWarnings</tt></b><td><td><a href="#note_0">(0)</a><td><td>false<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>EncodeColorImages</tt></b><td><td><td><td>true<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>EncodeGrayImages</tt></b><td><td><td><td>true<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>EncodeMonoImages</tt></b><td><td><td><td>true<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>EndPage</tt></b><td><td><a href="#note_0">(0)</a><td><td>-1<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>GrayACSImageDict</tt></b><td><td><td><td><a href="#note_7">(note 7)</a><td><td><a href="#note_7">(note 7)</a><td><td><a href="#note_10">(note 10)</a><td><td><a href="#note_8">(note 8)</a><td><td><a href="#note_9">(note 9)</a>
<tr valign=top><td><b><tt>GrayImageDepth</tt></b><td><td><td><td>-1<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>GrayImageDict</tt></b><td><td><td><td><a href="#note_7">(note 7)</a><td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>GrayImageDownsampleThreshold</tt></b><td><td><td><td>1.5<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>GrayImageDownsampleType</tt></b><td><td><a href="#note_3">(3)</a><td><td>/Subsample<td><td>/Average<td><td>/Bicubic<td><td>/Bicubic<td><td>/Bicubic
<tr valign=top><td><b><tt>GrayImageFilter</tt></b><td><td><td><td>/DCTEncode<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>GrayImageResolution</tt></b><td><td><td><td>72<td><td>72<td><td>150<td><td>300<td><td>300
<tr valign=top><td><b><tt>ImageMemory</tt></b><td><td><a href="#note_0">(0)</a><td><td>524288<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>LockDistillerParams</tt></b><td><td><td><td>false<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>LZWEncodePages</tt></b><td><td><a href="#note_2">(2)</a><td><td>false<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>MaxSubsetPct</tt></b><td><td><td><td>100<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>MonoImageDepth</tt></b><td><td><td><td>-1<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>MonoImageDict</tt></b><td><td><td><td><<K -1>><td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>MonoImageDownsampleThreshold</tt></b><td><td><td><td>1.5<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>MonoImageDownsampleType</tt></b><td><td><td><td>/Subsample<td><td>/Average<td><td>/Bicubic<td><td>/Bicubic<td><td>/Bicubic
<tr valign=top><td><b><tt>MonoImageFilter</tt></b><td><td><td><td>/CCITTFaxEncode<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>MonoImageResolution</tt></b><td><td><td><td>300<td><td>300<td><td>300<td><td>1200<td><td>1200
<tr valign=top><td><b><tt>NeverEmbed</tt></b><td><td><td><td><a href="#note_11">(note 11)</a><a href="#note_12">(note 12)</a><td><td><a href="#note_11">(note 11)</a><a href="#note_12">(note 12)</a><td><td><a href="#note_11">(note 11)</a><a href="#note_12">(note 12)</a><td><td>[]<a href="#note_12">(note 12)</a><td><td>[]<a href="#note_12">(note 12)</a>
<tr valign=top><td><b><tt>OffOptimizations</tt></b><td><td><td><td>0<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>OPM</tt></b><td><td><td><td>1<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>Optimize</tt></b><td><td><a href="#note_0">(0</a>,<a href="#note_5">5)</a><td><td>false<td><td>true<td><td>true<td><td>true<td><td>true
<tr valign=top><td><b><tt>ParseDSCComments</tt></b><td><td><td><td>true<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>ParseDSCCommentsForDocInfo</tt></b><td><td><td><td>true<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>PreserveCopyPage</tt></b><td><td><a href="#note_0">(0)</a><td><td>true<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>PreserveEPSInfo</tt></b><td><td><a href="#note_0">(0)</a><td><td>true<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>PreserveHalftoneInfo</tt></b><td><td><td><td>false<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>PreserveOPIComments</tt></b><td><td><a href="#note_0">(0)</a><td><td>false<td><td>false<td><td>false<td><td>true<td><td>true
<tr valign=top><td><b><tt>PreserveOverprintSettings</tt></b><td><td><td><td>false<td><td>false<td><td>false<td><td>true<td><td>true
<tr valign=top><td><b><tt>sRGBProfile</tt></b><td><td><a href="#note_0">(0)</a><td><td>()<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>StartPage</tt></b><td><td><a href="#note_0">(0)</a><td><td>1<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>SubsetFonts</tt></b><td><td><td><td>true<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>TransferFunctionInfo</tt></b><td><td><a href="#note_4">(4)</a><td><td>/Preserve<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>UCRandBGInfo</tt></b><td><td><td><td>/Remove<td><td>/Remove<td><td>/Remove<td><td>/Preserve<td><td>/Preserve
<tr valign=top><td><b><tt>UseFlateCompression</tt></b><td><td><a href="#note_2">(2)</a><td><td>true<td><td>=<td><td>=<td><td>=<td><td>=
<tr valign=top><td><b><tt>UsePrologue</tt></b><td><td><a href="#note_0">(0)</a><td><td>false<td><td>=<td><td>=<td><td>=<td><td>=
</table></blockquote>

<p>
<a name="note_0">(note 0)</a>
This parameter can be set and queried, but currently has no effect.

<p>
<a name="note_1">(note 1)</a>
Currently, <b><tt>AutoFilterxxxImages</tt></b> doesn't examine the image to
decide between JPEG and LZW or Flate compression: it always uses 
Flate compression.  If you want to force JPEG compression, use
<b><tt>-dAutoFilterxxxImages=false</tt></b>.

<p>
<a name="note_2">(note 2)</a>
Because of Unisys's threats regarding the Welch patent,
<b><tt>ps2pdf</tt></b> does not actually use LZW compression: instead, it
treats all requests for LZW compression as calling for Flate compression.
Concomitantly, <tt>UseFlateCompression</tt> is treated as always on, and
the value of this parameter is ignored as with note 0. Now that the patent
has expired, we could change this should it become worthwhile.

<p>
<a name="note_3">(note 3)</a>
The <b><tt>xxxDownsampleType</tt></b> parameters can also have the value
/Bicubic (a Distiller 4 feature), which is currently treated as equivalent
to /Average.

<p>
<a name="note_4">(note 4)</a>
Currently, the transfer function is always applied.  If the corresponding
parameter is set to <b><tt>/Preserve</tt></b>, the function setting is also
copied into the PDF file.

<p>
<a name="note_5">(note 5)</a>
Optimization (linearization) is implemented with a separate program,
<b><tt>pdfopt</tt></b> <em>input.pdf</em> <em>output.pdf</em>; the
<b><tt>Optimize</tt></b> parameter has no effect.

<p>
<a name="note_6">(note 6)</a>
Currently, colors for images and shadings are left in the color space
specified in the PostScript input, except for
<b><tt>ConvertCMYKImagesToRGB</tt></b>; the current color in the graphics
state (used for fill, stroke, text, and imagemask) is always converted to
the color space specified by the current value of
<b><tt>ProcessColorModel</tt></b>. The intended behavior is the same as for
Acrobat Distiller, except that if <b><tt>ColorConversionStrategy</tt></b> is
set to <b><tt>/UseDeviceDependentColor</tt></b>, colors are converted to the
color space specified by <b><tt>ProcessColorModel</tt></b> rather than
always to <b><tt>/DeviceRGB</tt></b>.

<p>
<a name="note_7">(note 7)</a>
 The default image parameter dictionary is
<blockquote><b><tt>
<< /QFactor 0.9 /Blend 1 /HSamples [2 1 1 2] /VSamples [2 1 1 2] >>
</tt></b></blockquote>

<p>
<a name="note_8">(note 8)</a>
The printer ACS image parameter dictionary is
<blockquote><b><tt>
<< /QFactor 0.4 /Blend 1 /ColorTransform 1 /HSamples [1 1 1 1] /VSamples [1 1 1 1] >>
</tt></b></blockquote>

<p>
<a name="note_9">(note 9)</a>
The prepress ACS image parameter dictionary is
<blockquote><b><tt>
<< /QFactor 0.15 /Blend 1 /ColorTransform 1 /HSamples [1 1 1 1] /VSamples [1 1 1 1] >>
</tt></b></blockquote>

<p>
<a name="note_10">(note 10)</a>
The screen and ebook ACS image parameter dictionary is
<blockquote><b><tt>
<< /QFactor 0.76 /Blend 1 /ColorTransform 1 /HSamples [2 1 1 2] /VSamples [2 1 1 2] >>
</tt></b></blockquote>

<p>
<a name="note_11">(note 11)</a>
The default, screen, and ebook settings never embed the 14 standard fonts
(Courier, Helvetica, and Times families, Symbol, and ZapfDingbats).

<p>
<a name="note_12">(note 12)</a>
<b><tt>NeverEmbed</tt></b> can include CID font names.
If a CID font is substituted in <b><tt>lib/cidfmap</tt></b>,
the substitute font name is used when the CID font is embedded,
and the original CID font name is used when it is not embedded.
<b><tt>NeverEmbed</tt></b> should always specify the original CID font 
name.

<hr>

<h2><a name="PPD"></a>Ghostscript PDF Printer Description</h2>
<p>
To assist with creating a PostScript file suitable for conversion
to PDF, ghostscript includes <a href="../lib/ghostpdf.ppd">ghostpdf.ppd</a>, 
a PostScript Printer Description (PPD) file.
This allows some <a href="#Options">distiller parameters</a>
to be set when a PostScript file is generated.

<h3>Windows XP or 2000</h3>
<p>
To install a "Ghostscript PDF" printer on Windows XP, 
select the Windows Control Panel, 
Printers and Faxes, 
Add a Printer, 
Local Printer, 
Use port FILE: (Print to File),
Have Disk..., 
select the directory containg 
<a href="../lib/ghostpdf.ppd">ghostpdf.ppd</a> 
and
<a href="../lib/ghostpdf.inf">ghostpdf.inf</a>,
select "Ghostscript PDF", 
Replace existing driver (if asked),
and answer the remaining questions appropriately.
After installing, open the "Ghostscript PDF" properties,
select the Device Settings tab, 
set "Mimimum Font Size to Download as Outline" to 0 pixels.
<p>
To set distiller parameters, select the "Ghostscript PDF" 
Printing Preferences, then the Advanced button.
The PDF settings are under "Printer Features".

<hr>

<h2><a name="PDFX"></a>Creating a PDF/X-3 document</h2>

<p>

To create a PDF/X-3 document from a Postscript or a PDF file, you should :

<ul>
<li> Specify the <b><tt>pdfwrite</b></tt> device or use the <b><tt>ps2pdf</b></tt> script.
<li> Specify the <b><tt>-dPDFX</b></tt> option. It provides the document conformity 
     and forces <b><tt>-dCompatibilityLevel=1.3</b></tt>.
<li> Specify <b><tt>-sProcessColorModel=DeviceGray</b></tt> or <b><tt>-sProcessColorModel=DeviceCMYK</b></tt>
     (<b><tt>DeviceRGB</b></tt> is not allowed).
<li> Specify the <b><tt>-dUseCIEColor</b></tt> option if necessary (see below).
<li> Specify a PDF/X definition file before running the input document.
     It provides additional information to be included into the output document.
     A sample PDF/X definition file may be found in <b><tt>gs/lib/PDFX_def.ps</b></tt>.
<li> Provide an ICC profile and specify it in the PDF/X definition file
     as explained below. Rather PDF/X-3 standard defines the ICC profile
     as optional, we could not get it working with  the PDF/X-3 Inspector freeware.
<li> Provide a <b><tt>DefaultRGB</b></tt> resource file in the ColorSpace resource category.
     Either define it in the PDF/X definition file, or provide
     a definition of <b><tt>gs/Resource/ColorSpace/DefaultRGB</b></tt> .
     Rather <b><tt>gs/Resource/ColorSpace/DefaultRGB</b></tt> is usually 
     distributed with Ghostscript, its contents is not necessarily satisfy your needs, see below.
</ul>

<p>
As mentioned above, the PDF/X definition file provides a special information,
which the PDF/X-3 standard requires. You can find a sample file in
<b><tt>gs/lib/PDFX_def.ps</b></tt>, and edit it according to your needs.
The file follows Postscript syntax and uses the operator <b><tt>pdfmark</b></tt>
to pass the special information. For your comfort 
we marked editable lines in the sample file with the comment <b><tt>% Customize</b></tt>.
They are explained below.

<dl>
<dt><b><tt>ICCProfile</tt></b> <em>string</em>
<dd>Defines a file name of an ICC profile file to be included into the output document. 
You may specify either an absolute file name, or a relative
path fronm the current directory.
</dl>

<dl>
<dt><b><tt>Title</tt></b> <em>string</em>
<dd>Defines the document title.
</dl>

<dl>
<dt><b><tt>Info</tt></b> <em>string</em>
<dd>Defines an <b><tt>Info</tt></b> value for the output intent dictionary.
</dl>

<dl>
<dt><b><tt>OutputCondition</tt></b> <em>string</em>
<dd>Defines an <b><tt>OutputCondition</tt></b> value for the output intent dictionary.
</dl>


<dl>
<dt><b><tt>OutputConditionIdentifier</tt></b> <em>string</em>
<dd>Defines an <b><tt>OutputConditionIdentifier</tt></b> value for the output intent dictionary.
</dl>

<p>
Rather the PDF/X-3 standard requires colors to be adjusted at the
document generation time, Ghostscript <em>does not</em> perform any
special color conversion. Either colors to be adjusted in advance,
or a proper color conversion to be specified in <b><tt>/DefaultGray</b></tt>,
<b><tt>DefaultRGB</b></tt>,  <b><tt>DefaultCMYK</b></tt> resources of the  
<b><tt>ColorSpace</b></tt> resource category,
and the <b><tt>-dUseCIEColor</b></tt> option to be specified
to remap device colors into CIE colors. 
The choice of the ICC profile is also the user's responsibility.

<p>Please note that if a graphic object can't embed into the output format,
Ghostscript converts it into low level objects, using a device color space
specified in the <b><tt>ProcessColorModel</b></tt> option.
If you need to adjust those resulting colors, you may substitute
them with CIE colors, <em>running Ghostscript at second time </em>.
Performing both actions in a single pass is a subject of further improvements.

<p>Ghostscript distribution does not contain an ICC profile to be used
for creating a PDF/X-3 document. Users should either create an appropriate one themselves,
or use one from a public domain, or create one with the PDF/X-3 inspector freeware.
<p>

Here is a sample command line to invoke Ghostscript for generating a PDF/X-3 document :
<blockquote><b><tt>
gs -dPDFX -dBATCH -dNOPAUSE -dNOOUTERSAVE -dUseCIEColor -sDEVICE=pdfwrite -sOutputFile=out-x3.pdf PDFX_def.ps input.ps
</tt></b></blockquote>

<p>
<hr>

<h2><a name="Limitations"></a>Limitations</h2>

<p>
<b><tt>ps2pdf</tt></b> will sometimes convert PostScript constructs to
lower-level ones, even if a higher-level construct is available.  For
example, if the PostScript file uses <b><tt>charpath</tt></b> to set a
clipping path consisting of text, <b><tt>ps2pdf</tt></b> will write the
clipping path as a path in the PDF file, rather than as text, even though
PDF is able to express clipping with text.  This is only a performance
issue, and will be improved incrementally over time.

<p>
Some applications, such as HIGZ, produce PostScript files that use
ridiculously large coordinates.  On such files, <b><tt>ps2pdf</tt></b> may
cause a <b><tt>limitcheck</tt></b> error.  If this occurs, try reducing the
default internal resolution of 720 dpi by using the <b><tt>-r</tt></b>
switch, e.g., <b><tt>ps2pdf&nbsp;-r300&nbsp;somefile.ps</tt></b>.

<p>
<b><tt>ps2pdf</tt></b> ignores the PDF 1.3 (Acrobat 4.x) pdfmarks related to
document content structure: <b><tt>StRoleMap</tt></b>,
<b><tt>StClassMap</tt></b>, <b><tt>StPNE</tt></b>,
<b><tt>StBookmarkRoot</tt></b>, <b><tt>StPush</tt></b>,
<b><tt>StPop</tt></b>, <b><tt>StPopAll</tt></b>, <b><tt>StBMC</tt></b>,
<b><tt>StBDC</tt></b>, <b><tt>EMC</tt></b>, <b><tt>StOBJ</tt></b>,
<b><tt>StAttr</tt></b>, <b><tt>StStore</tt></b>, <b><tt>StRetrieve</tt></b>,
<b><tt>NamespacePush</tt></b>, <b><tt>NamespacePop</tt></b>, and
<b><tt>NI</tt></b>.  While this causes some structural information to be
omitted from the output file, the displayed and printed output are normally
not affected.

<p>
<b><tt>ps2pdf</tt></b> currently has only very limited support for PDF 1.4.
It writes out the blend mode, constant alpha, and text knockout graphics
state parameters, and it handles images with soft masks, but it does not
handle transparency groups, or soft masks in the graphics state.  (Note that
there is no standard way to specify any of these things in PostScript, so
these statements only apply when the input file is already a PDF 1.4 file.)

<p>
<b><tt>ps2pdf</tt></b> provides simplified interface to Ghostscript
command line. It is not possible to use <tt><b>-c</tt></b> option or pass
multiple source files. For the unrestricted access to the command line
parameters, use Ghostscript directly.

<blockquote><b><tt>
gs -q -dSAFER -dNOPAUSE -dBATCH -sOutputFile=file.pdf </tt></b><em>[more options]</em><b><tt> \<br>
&nbsp;&nbsp;-sDEVICE=pdfwrite -c .setpdfwrite -f </b></tt><em>source1.ps [more files]</em>
</blockquote>

See <a href="Language.htm#.setpdfwrite">Language.htm</a> for details 
of the <tt>.setpdfwrite</tt> operator.
<hr>

<h2><a name="Problems"></a>Known problems</h2>

<p>
Distiller parameters should only be saved by <b><tt>save</tt></b> and
restored by <b><tt>restore</tt></b>, but they are also saved by
<b><tt>gsave</tt></b> and restored by <b><tt>grestore</tt></b>.

<p>
Changing the value of the <b><tt>CompressPages</tt></b> parameter after any
marks have been made on the page may cause a crash.

<hr>

<h2><a name="Ps2pdf_vs_AD"></a>Comparison of <b><tt>ps2pdf</tt></b> and
Acrobat Distiller</h2>

<p>
According to users, the greatest benefit of <b><tt>ps2pdf</tt></b> is that
it is more robust than Acrobat Distiller: it will process complex and
difficult PostScript files that Acrobat Distiller is not able to handle.

<p>
For certain documents, <b><tt>ps2pdf</tt></b> is much faster than Adobe
Distiller, and may be suitable for run-time conversions.  George White,
a heavy user of <b><tt>ps2pdf</tt></b>, remarks:

<blockquote>
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
<b><tt>ps2pdf</tt></b>), 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 <b><tt>ps2pdf</tt></b>
as a post-processor during routine document creation.
</blockquote>

<p>
On the other hand, there are some documents for which <b><tt>ps2pdf</tt></b>
may be much slower than Acrobat Distiller.  Caveat user.

<p>
<b><tt>ps2pdf</tt></b> usually produces output that is comparable in size to
the output of Acrobat Distiller; however, it sometimes produces much larger
output, especially if the input file involves pattern fills.

<p>
Many users report that the combination of <b><tt>ps2pdf</tt></b> with
Acrobat Reader is superior to using a generic PostScript viewer
(<b><tt>psview</tt></b> or <b><tt>ghostview</tt></b>), particularly for
documents with many pages where the navigational support in PDF files
reduces the overhead involved in navigating conventional PostScript
documents.

<hr>

<h2><a name="Acknowledgments"></a>Acknowledgments</h2>

<p>
Thanks to George N. White III &lt;<a href="mailto:[email protected]">[email protected]</a>&gt; of the Ocean
Sciences Division of the Bedford Institute of Oceanography in Dartmouth,
Nova Scotia for extensive testing of early versions of
<b><tt>ps2pdf</tt></b>, and for contributing most of this writeup.

<p>
Thanks to Martin Hosken of SIL International &lt;<a
href="http://www.sil.org">http://www.sil.org</a>&gt; for help with testing
<b><tt>ps2pdf</tt></b> with a wide variety of international fonts.

<!-- [2.0 end contents] ==================================================== -->

<!-- [3.0 begin visible trailer] =========================================== -->
<hr>

<p>
<small>Copyright &copy; 1996, 2000, 2004 artofcode LLC.  All rights
reserved.</small>

<p>
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 the license contained in the file LICENSE in this distribution.

For more information about licensing, please refer to
http://www.ghostscript.com/licensing/. For information on
commercial licensing, go to http://www.artifex.com/licensing/ or
contact Artifex Software, Inc., 101 Lucas Valley Road #110,
San Rafael, CA  94903, U.S.A., +1(415)492-9861.

<p>
<small>Ghostscript version 8.53, 20 October 2005

<!-- [3.0 end visible trailer] ============================================= -->

</body>
</html>

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].