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>ps2pdf: PostScript-to-PDF converter</title> 5<!-- $Id: Ps2pdf.htm,v 1.88 2005/10/20 19:46:23 ray Exp $ --> 6<!-- Originally: ps2pdf.txt --> 7<link rel="stylesheet" type="text/css" href="gs.css" title="Ghostscript Style"> 8</head> 9 10<body> 11<!-- [1.0 begin visible header] ============================================ --> 12 13<!-- [1.1 begin headline] ================================================== --> 14 15<h1><tt>ps2pdf</tt>: PostScript-to-PDF converter</h1> 16 17<!-- [1.1 end headline] ==================================================== --> 18 19<!-- [1.2 begin table of contents] ========================================= --> 20 21<h2>Table of contents</h2> 22 23<blockquote><ul> 24<li><a href="#Overview">Overview</a> 25<li><a href="#Usage">Usage</a> 26<li><a href="#Orientation">Setting page orientation</a> 27<li><a href="#Options">Options</a> 28<li><a href="#PDFX">Creating a PDF/X-3 document</a> 29<li><a href="#Limitations">Limitations</a> 30<li><a href="#PPD">Ghostscript PDF Printer Description</a> 31<li><a href="#Problems">Known problems</a> 32<li><a href="#Ps2pdf_vs_AD">Comparison of <b><tt>ps2pdf</tt></b> and Acrobat Distiller</a> 33<li><a href="#Acknowledgments">Acknowledgments</a> 34</ul></blockquote> 35 36<!-- [1.2 end table of contents] =========================================== --> 37 38<!-- [1.3 begin hint] ====================================================== --> 39 40<p>For other information, see the <a href="Readme.htm">Ghostscript 41overview</a>. 42 43<!-- [1.3 end hint] ======================================================== --> 44 45<hr> 46 47<!-- [1.0 end visible header] ============================================== --> 48 49<!-- [2.0 begin contents] ================================================== --> 50 51<h2><a name="Overview"></a>Overview</h2> 52 53<b><tt>ps2pdf</tt></b> is a work-alike for nearly all the functionality (but 54not the user interface) of Adobe's Acrobat<small><sup>TM</sup></small> 55Distiller<small><sup>TM</sup></small> product: it converts PostScript files 56to Portable Document Format (PDF) files. 57 58<p> 59<b><tt>ps2pdf</tt></b> is implemented as a very small command script (batch 60file) that invokes Ghostscript, selecting a special "output device" called 61<b><tt>pdfwrite</tt></b>. In order to use <b><tt>ps2pdf</tt></b>, the 62<b><tt>pdfwrite</tt></b> device must be included in the makefile when 63Ghostscript was compiled; see the <a 64href="Make.htm#Features_and_devices">documentation on building 65Ghostscript</a> for details: this is currently the case on all platforms, in 66Ghostscript as we distribute it. 67 68<hr> 69 70<h2><a name="Usage"></a>Usage</h2> 71 72<p> 73The usage for <b><tt>ps2pdf</tt></b> is 74 75<blockquote><b><tt> 76ps2pdf</tt></b> <em>[options] input.[e]ps output.pdf</em> 77</blockquote> 78 79<p> 80or, on Unix systems and some versions of Windows NT and OS/2 81 82<blockquote><b><tt> 83ps2pdf</tt></b> <em>input.[e]ps</em> 84</blockquote> 85 86<p> 87which is equivalent to 88 89<blockquote><b><tt> 90ps2pdf</tt></b> <em>input.[e]ps input.pdf</em> 91</blockquote> 92 93<p> 94There are actually several different <b><tt>ps2pdf</tt></b><em>*</em> scripts: 95the name <b><tt>ps2pdf</tt></b> above refers to any of them. 96 97<ul> 98 99<li><b><tt>ps2pdf12</tt></b> produces PDF 1.2 output (Acrobat 3-and-later 100compatible). 101 102<li><b><tt>ps2pdf13</tt></b> produces PDF 1.3 output (Acrobat 4-and-later 103compatible). 104 105<li><b><tt>ps2pdf14</tt></b> produces PDF 1.4 output (Acrobat 5-and-later 106compatible). 107 108<li><b><tt>ps2pdf</tt></b> per se currently produces PDF 1.2 output. 109However, this may change in the future. If you care about the compatibility 110level of the output, use <b><tt>ps2pdf12</tt></b>, <b><tt>ps2pdf13</tt></b>, 111or <b><tt>ps2pdf14</tt></b>, or use the 112<b><tt>-dCompatibilityLevel=</tt></b><em>1.x</em> switch in the command 113line. 114 115</ul> 116 117<p> 118Note that if you specify a value for <b><tt>PDFSETTINGS</tt></b>, this 119chooses PDF 1.3 or 1.4 output depending on the value of 120<b><tt>PDFSETTINGS</tt></b>: this overrides the output format specified by 121the script name. You can still specify the output format by using 122<b><tt>-dCompatibilityLevel=</tt></b> <em>after</em> 123<b><tt>-dPDFSETTINGS=</tt></b>. 124 125<p> 126All of these scripts actually call a script named <b><tt>ps2pdfwr</tt></b> 127or <b><tt>ps2pdfxx</tt></b>. The Unix <b><tt>ps2pdfwr</tt></b> script 128assumes that the Ghostscript executable is named <b><tt>gs</tt></b>; it is 129unlikely that you will need to change this. The DOS and MS Windows 130<b><tt>ps2pdfxx.bat</tt></b> script uses the value of the 131<b><tt>GSC</tt></b> environment variable, if defined, as the name of the 132executable; otherwise the script assumes the executable is named 133<b><tt>gswin32c</tt></b>. So in these environments, if the executable has a 134different name, you must set <b><tt>GSC</tt></b> to the name of the 135executable. 136 137<hr> 138 139<h2><a name="Orientation"></a>Setting page orientation</h2> 140 141<p> 142By default Ghostscript determines viewing page orientation based on the dominant 143text orientation on the page. Sometimes, when the page has text in several 144orientations or has no text at all, wrong orientation can be selected. 145 146<p> 147Acrobat Distiller parameter <b><tt>AutoRotatePages</b></tt> controls the 148automatic orientation selection algorithm. On Ghostscript, besides 149input stream, Distiller parameters can be given as command line arguments. 150For instance: <b><tt>-dAutoRotatePages=/None</b></tt> or 151<b><tt>/All</b></tt> or <b><tt>/PageByPage</b></tt>. 152 153<p> 154When there is no text on the page or automatic page rotation is set to 155<b><tt>/None</b></tt> an orientation value from setpagedevice is used. 156Valid values are: <b><tt>0</b></tt> (portrait), 157<b><tt>3</b></tt> (landscape), <b><tt>2</b></tt> (upside down), 158and <b><tt>1</b></tt> (seascape). The orientation can be set from the 159command line as <b><tt>-c "<</Orientation 3>> setpagedevice"</b></tt> 160using Ghostscript directly but cannot be set in <b><tt>ps2pdf</b></tt>. 161See <a href="#Limitations">Limitations</a> below. 162</pre> 163 164<p> 165Ghostscript passes the orientation values from DSC comments to 166<b><tt>pdfwrite</b></tt> driver 167but they are effectively ignored there. This appears to be consistent with 168Distiller 5 behavior. 169 170<hr> 171 172<h2><a name="Options"></a>Options</h2> 173 174<p> 175The <em>options</em> in the command line may include any switches that may 176be used with Ghostscript's PostScript and PDF interpreter (see <a 177href="Use.htm#Switches">here</a> for a complete list), although almost none 178of them are useful with <b><tt>ps2pdf</tt></b>. The following may be 179useful: 180 181<dl> 182 183<dt><b><tt>-r</tt></b><em>resolution</em> 184<dd>Sets the resolution for pattern fills and for fonts that must be 185converted to bitmaps. 186 187<dt><b><tt>-dProcessColorModel=</tt></b><em>device_color_space</em> <dd>Sets 188the color space to be used for device-dependent colors in the 189output. <em>device_color_space</em> may be <b><tt>/DeviceGray</tt></b>, 190<b><tt>/DeviceRGB</tt></b>, or <b><tt>/DeviceCMYK</tt></b>; the default 191value is <b><tt>/DeviceRGB</tt></b>. Note that this does not affect images: 192see <a href="#Limitations">Limitations</a> below. 193 194</dl> 195 196<p> 197More importantly, <em>options</em> may include 198<b><tt>-d</tt></b><em>parameter</em>=<em>value</em> or 199<b><tt>-s</tt></b><em>parameter</em>=<em>string</em> switches for setting 200"distiller parameters", Adobe's documented parameters for controlling the 201conversion process. The PostScript <b><tt>setdistillerparams</tt></b> and 202<b><tt>currentdistillerparams</tt></b> operators are also recognized when 203running <b><tt>ps2pdf</tt></b>, and provide an equivalent way to set these 204parameters from within the PostScript input file. 205 206<p> 207<b><tt>ps2pdf</tt></b> also recognizes the following options: 208 209<dl> 210 211<dt><b><tt>-dCompressFonts=</tt></b><em>boolean</em> 212<dd>Defines whether <b><tt>ps2pdf</tt></b> will compress embedded fonts in 213the output. The default value is <b><tt>true</tt></b>; the 214<b><tt>false</tt></b> setting is intended only for debugging. 215 216<dt><b><tt>-dMaxInlineImageSize=</tt></b><em>integer</em> 217<dd>Specifies the maximum size of an inline image, in bytes. For images larger 218than this size, <b><tt>ps2pdf</tt></b> will create an XObject instead of embedding 219the image into the context stream. 220The default value is <b><tt>4000</tt></b>. 221Note that redundant inline images must be embedded each time they occur in the 222document, while multiple references can be made to a single XObject image. Therefore 223it may be advantageous to set a small or zero value if the source document is expected 224to contain multiple identical images, reducing the size of the generated PDF. 225 226<dt><b><tt>-dPDFSETTINGS=</tt></b><em>configuration</em> 227<dd>Presets the "distiller parameters" to one of four predefined settings: 228 229<ul> 230 231<li><b><tt>/screen</tt></b> selects low-resolution output similar to the 232Acrobat Distiller "Screen Optimized" setting. 233 234<li><b><tt>/ebook</tt></b> selects medium-resolution output similar to the 235Acrobat Distiller "eBook" setting. 236 237<li><b><tt>/printer</tt></b> selects output similar to the Acrobat Distiller 238"Print Optimized" setting. 239 240<li><b><tt>/prepress</tt></b> selects output similar to Acrobat Distiller 241"Prepress Optimized" setting. 242 243<li><b><tt>/default</tt></b> selects output intended to be useful across a 244wide variety of uses, possibly at the expense of a larger output file. 245 246</ul> 247 248</dl> 249 250<p> 251The following option controls a conversion into PDF/X-3: 252<p> 253 254<dl> 255<dt><b><tt>-dPDFX=</tt></b><em>boolean</em> 256<dd>Specifies the generated document to follow the PDF/X-3 standard. 257When true, a <b><tt>DefaultRGB</b></tt> <b><tt>ColorSpace</b></tt> resource must be defined, and 258options <b><tt>NOSUBSTDEVICECOLORS</b></tt>, <b><tt>NOCIE</b></tt> must not be specified. 259Default value is <b><tt>false</b></tt>. 260</dl> 261 262<p> 263 264When generating a PDF/X-3 document, Ghostscript performs the following 265special actions to satisfy the PDF/X-3 standard : 266<ul> 267<li> All fonts are being embedded. 268<li> <b><tt>DeviceRGB</b></tt> color space is being substituted with <b><tt>DefaultRGB</b></tt> color space, 269which must be defined in the <b><tt>ColorSpace</b></tt> category. 270The easiest way is to provide it in the <b><tt>DefaultRGB</b></tt> file in the resource directory. 271<li> <b><tt>DeviceRGB</b></tt> color values are being passed unchanged. 272If an user needs an untrivial color adjustment, an untrivial <b><tt>DefaultRGB</b></tt> color space to be 273defined. 274<li> Transfer functions and halftone phases are being skipped. 275<li> <b><tt>/PS pdfmark</b></tt> interpretes the <b><tt>DataSource</b></tt> stream or file. 276</ul> 277 278 279<p> 280The following options control a conversion into PDF 1.2: 281<p> 282 283<dl> 284 285<dt><b><tt>-dPatternImagemask=</tt></b><em>boolean</em> 286<dd>With <b><tt>CompatibilityLevel < 1.3 </b></tt> it specifies whether the target viewer 287handles <b><tt>ImageMask</b></tt> with a pattern color. Some old viewers, 288such as Ghostscript 3.30 fail with such constructs. 289Seting this option to false, one can get more compatibility, 290but the mask interpolation is lost. 291With <b><tt>CompatibilityLevel >= 1.3 </b></tt> this option is being ignored. 292Default value is <b><tt>false</b></tt>. 293 294<dt><b><tt>-dMaxClipPathSize=</tt></b><em>integer</em> 295<dd>Specifies the maximum number of elements in the clipping path 296that the target viewer can handle. This option is used only with 297<b><tt>CompatibilityLevel < 1.3 </b></tt> and <b><tt>PatternImagemask=false</tt></b>, 298and only when converting a mask into a clipping path. 299If the clipping path exceeds the specified size, 300the masked image and the clipping path is being decomposed into smaller images. 301The value of the option counts straight path segments 302(curved segments are not used for representing a mask). 303Default value is <b><tt>12000</b></tt>. 304 305<dt><b><tt>-dMaxShadingBitmapSize=</tt></b><em>integer</em> 306<dd>With <b><tt>CompatibilityLevel < 1.3 </b></tt> it specifies 307the maximum number of bytes allowed for representing a shading as a bitmap. 308If a shading exceeds this value, the resolution of the output bitmap 309is being reduces to fit into the specified frame. 310Note that the number of bytes depends on the number of color components 311in <b><tt>ProcessColorModel</b></tt>, assumes 8 bits per sample, 312and doesn't account an image compression or filtering. 313Also note that reducing the resolution results unsmooth shading boundaries. 314 315With <b><tt>CompatibilityLevel >= 1.3 </b></tt> this option is being ignored. 316Default value is <b><tt>256000</b></tt>. 317For the best quality one can set the maximal integer value, 318but the output file size may dramatically increase. 319Therefore the user should choose a compromise value. 320 321<dt><b><tt>-dHaveTrueTypes=</tt></b><em>boolean</em> 322<dd>With <b><tt>CompatibilityLevel < 1.3 </b></tt> it specifies 323whether the target viewer can handle TrueType fonts. 324If not, TrueType fonts are being converted into raster fonts 325with resolution specified in </b></tt>HWResolution</b></tt>. 326With <b><tt>CompatibilityLevel >= 1.3 </b></tt> this option is being ignored. 327Default value is <b><tt>true</b></tt>. 328 329</dl> 330 331<p> 332The following option controls a conversion into PDF 1.3: 333<p> 334 335<dl> 336 337<dt><b><tt>-dHaveTransparency=</tt></b><em>boolean</em> 338<dd>With <b><tt>CompatibilityLevel >= 1.4 </b></tt> it specifies 339whether the target viewer can handle PDF 1.4 transparency objects. 340If not, transparency objects are being converted into plain images. 341Default value is <b><tt>true</b></tt>. 342 343</dl> 344 345<a name="Encryption"></a> 346The following switches are used for creating encrypted documents : 347 348<dl> 349<dt><b><tt>-sOwnerPassword=</tt></b><em>string</em> 350<dd>Defines that the document be encrypted with the specified 351owner password. 352</dl> 353 354<dl> 355<dt><b><tt>-sUserPassword=</tt></b><em>string</em> 356<dd>Defines the user password for opening the document. 357If empty, the document can be opened with no password, 358but the owner password is required to edit it. 359</dl> 360 361<dl> 362<dt><b><tt>-dPermissions=</tt></b><em>number</em> 363<dd>Defines the PDF permissions flag field. Negative values are allowed 364to represent unsigned integers with the highest bit set. See the PDF 365Reference manual for the meaning of the flag bits. 366</dl> 367 368<dl> 369<dt><b><tt>-dEncryptionR=</tt></b><em>number</em> 370<dd>Defines the encryption method revision number - either 2 or 3. 371</dl> 372 373<dl> 374<dt><b><tt>-dKeyLength=</tt></b><em>number</em> 375<dd>Defines the length (in bits) of the encryption key. 376Must be a multiple of 8 in the interval [40, 128]. 377If the length isn't 40, <b><tt>-dEncryptionR</tt></b> must be 3. 378</dl> 379 380 381<p> 382<b><tt>ps2pdf</tt></b> recognizes all of the Acrobat Distiller 5 parameters 383defined in the DistillerParameters document included in the 384<a href="http://partners.adobe.com/public/developer/acrobat/sdk/index.html">Acrobat SDK</a>. 385Cells in the table 386containing '=' mean that the value of the parameter is the same as in the 387"default" column. 388 389<blockquote><table cellpadding=0 cellspacing=0> 390<tr valign=bottom> 391 <th align=left>Parameter name 392 <td> 393 <th align=left>Notes 394 <td> 395 <th align=left>default 396 <td> 397 <th align=left>screen 398 <td> 399 <th align=left>ebook 400 <td> 401 <th align=left>printer 402 <td> 403 <th align=left>prepress 404<tr> <td colspan=13><hr> 405<tr valign=top><td><b><tt>AlwaysEmbed</tt></b><td><td><td><td>[]<td><td>=<td><td>=<td><td>=<td><td>= 406<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>= 407<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>= 408<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>= 409<tr valign=top><td><b><tt>ASCII85EncodePages</tt></b><td><td><td><td>false<td><td>=<td><td>=<td><td>=<td><td>= 410<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>= 411<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>= 412<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>= 413<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 414<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>= 415<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>= 416<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>= 417<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>= 418<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 419<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> 420<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 421<tr valign=top><td><b><tt>ColorImageDepth</tt></b><td><td><td><td>-1<td><td>=<td><td>=<td><td>=<td><td>= 422<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>= 423<tr valign=top><td><b><tt>ColorImageFilter</tt></b><td><td><td><td>/DCTEncode<td><td>=<td><td>=<td><td>=<td><td>= 424<tr valign=top><td><b><tt>ColorImageDownsampleThreshold</tt></b><td><td><td><td>1.5<td><td>=<td><td>=<td><td>=<td><td>= 425<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 426<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 427<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 428<tr valign=top><td><b><tt>CompressPages</tt></b><td><td><td><td>true<td><td>=<td><td>=<td><td>=<td><td>= 429<tr valign=top><td><b><tt>ConvertCMYKImagesToRGB</tt></b><td><td><td><td>false<td><td>=<td><td>=<td><td>=<td><td>= 430<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>= 431<tr valign=top><td><b><tt>CoreDistVersion</tt></b><td><td><td><td>4000<td><td>=<td><td>=<td><td>=<td><td>= 432<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 433<tr valign=top><td><b><tt>DefaultRenderingIntent</tt></b><td><td><td><td>/Default<td><td>=<td><td>=<td><td>=<td><td>= 434<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>= 435<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 436<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 437<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 438<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 439<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 440<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>= 441<tr valign=top><td><b><tt>EncodeColorImages</tt></b><td><td><td><td>true<td><td>=<td><td>=<td><td>=<td><td>= 442<tr valign=top><td><b><tt>EncodeGrayImages</tt></b><td><td><td><td>true<td><td>=<td><td>=<td><td>=<td><td>= 443<tr valign=top><td><b><tt>EncodeMonoImages</tt></b><td><td><td><td>true<td><td>=<td><td>=<td><td>=<td><td>= 444<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>= 445<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> 446<tr valign=top><td><b><tt>GrayImageDepth</tt></b><td><td><td><td>-1<td><td>=<td><td>=<td><td>=<td><td>= 447<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>= 448<tr valign=top><td><b><tt>GrayImageDownsampleThreshold</tt></b><td><td><td><td>1.5<td><td>=<td><td>=<td><td>=<td><td>= 449<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 450<tr valign=top><td><b><tt>GrayImageFilter</tt></b><td><td><td><td>/DCTEncode<td><td>=<td><td>=<td><td>=<td><td>= 451<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 452<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>= 453<tr valign=top><td><b><tt>LockDistillerParams</tt></b><td><td><td><td>false<td><td>=<td><td>=<td><td>=<td><td>= 454<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>= 455<tr valign=top><td><b><tt>MaxSubsetPct</tt></b><td><td><td><td>100<td><td>=<td><td>=<td><td>=<td><td>= 456<tr valign=top><td><b><tt>MonoImageDepth</tt></b><td><td><td><td>-1<td><td>=<td><td>=<td><td>=<td><td>= 457<tr valign=top><td><b><tt>MonoImageDict</tt></b><td><td><td><td><<K -1>><td><td>=<td><td>=<td><td>=<td><td>= 458<tr valign=top><td><b><tt>MonoImageDownsampleThreshold</tt></b><td><td><td><td>1.5<td><td>=<td><td>=<td><td>=<td><td>= 459<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 460<tr valign=top><td><b><tt>MonoImageFilter</tt></b><td><td><td><td>/CCITTFaxEncode<td><td>=<td><td>=<td><td>=<td><td>= 461<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 462<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> 463<tr valign=top><td><b><tt>OffOptimizations</tt></b><td><td><td><td>0<td><td>=<td><td>=<td><td>=<td><td>= 464<tr valign=top><td><b><tt>OPM</tt></b><td><td><td><td>1<td><td>=<td><td>=<td><td>=<td><td>= 465<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 466<tr valign=top><td><b><tt>ParseDSCComments</tt></b><td><td><td><td>true<td><td>=<td><td>=<td><td>=<td><td>= 467<tr valign=top><td><b><tt>ParseDSCCommentsForDocInfo</tt></b><td><td><td><td>true<td><td>=<td><td>=<td><td>=<td><td>= 468<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>= 469<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>= 470<tr valign=top><td><b><tt>PreserveHalftoneInfo</tt></b><td><td><td><td>false<td><td>=<td><td>=<td><td>=<td><td>= 471<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 472<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 473<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>= 474<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>= 475<tr valign=top><td><b><tt>SubsetFonts</tt></b><td><td><td><td>true<td><td>=<td><td>=<td><td>=<td><td>= 476<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>= 477<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 478<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>= 479<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>= 480</table></blockquote> 481 482<p> 483<a name="note_0">(note 0)</a> 484This parameter can be set and queried, but currently has no effect. 485 486<p> 487<a name="note_1">(note 1)</a> 488Currently, <b><tt>AutoFilterxxxImages</tt></b> doesn't examine the image to 489decide between JPEG and LZW or Flate compression: it always uses 490Flate compression. If you want to force JPEG compression, use 491<b><tt>-dAutoFilterxxxImages=false</tt></b>. 492 493<p> 494<a name="note_2">(note 2)</a> 495Because of Unisys's threats regarding the Welch patent, 496<b><tt>ps2pdf</tt></b> does not actually use LZW compression: instead, it 497treats all requests for LZW compression as calling for Flate compression. 498Concomitantly, <tt>UseFlateCompression</tt> is treated as always on, and 499the value of this parameter is ignored as with note 0. Now that the patent 500has expired, we could change this should it become worthwhile. 501 502<p> 503<a name="note_3">(note 3)</a> 504The <b><tt>xxxDownsampleType</tt></b> parameters can also have the value 505/Bicubic (a Distiller 4 feature), which is currently treated as equivalent 506to /Average. 507 508<p> 509<a name="note_4">(note 4)</a> 510Currently, the transfer function is always applied. If the corresponding 511parameter is set to <b><tt>/Preserve</tt></b>, the function setting is also 512copied into the PDF file. 513 514<p> 515<a name="note_5">(note 5)</a> 516Optimization (linearization) is implemented with a separate program, 517<b><tt>pdfopt</tt></b> <em>input.pdf</em> <em>output.pdf</em>; the 518<b><tt>Optimize</tt></b> parameter has no effect. 519 520<p> 521<a name="note_6">(note 6)</a> 522Currently, colors for images and shadings are left in the color space 523specified in the PostScript input, except for 524<b><tt>ConvertCMYKImagesToRGB</tt></b>; the current color in the graphics 525state (used for fill, stroke, text, and imagemask) is always converted to 526the color space specified by the current value of 527<b><tt>ProcessColorModel</tt></b>. The intended behavior is the same as for 528Acrobat Distiller, except that if <b><tt>ColorConversionStrategy</tt></b> is 529set to <b><tt>/UseDeviceDependentColor</tt></b>, colors are converted to the 530color space specified by <b><tt>ProcessColorModel</tt></b> rather than 531always to <b><tt>/DeviceRGB</tt></b>. 532 533<p> 534<a name="note_7">(note 7)</a> 535 The default image parameter dictionary is 536<blockquote><b><tt> 537<< /QFactor 0.9 /Blend 1 /HSamples [2 1 1 2] /VSamples [2 1 1 2] >> 538</tt></b></blockquote> 539 540<p> 541<a name="note_8">(note 8)</a> 542The printer ACS image parameter dictionary is 543<blockquote><b><tt> 544<< /QFactor 0.4 /Blend 1 /ColorTransform 1 /HSamples [1 1 1 1] /VSamples [1 1 1 1] >> 545</tt></b></blockquote> 546 547<p> 548<a name="note_9">(note 9)</a> 549The prepress ACS image parameter dictionary is 550<blockquote><b><tt> 551<< /QFactor 0.15 /Blend 1 /ColorTransform 1 /HSamples [1 1 1 1] /VSamples [1 1 1 1] >> 552</tt></b></blockquote> 553 554<p> 555<a name="note_10">(note 10)</a> 556The screen and ebook ACS image parameter dictionary is 557<blockquote><b><tt> 558<< /QFactor 0.76 /Blend 1 /ColorTransform 1 /HSamples [2 1 1 2] /VSamples [2 1 1 2] >> 559</tt></b></blockquote> 560 561<p> 562<a name="note_11">(note 11)</a> 563The default, screen, and ebook settings never embed the 14 standard fonts 564(Courier, Helvetica, and Times families, Symbol, and ZapfDingbats). 565 566<p> 567<a name="note_12">(note 12)</a> 568<b><tt>NeverEmbed</tt></b> can include CID font names. 569If a CID font is substituted in <b><tt>lib/cidfmap</tt></b>, 570the substitute font name is used when the CID font is embedded, 571and the original CID font name is used when it is not embedded. 572<b><tt>NeverEmbed</tt></b> should always specify the original CID font 573name. 574 575<hr> 576 577<h2><a name="PPD"></a>Ghostscript PDF Printer Description</h2> 578<p> 579To assist with creating a PostScript file suitable for conversion 580to PDF, ghostscript includes <a href="../lib/ghostpdf.ppd">ghostpdf.ppd</a>, 581a PostScript Printer Description (PPD) file. 582This allows some <a href="#Options">distiller parameters</a> 583to be set when a PostScript file is generated. 584 585<h3>Windows XP or 2000</h3> 586<p> 587To install a "Ghostscript PDF" printer on Windows XP, 588select the Windows Control Panel, 589Printers and Faxes, 590Add a Printer, 591Local Printer, 592Use port FILE: (Print to File), 593Have Disk..., 594select the directory containg 595<a href="../lib/ghostpdf.ppd">ghostpdf.ppd</a> 596and 597<a href="../lib/ghostpdf.inf">ghostpdf.inf</a>, 598select "Ghostscript PDF", 599Replace existing driver (if asked), 600and answer the remaining questions appropriately. 601After installing, open the "Ghostscript PDF" properties, 602select the Device Settings tab, 603set "Mimimum Font Size to Download as Outline" to 0 pixels. 604<p> 605To set distiller parameters, select the "Ghostscript PDF" 606Printing Preferences, then the Advanced button. 607The PDF settings are under "Printer Features". 608 609<hr> 610 611<h2><a name="PDFX"></a>Creating a PDF/X-3 document</h2> 612 613<p> 614 615To create a PDF/X-3 document from a Postscript or a PDF file, you should : 616 617<ul> 618<li> Specify the <b><tt>pdfwrite</b></tt> device or use the <b><tt>ps2pdf</b></tt> script. 619<li> Specify the <b><tt>-dPDFX</b></tt> option. It provides the document conformity 620 and forces <b><tt>-dCompatibilityLevel=1.3</b></tt>. 621<li> Specify <b><tt>-sProcessColorModel=DeviceGray</b></tt> or <b><tt>-sProcessColorModel=DeviceCMYK</b></tt> 622 (<b><tt>DeviceRGB</b></tt> is not allowed). 623<li> Specify the <b><tt>-dUseCIEColor</b></tt> option if necessary (see below). 624<li> Specify a PDF/X definition file before running the input document. 625 It provides additional information to be included into the output document. 626 A sample PDF/X definition file may be found in <b><tt>gs/lib/PDFX_def.ps</b></tt>. 627<li> Provide an ICC profile and specify it in the PDF/X definition file 628 as explained below. Rather PDF/X-3 standard defines the ICC profile 629 as optional, we could not get it working with the PDF/X-3 Inspector freeware. 630<li> Provide a <b><tt>DefaultRGB</b></tt> resource file in the ColorSpace resource category. 631 Either define it in the PDF/X definition file, or provide 632 a definition of <b><tt>gs/Resource/ColorSpace/DefaultRGB</b></tt> . 633 Rather <b><tt>gs/Resource/ColorSpace/DefaultRGB</b></tt> is usually 634 distributed with Ghostscript, its contents is not necessarily satisfy your needs, see below. 635</ul> 636 637<p> 638As mentioned above, the PDF/X definition file provides a special information, 639which the PDF/X-3 standard requires. You can find a sample file in 640<b><tt>gs/lib/PDFX_def.ps</b></tt>, and edit it according to your needs. 641The file follows Postscript syntax and uses the operator <b><tt>pdfmark</b></tt> 642to pass the special information. For your comfort 643we marked editable lines in the sample file with the comment <b><tt>% Customize</b></tt>. 644They are explained below. 645 646<dl> 647<dt><b><tt>ICCProfile</tt></b> <em>string</em> 648<dd>Defines a file name of an ICC profile file to be included into the output document. 649You may specify either an absolute file name, or a relative 650path fronm the current directory. 651</dl> 652 653<dl> 654<dt><b><tt>Title</tt></b> <em>string</em> 655<dd>Defines the document title. 656</dl> 657 658<dl> 659<dt><b><tt>Info</tt></b> <em>string</em> 660<dd>Defines an <b><tt>Info</tt></b> value for the output intent dictionary. 661</dl> 662 663<dl> 664<dt><b><tt>OutputCondition</tt></b> <em>string</em> 665<dd>Defines an <b><tt>OutputCondition</tt></b> value for the output intent dictionary. 666</dl> 667 668 669<dl> 670<dt><b><tt>OutputConditionIdentifier</tt></b> <em>string</em> 671<dd>Defines an <b><tt>OutputConditionIdentifier</tt></b> value for the output intent dictionary. 672</dl> 673 674<p> 675Rather the PDF/X-3 standard requires colors to be adjusted at the 676document generation time, Ghostscript <em>does not</em> perform any 677special color conversion. Either colors to be adjusted in advance, 678or a proper color conversion to be specified in <b><tt>/DefaultGray</b></tt>, 679<b><tt>DefaultRGB</b></tt>, <b><tt>DefaultCMYK</b></tt> resources of the 680<b><tt>ColorSpace</b></tt> resource category, 681and the <b><tt>-dUseCIEColor</b></tt> option to be specified 682to remap device colors into CIE colors. 683The choice of the ICC profile is also the user's responsibility. 684 685<p>Please note that if a graphic object can't embed into the output format, 686Ghostscript converts it into low level objects, using a device color space 687specified in the <b><tt>ProcessColorModel</b></tt> option. 688If you need to adjust those resulting colors, you may substitute 689them with CIE colors, <em>running Ghostscript at second time </em>. 690Performing both actions in a single pass is a subject of further improvements. 691 692<p>Ghostscript distribution does not contain an ICC profile to be used 693for creating a PDF/X-3 document. Users should either create an appropriate one themselves, 694or use one from a public domain, or create one with the PDF/X-3 inspector freeware. 695<p> 696 697Here is a sample command line to invoke Ghostscript for generating a PDF/X-3 document : 698<blockquote><b><tt> 699gs -dPDFX -dBATCH -dNOPAUSE -dNOOUTERSAVE -dUseCIEColor -sDEVICE=pdfwrite -sOutputFile=out-x3.pdf PDFX_def.ps input.ps 700</tt></b></blockquote> 701 702<p> 703<hr> 704 705<h2><a name="Limitations"></a>Limitations</h2> 706 707<p> 708<b><tt>ps2pdf</tt></b> will sometimes convert PostScript constructs to 709lower-level ones, even if a higher-level construct is available. For 710example, if the PostScript file uses <b><tt>charpath</tt></b> to set a 711clipping path consisting of text, <b><tt>ps2pdf</tt></b> will write the 712clipping path as a path in the PDF file, rather than as text, even though 713PDF is able to express clipping with text. This is only a performance 714issue, and will be improved incrementally over time. 715 716<p> 717Some applications, such as HIGZ, produce PostScript files that use 718ridiculously large coordinates. On such files, <b><tt>ps2pdf</tt></b> may 719cause a <b><tt>limitcheck</tt></b> error. If this occurs, try reducing the 720default internal resolution of 720 dpi by using the <b><tt>-r</tt></b> 721switch, e.g., <b><tt>ps2pdf -r300 somefile.ps</tt></b>. 722 723<p> 724<b><tt>ps2pdf</tt></b> ignores the PDF 1.3 (Acrobat 4.x) pdfmarks related to 725document content structure: <b><tt>StRoleMap</tt></b>, 726<b><tt>StClassMap</tt></b>, <b><tt>StPNE</tt></b>, 727<b><tt>StBookmarkRoot</tt></b>, <b><tt>StPush</tt></b>, 728<b><tt>StPop</tt></b>, <b><tt>StPopAll</tt></b>, <b><tt>StBMC</tt></b>, 729<b><tt>StBDC</tt></b>, <b><tt>EMC</tt></b>, <b><tt>StOBJ</tt></b>, 730<b><tt>StAttr</tt></b>, <b><tt>StStore</tt></b>, <b><tt>StRetrieve</tt></b>, 731<b><tt>NamespacePush</tt></b>, <b><tt>NamespacePop</tt></b>, and 732<b><tt>NI</tt></b>. While this causes some structural information to be 733omitted from the output file, the displayed and printed output are normally 734not affected. 735 736<p> 737<b><tt>ps2pdf</tt></b> currently has only very limited support for PDF 1.4. 738It writes out the blend mode, constant alpha, and text knockout graphics 739state parameters, and it handles images with soft masks, but it does not 740handle transparency groups, or soft masks in the graphics state. (Note that 741there is no standard way to specify any of these things in PostScript, so 742these statements only apply when the input file is already a PDF 1.4 file.) 743 744<p> 745<b><tt>ps2pdf</tt></b> provides simplified interface to Ghostscript 746command line. It is not possible to use <tt><b>-c</tt></b> option or pass 747multiple source files. For the unrestricted access to the command line 748parameters, use Ghostscript directly. 749 750<blockquote><b><tt> 751gs -q -dSAFER -dNOPAUSE -dBATCH -sOutputFile=file.pdf </tt></b><em>[more options]</em><b><tt> \<br> 752 -sDEVICE=pdfwrite -c .setpdfwrite -f </b></tt><em>source1.ps [more files]</em> 753</blockquote> 754 755See <a href="Language.htm#.setpdfwrite">Language.htm</a> for details 756of the <tt>.setpdfwrite</tt> operator. 757<hr> 758 759<h2><a name="Problems"></a>Known problems</h2> 760 761<p> 762Distiller parameters should only be saved by <b><tt>save</tt></b> and 763restored by <b><tt>restore</tt></b>, but they are also saved by 764<b><tt>gsave</tt></b> and restored by <b><tt>grestore</tt></b>. 765 766<p> 767Changing the value of the <b><tt>CompressPages</tt></b> parameter after any 768marks have been made on the page may cause a crash. 769 770<hr> 771 772<h2><a name="Ps2pdf_vs_AD"></a>Comparison of <b><tt>ps2pdf</tt></b> and 773Acrobat Distiller</h2> 774 775<p> 776According to users, the greatest benefit of <b><tt>ps2pdf</tt></b> is that 777it is more robust than Acrobat Distiller: it will process complex and 778difficult PostScript files that Acrobat Distiller is not able to handle. 779 780<p> 781For certain documents, <b><tt>ps2pdf</tt></b> is much faster than Adobe 782Distiller, and may be suitable for run-time conversions. George White, 783a heavy user of <b><tt>ps2pdf</tt></b>, remarks: 784 785<blockquote> 786I haven't seen a head to head comparison, but Distiller seems 787slower when running on what should be a faster system (for instance, 788Distiller on a PPC Mac vs a 25 MHz 68040 NeXT running 789<b><tt>ps2pdf</tt></b>), so I think this is fair -- also, one of Mark 790Doyle's postings indicated that Distiller was not fast enough for use as a 791run-time server. In contrast, I find that I can use <b><tt>ps2pdf</tt></b> 792as a post-processor during routine document creation. 793</blockquote> 794 795<p> 796On the other hand, there are some documents for which <b><tt>ps2pdf</tt></b> 797may be much slower than Acrobat Distiller. Caveat user. 798 799<p> 800<b><tt>ps2pdf</tt></b> usually produces output that is comparable in size to 801the output of Acrobat Distiller; however, it sometimes produces much larger 802output, especially if the input file involves pattern fills. 803 804<p> 805Many users report that the combination of <b><tt>ps2pdf</tt></b> with 806Acrobat Reader is superior to using a generic PostScript viewer 807(<b><tt>psview</tt></b> or <b><tt>ghostview</tt></b>), particularly for 808documents with many pages where the navigational support in PDF files 809reduces the overhead involved in navigating conventional PostScript 810documents. 811 812<hr> 813 814<h2><a name="Acknowledgments"></a>Acknowledgments</h2> 815 816<p> 817Thanks to George N. White III <<a href="mailto:aa056@chebucto.ns.ca">aa056@chebucto.ns.ca</a>> of the Ocean 818Sciences Division of the Bedford Institute of Oceanography in Dartmouth, 819Nova Scotia for extensive testing of early versions of 820<b><tt>ps2pdf</tt></b>, and for contributing most of this writeup. 821 822<p> 823Thanks to Martin Hosken of SIL International <<a 824href="http://www.sil.org">http://www.sil.org</a>> for help with testing 825<b><tt>ps2pdf</tt></b> with a wide variety of international fonts. 826 827<!-- [2.0 end contents] ==================================================== --> 828 829<!-- [3.0 begin visible trailer] =========================================== --> 830<hr> 831 832<p> 833<small>Copyright © 1996, 2000, 2004 artofcode LLC. All rights 834reserved.</small> 835 836<p> 837This software is provided AS-IS with no warranty, either express or 838implied. 839 840This software is distributed under license and may not be copied, 841modified or distributed except as expressly authorized under the terms 842of the license contained in the file LICENSE in this distribution. 843 844For more information about licensing, please refer to 845http://www.ghostscript.com/licensing/. For information on 846commercial licensing, go to http://www.artifex.com/licensing/ or 847contact Artifex Software, Inc., 101 Lucas Valley Road #110, 848San Rafael, CA 94903, U.S.A., +1(415)492-9861. 849 850<p> 851<small>Ghostscript version 8.53, 20 October 2005 852 853<!-- [3.0 end visible trailer] ============================================= --> 854 855</body> 856</html> 857