xref: /plan9/sys/src/cmd/gs/doc/Ps2ps2.htm (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<head>
4<title>ps2ps2: Converts Postscript Level 3 or PDF into Postscript Level 2</title>
5<!-- $Id: Ps2ps2.htm,v 1.7 2005/10/20 19:46:23 ray Exp $ -->
6<link rel="stylesheet" type="text/css" href="gs.css" title="Ghostscript Style">
7</head>
8
9<body>
10<!-- [1.0 begin visible header] ============================================ -->
11
12<!-- [1.1 begin headline] ================================================== -->
13
14<h1><tt>ps2ps2</tt>: Converts Postscript Level 3 or PDF into Postscript Level 2</h1>
15
16<!-- [1.1 end headline] ==================================================== -->
17
18<!-- [1.2 begin table of contents] ========================================= -->
19
20<h2>Table of contents</h2>
21
22<blockquote><ul>
23<li><a href="#Overview">Overview</a>
24<li><a href="#Usage">Usage</a>
25<li><a href="#Options">Options</a>
26<li><a href="#PPD">Ghostscript PS2 Printer Description</a>
27<li><a href="#printer_control">Controlling the printer behavior</a>
28<li><a href="#Limitations">Limitations</a>
29</ul></blockquote>
30
31<!-- [1.2 end table of contents] =========================================== -->
32
33<!-- [1.3 begin hint] ====================================================== -->
34
35<p>For other information, see the <a href="Readme.htm">Ghostscript
36overview</a>.
37
38<!-- [1.3 end hint] ======================================================== -->
39
40<hr>
41
42<!-- [1.0 end visible header] ============================================== -->
43
44<!-- [2.0 begin contents] ================================================== -->
45
46<h2><a name="Overview"></a>Overview</h2>
47
48<b><tt>ps2ps2</tt></b> is a script for converting a PDF or a Postscript Level 3 into
49Postscript Level 2.
50
51<p>
52<b><tt>ps2ps2</tt></b> is implemented as a very small command script (batch
53file) that invokes Ghostscript, selecting a special "output device" called
54<b><tt>ps2write</tt></b>.  In order to use <b><tt>ps2ps2</tt></b>, the
55<b><tt>ps2write</tt></b> device must be included in the makefile when
56Ghostscript was compiled; see the <a
57href="Make.htm#Features_and_devices">documentation on building
58Ghostscript</a> for details: this is currently the case on all platforms, in
59Ghostscript as we distribute it.
60
61<hr>
62
63<h2><a name="Usage"></a>Usage</h2>
64
65<p>
66The usage for <b><tt>ps2ps2</tt></b> is
67
68<blockquote><b><tt>
69ps2ps2</tt></b> <em>[options] input.{ps|eps|pdf} output.ps</em>
70</blockquote>
71
72
73
74<h2><a name="Options"></a>Options</h2>
75
76<p>
77The <em>options</em> given on the command line may include any switches
78that may be used with Ghostscript's PostScript and PDF interpreter (see
79<a href="Use.htm#Switches">here</a> for a complete list).
80
81<p>
82Since <b><tt>ps2write</tt></b> makes use of some printer
83parameters while converting high level objects into Level 2 objects,
84we strongly recommend to set those values in accordance with the
85target printer or other output device.
86In particular, it is important for
87<a  href="Use.htm#Output_resolution">Output resolution</a>,
88<a href="Use.htm#FIXEDMEDIA"><b><tt>-dFIXEDMEDIA</tt></b></a>, and
89<b><tt>ProcessColorModel</tt></b></a> to be set correctly.
90
91<p>
92<em>
93<b>Important :</b>
94If the target printer can't handle some font type,
95ps2write converts such fonts into bitmap fonts,
96using the resolution specified when ps2write is invoked.
97Particularly this always happen with CID fonts, which are not Postscript Level 2 objects.
98Therefore the page device parameter <b><tt>PageSize</tt></b>
99must match the target printer, and we recommend to set
100the <b><tt>PageSize</tt></b> entry of the <b><tt>Policies</tt></b>
101dictionary to 3, in order to provide a proper page scaling
102in the Postscript interpreter while ps2write is invoked.
103</em>
104
105<p>
106More importantly, <em>options</em> passed to ps2ps2 may include
107<b><tt>-d</tt></b><em>parameter</em>=<em>value</em> or
108<b><tt>-s</tt></b><em>parameter</em>=<em>string</em> switches for setting
109"distiller parameters", Adobe's documented parameters for controlling the
110conversion process.  The PostScript <b><tt>setdistillerparams</tt></b> and
111<b><tt>currentdistillerparams</tt></b> operators are also recognized when
112running <b><tt>ps2ps2</tt></b>, and provide an equivalent way to set these
113parameters from within the PostScript input file.
114
115<p>
116The <b><tt>ps2write</tt></b> device handles the same set of distiller
117parameters as
118are handled by the <b><tt>pdfwrite</tt></b> device. See the
119<a href="Ps2pdf.htm#Options">PostScript-to-PDF converter</a>
120documentation for a complete description of how to use them to
121control the document conversion.
122
123<p>
124The following options may be important for <b><tt>ps2ps2</tt></b> due to the target printer features:
125<dl>
126<dt><b><tt>-dPatternImagemask=</tt></b><em>boolean</em>,
127<dt><b><tt>-dMaxClipPathSize=</tt></b><em>integer</em>,
128<dt><b><tt>-dMaxShadingBitmapSize=</tt></b><em>integer</em>,
129<dt><b><tt>-dHaveTrueTypes=</tt></b><em>boolean</em>.
130</dl>
131See <a href="Ps2pdf.htm#Options">PostScript-to-PDF converter</a> for details.
132
133The option <b><tt>-dMaxInlineImageSize=</tt></b><em>integer</em>
134Must not be used with <tt><b>ps2ps2</tt></b>.
135
136
137<p>
138This set includes of the Acrobat Distiller 5 parameters
139defined in the DistillerParameters document included in the
140<a href="http://partners.adobe.com/public/developer/acrobat/sdk/index.html">Acrobat SDK</a>.
141
142Default values are same as the <tt><b>printer</tt></b> settings defined
143in <a href="Ps2pdf.htm#Options">PostScript-to-PDF converter</a>,
144with these exceptions:
145
146<dl>
147<dt><b><tt>/PreserveHalftoneInfo</tt></b> <em>true</em>,
148<dt><b><tt>/TransferFunctionInfo</tt></b> <em>/Preserve</em>,
149<dt><b><tt>/MaxViewerMemorySize</tt></b> <em>8000000</em>,
150<dt><b><tt>/CompressPages</tt></b> <em>false</em>,
151<dt><b><tt>/CompressFonts</tt></b> <em>false</em>,
152<dt><b><tt>/ASCII85EncodePages</tt></b> <em>true</em>,
153</dl>
154
155<p>
156The following ps2write specific option control the output file compression :
157<p>
158
159<dl>
160<b><tt>-dCompressEntireFile=</tt></b><em>boolean</em>
161<dd>When this parameter is true, the <b><tt>LZWEncode</b></tt>
162and <b><tt>ASCII85Encode</b></tt> filters are being applied to entire output file.
163In this case <b><tt>CompressPages</b></tt> should be false to exclude a dual compression.
164When this parameter is false, those filters applies to the initial procset only,
165if <b><tt>CompressPages</b></tt> is true.
166Default value is <b><tt>false</b></tt>.
167</dl>
168
169
170<h2><a name="PPD"></a>Ghostscript PS2 Printer Description</h2>
171<p>
172Not implemented yet.
173<hr>
174
175<h2><a name="printer_control"></a>Controlling the printer behavior</h2>
176
177<p>
178A few options can be used to control the behavior of the printer or
179program that reads the result of ps2ps2.
180
181<dl>
182<dt><b><tt>-dRotatePages=</tt></b><em>boolean</em>.
183<dd>The printer will rotate pages
184for a better fitting into the real page size. Default value : <em>false</em>.
185Must be <em>false</em> if <b><tt>-dSetPageSize=true</tt></b>.
186
187<dt><b><tt>-dFitPages=</tt></b><em>boolean</em>.
188<dd>The printer will scale pages down
189to fit into the real page size. The rendering quality may be poor due to the scaling,
190especially for fonts which Ghostscript had converted into bitmaps
191(see the <em>ps2write</em> device parameter <b><tt>HaveTrueTypes</tt></b>;
192See <a href="#Options">Options</a> about the <b><tt>PageSize</tt></b> entry of the <b><tt>Policies</tt></b>
193dictionary while the conversion step).
194Default value : <em>false</em>.
195Must be <em>false</em> if <b><tt>-dSetPageSize=true</tt></b>.
196
197<dt><b><tt>-dSetPageSize=</tt></b><em>boolean</em>.
198<dd>The printer will try to set page size from the job.
199Only use with printers which can handle random <em>PageSize</em>.
200Must be <em>false</em> if <b><tt>-dRotatePages=true</tt></b> or <b><tt>-dFitPages=true</tt></b>.
201
202</dl>
203
204<p>
205These correspond to keys in the Postscript <em>userdict</em>
206of the target printer's virtual memory to control its behavior while
207executing a job generated with <tt><b>ps2ps2</tt></b>.
208
209<p>
210Currently Ghostscript does not provide a method for
211incorporating these in a print job.
212Users should refer to the printer's documentation.
213
214<hr>
215
216
217<h2><a name="Limitations"></a>Limitations</h2>
218
219<p>
220Attempting to generate a device independent Postscript Level 2 is a bad idea.
221Postscript Level 2 data are device dependent by definition. Let Ghostscript know
222the features of the specific printer as described in
223<a href="#Options">Options</a> while generating a printer job.
224
225<p>
226<b><tt>ps2ps2</tt></b> does not generate DSC comments.
227
228
229<p>
230<b><tt>ps2ps2</tt></b> provides simplified interface to Ghostscript
231command line. It is not possible to use <tt><b>-c</tt></b> option or pass
232multiple source files. For the unrestricted access to the command line
233parameters, use Ghostscript directly.
234
235<blockquote><b><tt>
236gs -q -dSAFER -dNOPAUSE -dBATCH -sOutputFile=file.ps </tt></b><em>[more options]</em><b><tt> \<br>
237&nbsp;&nbsp;-sDEVICE=ps2write </b></tt><em>source1.pdf [more files]</em>
238</blockquote>
239
240<hr>
241
242
243<!-- [2.0 end contents] ==================================================== -->
244
245<!-- [3.0 begin visible trailer] =========================================== -->
246
247<p>
248<small>Copyright &copy; 1996, 2000, 2004 artofcode LLC.  All rights
249reserved.</small>
250
251<p>
252This software is provided AS-IS with no warranty, either express or
253implied.
254
255This software is distributed under license and may not be copied,
256modified or distributed except as expressly authorized under the terms
257of the license contained in the file LICENSE in this distribution.
258
259For more information about licensing, please refer to
260http://www.ghostscript.com/licensing/. For information on
261commercial licensing, go to http://www.artifex.com/licensing/ or
262contact Artifex Software, Inc., 101 Lucas Valley Road #110,
263San Rafael, CA  94903, U.S.A., +1(415)492-9861.
264
265<p>
266<small>Ghostscript version 8.53, 20 October 2005
267
268<!-- [3.0 end visible trailer] ============================================= -->
269
270</body>
271</html>
272