Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 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>Details of Ghostscript output devices</title>
5
<!-- $Id: Devices.htm,v 1.90 2005/10/20 19:46:23 ray Exp $ -->
6
<!-- Originally: devices.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>Details of Ghostscript output devices</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="#Measurements">Notes on measurements</a>
25
<li><a href="#File_formats">Image file formats</a>
26
<ul>
27
<li><a href="#PNG">PNG file format</a>
28
<li><a href="#JFIF">JPEG file format (JFIF)</a>
29
<li><a href="#PNM">PNM file format</a>
30
<li><a href="#TIFF">TIFF file formats</a>
31
<li><a href="#fax">fax file formats</a>
32
<li><a href="#BMP">BMP file format</a>
33
<li><a href="#PCX">PCX file format</a>
34
<li><a href="#PSD">PSD file format (DeviceN color model)</a>
35
</ul>
36
<li><a href="#High-level">High level formats</a>
37
<ul>
38
<li><a href="#PDF">PDF file output</a>
39
<li><a href="#PS">PostScript file output</a>
40
<li><a href="#EPS">EPS file output</a>
41
<li><a href="#PXL">PCL-XL file output</a>
42
</ul>
43
<li><a href="#Display_devices">Display devices</a>
44
<ul>
45
<li><a href="#x11_devices">X Window System</a>
46
<li><a href="#display_device">display device (MS Windows, OS/2, gtk+)</a>
47
</ul>
48
<li><a href="#IJS">IJS - Inkjet and other raster devices</a>
49
<li><a href="#Rinkj">Rinkj - Resplendent inkjet driver</a>
50
<li><a href="#HP_ijs">HP Deskjet official drivers</a>
51
<li><a href="#gimp-print">Gimp-Print driver collection</a>
52
<li><a href="#Win">MS Windows printers</a>
53
<li><a href="#SPARCprinter">Sun SPARCprinter</a>
54
<ul>
55
<li><a href="#SPARC_install">Installation</a>
56
<li><a href="#SPARC_problems">Problems</a>
57
</ul>
58
<li><a href="#Apple">Apple dot matrix printer</a>
59
<li><a href="#Test">Test devices</a>
60
<ul>
61
<li><a href="#Permute">Permutation (DeviceN color model)</a>
62
<li><a href="#SPOT">spotcmyk (DeviceN color model)</a> 
63
<li><a href="#XCF">XCF (DeviceN color model)</a>
64
<li><a href="#bitraw">Raw 'bit' devices</a>
65
</ul>
66
</ul></blockquote>
67
 
68
<!-- [1.2 end table of contents] =========================================== -->
69
 
70
<!-- [1.3 begin hint] ====================================================== -->
71
 
72
<p>For other information, see the <a href="Readme.htm">Ghostscript
73
overview</a>.  You may also be interested in <a href="Make.htm">how to
74
build Ghostscript</a> and <a href="Install.htm">install it</a>, as well as
75
the description of the <a href="Drivers.htm">driver interface</a>.
76
 
77
<p>Documentation for some older, superceded devices has been moved to
78
<a href="Deprecated.htm">another document</a>. In general such devices are deprecated
79
and will be removed in future versions of Ghostscript. In general all older printer
80
drivers can be replaced by the ijs interface and one of the available 3rd party raster
81
driver collections. We recommend moving to the ijs device for all such printing.</p>
82
 
83
<!-- [1.3 end hint] ======================================================== -->
84
 
85
<hr>
86
 
87
<!-- [1.0 end visible header] ============================================== -->
88
 
89
<!-- [2.0 begin contents] ================================================== -->
90
 
91
<h2><a name="Measurements"></a>Notes on measurements</h2>
92
 
93
<p>
94
Several different important kinds of measures appear throughout this
95
document: inches, centimeters and millimeters, points, and bits per pixel.
96
 
97
<dl>
98
 
99
<dt>Centimeters and millimeters</dt>
100
<dd>ISO standard paper sizes such as A4 and A3 are commonly represented in
101
the SI units of centimeters and millimeters.  Centimeters are abbreviated
102
<dfn><abbr>cm</abbr></dfn>, millimeters <dfn><abbr>mm</abbr></dfn>.  ISO A4 paper is
103
quite close to 210&times;297 millimeters (approximately 8.3&times;11.7
104
inches).</dd>
105
 
106
<dt>Inches</dt>
107
<dd>1 inch equals 2.54 centimeters.  The inch measure is sometimes
108
represented by <dfn><abr>in</abr></dfn> or a quotation mark (<abr>&quot;</abr>) to the right
109
of a measure, like 8.5in or 8.5&quot;. 
110
U.S. "letter" paper is exactly
111
8.5in&times;11in, approximately 21.6cm&times;27.9cm.  (See in the usage
112
documentation all the <a href="Use.htm#Known_paper_sizes">paper sizes
113
predefined in Ghostscript</a>.)</dd>
114
 
115
<dt>Points</dt>
116
<dd>Points are a measure traditionally used in the printing trade and now
117
in PostScript, which specifies exactly 72 points per inch (approximately
118
28.35 per centimeter).  The <a href="Use.htm#Known_paper_sizes">paper sizes
119
known to Ghostscript</a> are defined in the initialization file
120
<tt>gs_statd.ps</tt> in terms of points.</dd>
121
 
122
<dt>Dots per inch</dt>
123
<dd>Dots per inch or <dfn><abbr>dpi</abbr></dfn> is the common measure of 
124
printing resolution in the US.</dd>
125
 
126
<dt>Bits per pixel</dt>
127
<dd>Commonly abbreviated <dfn><abbr>bpp</abbr></dfn> this is the number of 
128
digital bits used to represent the color of each pixel. This is also referred
129
to as 'bit depth' or 'pixel depth'.</dd>
130
 
131
</dl>
132
 
133
<hr>
134
 
135
<h2><a name="File_formats"></a>Image file formats</h2>
136
 
137
<p>
138
Ghostscript supports output to a variety of image file formats
139
and is widely used for rasterizing postscript and pdf files.
140
A collection of such formats ('output devices' in Ghostscript terminology)
141
are described in this section.
142
</p>
143
 
144
<p>
145
Here are some commonly useful driver options that apply to all raster drivers.
146
Options specific to particular file formats are described in their respective
147
sections below.</p>
148
 
149
<blockquote><dl>
150
 
151
<dt>-sOutputFile=<em>filename</em></dt>
152
<dd><p>This is a general option telling Ghostscript what to name the output. 
153
It can either be a single filename '<tt>tiger.png</tt>' or a template
154
'<tt>figure-%03d.jpg</tt>' where the <tt>%03d</tt> is replaced by the page number.</p>
155
 
156
 
157
<dt>-r<em>res</em></dt>
158
<dt>-r<em>xres</em>x<em>yres</em></dt>
159
<dd><p>This option sets the resolution of the output file in dots per inch.
160
The default value if you don't specify this options is usually 72 <abbr>dpi</abbr>.</p></dd>
161
 
162
<dt>-dTextAlphaBits=<em>n</em></dt>
163
<dt>-dGraphicsAlphaBits=<em>n</em></dt>
164
<dd><p>These options control the use of subsample antialiasing. Their use is highly recommended
165
for producing high quality rasterizations of the input files. The size of the subsampling
166
box <em>n</em> should be 4 for optimum output, but smaller values can be used for faster
167
rendering. Antialiasing is enabled separately for text and graphics content.</p></dd>
168
 
169
</dl></blockquote>
170
 
171
<p>
172
It is also conventional to call Ghostscript with the '<tt>-dSAFER -dBATCH -dNOPAUSE</tt>' trio
173
of options when rasterizing to a file. These suppress interactive prompts and enable some 
174
security checks on the file to be run. Please see the <a href="Use.htm">Use documentation</a>
175
for a complete description.
176
</p>
177
 
178
<h3><a name="PNG"></a>PNG file format</h3>
179
 
180
<p><acronym>PNG</acronym> (pronounced 'ping') stands for Portable Network Graphics,
181
and is the recommended format for high-quality images. It supports full quality
182
color and transparency, offers excellent lossless compression of the image data,
183
and is widely supported. Please see the 
184
<a href="http://www.libpng.org/pub/png/pngintro.html" class="offsite">PNG website</a>
185
for a complete description of the format.</p>
186
 
187
<p>Ghostscript provides a variety of devices for <acronymn>PNG output
188
varying by bit depth. For normal use we recommend <tt>png16m</tt> for 24-bit RGB color,
189
or <tt>pnggray</tt> for grayscale. The png256, png16 and pngmono devices respectively
190
provide 8-bit color, 4-bit color and black-and-white for special needs.</p>
191
 
192
<p>The pngalpha device is 32-bit RGBA color with transparency 
193
indicating pixel coverage.  The background is transparent unless
194
it has been explicitly filled.  PDF 1.4 transparent files do not
195
give a transparent background with this device.  Text and graphics 
196
anti-aliasing are enabled by default.</p>
197
 
198
<h4>Options</h4>
199
 
200
<p>The pngalpha device has one option. 
201
The other png devices have no special options.</p>
202
 
203
<blockquote>
204
<dl>
205
<dt><b><tt>-dBackgroundColor=</tt></b><b><em>16#RRGGBB</em></b> (RGB color, default white = 16#ffffff)
206
<dd>For the <tt>pngalpha</tt> device only, 
207
set the suggested background color in the PNG bKGD chunk.  
208
When a program reading a PNG file does not support alpha
209
transparency, the PNG library converts the image using
210
either a background color if supplied by the program
211
or the bKGD chunk.
212
One common web browser has this problem, so when using
213
<b><tt>&lt;body bgcolor="CCCC00"&gt;</tt></b> on a web page
214
you would need to use <b><tt>-dBackgroundColor=16#CCCC00</tt></b>
215
when creating alpha transparent PNG images for use on the
216
page.
217
</dl>
218
</blockquote>
219
 
220
<h4>Examples</h4>
221
 
222
<p>Examples of how to use Ghostscript to convert postscript to PNG image files:
223
 
224
<blockquote>
225
<pre>
226
 <kbd>gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -dGraphicsAlphaBits=4 \
227
      -sOutputFile=tiger.png examples/tiger.png</kbd>
228
 
229
 <kbd>gs -dSAFER -dBATCH -dNOPAUSE -r150 -sDEVICE=pnggray -dTextAlphaBits=4 \
230
      -sOutputFile=doc-%02d.png doc.pdf</kbd>
231
</pre>
232
</blockquote>
233
<p></p> 
234
 
235
<h3><a name="JFIF"></a>JPEG file format (JFIF)</h3>
236
 
237
<p>
238
Ghostscript includes output drivers that can produce jpeg files
239
from postscript or pdf images. These are the <tt>jpeg</tt> and 
240
<tt>jpeggray</tt> devices.
241
 
242
<p>Technically these produce <a href="http://www.ijg.org/">Independent JPEG Group</a>
243
JFIF (JPEG File Interchange Format) files, the common sort found on the web.</p>
244
 
245
<p><strong>Please note</strong> that
246
JPEG is a compression method specifically intended for continuous-tone
247
images such as photographs, not for graphics, and it is therefore quite
248
unsuitable for the vast majority of page images produced with PostScript.
249
For anything other than pages containing simple images the lossy compression
250
of the jpeg format will result in poor quality output regardless of the input.
251
To learn more about the distinction, consult a reference about uses and abuses of JPEG,
252
such as the JPEG FAQ
253
 
254
<blockquote>
255
<a href="http://www.faqs.org/faqs/jpeg-faq/" class="offsite">http://www.faqs.org/faqs/jpeg-faq/</a>
256
</blockquote>
257
 
258
<h4>Examples</h4>
259
 
260
<p>
261
You can use the JPEG output drivers -- <b><tt>jpeg</tt></b> to produce
262
color JPEG files and <b><tt>jpeggray</tt></b> for grayscale JPEGs -- the
263
same as other file-format drivers: by specifying the device name and an
264
output file name, for example
265
 
266
<blockquote>
267
<pre><kbd>gs -sDEVICE=jpeg -sOutputFile=foo.jpg foo.ps</kbd></pre>
268
</blockquote>
269
 
270
<h4>Options</h4>
271
 
272
<p>
273
The JPEG devices support several special parameters to control the JPEG
274
"quality setting" (DCT quantization level).</p>
275
 
276
<blockquote>
277
<dl>
278
<dt><b><tt>-dJPEGQ=</tt></b><b><em>N</em></b> (integer from 0 to 100, default 75)
279
<dd>Set the quality level <b><em>N</em></b> according to the widely used
280
IJG quality scale, which balances the extent of compression against the
281
fidelity of the image when reconstituted.  Lower values drop more
282
information from the image to achieve higher compression, and therefore
283
have lower quality when reconstituted.
284
 
285
<dt><b><tt>-dQFactor=</tt></b><b><em>M</em></b> (float from 0.0 to 1.0)
286
<dd>Adobe's QFactor quality scale, which you may use in place of
287
<b><tt>JPEGQ</tt></b> above.  The QFactor scale is used by PostScript's
288
DCTEncode filter but is nearly unheard-of elsewhere.
289
</dl>
290
</blockquote>
291
 
292
<p>
293
At this writing the default JPEG quality level of 75 is equivalent to
294
<b><tt>-dQFactor=0.5</tt></b>, but the JPEG default might change in the
295
future.  There is currently no support for any additional JPEG
296
compression options, such as the other DCTEncode filter parameters.
297
</p>
298
 
299
 
300
<h3><a name="PNM"></a>PNM</h3>
301
 
302
<p>The PNM (portable network map) family of formats are very simple
303
uncompressed image formats commonly used on unix-like systems. They
304
are particularly useful for testing or as input to an external conversion
305
utility.</p>
306
 
307
<p>A wide variety of data formats and depths is supported. Devices include
308
<tt>pbm
309
   pbmraw pgm pgmraw pgnm pgnmraw pnm pnmraw ppm ppmraw pkm pkmraw pksm
310
   pksmraw</tt>.
311
</p>
312
 
313
<h3><a name="TIFF"></a>TIFF file formats</h3>
314
 
315
<p><acronym>TIFF</acronym> is a loose collection of formats, now largely
316
superceded by <acronym>PNG</acronym> except in applications where backward
317
compatibility or special compression is required. The <acronym>TIFF</acronym> 
318
file format is described in the
319
<a href="http://partners.adobe.com/asn/developer/pdfs/tn/TIFF6.pdf" class="offsite">TIFF 6.0 Specification</a> 
320
published by Adobe Systems Incorporated.</p>
321
 
322
<p>
323
There are two unrelated sets of TIFF drivers.  There are five color TIFF
324
drivers that produce uncompressed output:
325
 
326
<blockquote>
327
<dl>
328
<dt><b><tt>tiffgray</tt></b>
329
<dd>Produces 8-bit gray output.
330
<dt><b><tt>tiff12nc</tt></b>
331
<dd>Produces 12-bit RGB output (4 bits per component).
332
<dt><b><tt>tiff24nc</tt></b>
333
<dd>Produces 24-bit RGB output (8 bits per component).
334
<dt><b><tt>tiff32nc</tt></b>
335
<dd>Produces 32-bit CMYK output (8 bits per component).
336
<dt><b><tt>tiffsep</tt></b>
337
<dd>
338
The tiffsep device creates multiple output files.  The device creates a single
339
32 bit composite CMYK file (tiff32nc format) and multiple tiffgray files.
340
A tiffgray file is created for each separation.
341
 
342
<p>
343
The file specified via the OutputFile command line parameter will contain 
344
CMYK data. This data is based upon the CMYK data within the file plus 
345
an equivalent CMYK color for each spot colors which is present. The equivalent
346
CMYK color for each spot colors is determined using the alternate tint transform
347
function specified in Separation and DeviceN color spaces. Since 
348
this file is created based upon having color planes for each colorant, the
349
file will correctly represent the appearance of overprinting with spot colors.
350
 
351
<p>
352
File names for the separations for the
353
CMYK colorants are created by appending '.Cyan.tif', '.Magenta.tif'
354
'.Yellow.tif' or '.Black.tif' to the to the end of the file name
355
specified via the OutputFile parameter.  File names for the spot
356
color separation files are created by appending '.sn.tif' (where n
357
is the spot color number, see below) to the end of the file name specified via
358
the OutputFile parameter.
359
 
360
<p>
361
Internally each spot color is assigned a spot color number.  These
362
numbers start with 0 for the first spot color.  The spot color
363
numbers are assigned in the same order as the names are printed to
364
stderr (see below).  This order also matches the ordering in the
365
SeparationColorNames list, if this parameter is specified.  The
366
spot color numbers are not affected by the SeparationOrder parameter.
367
 
368
<p>
369
The names of spot colors may be specified via the SeparationColorNames device
370
parameters.  Or the tiffsep device will automatically recognize spot color
371
names if <b><tt>-dMaxSeparations=8</tt></b> is specified on the
372
command line.
373
 
374
<p>
375
If only a subset of the colorants for a file is desired then the separations
376
to be output can be selected via the SeparationOrder
377
device parameter.  When colorants are selected via the
378
SeparationOrder parameter, the composite CMYK output contains
379
the equivalent CMYK data only for the selected colorants.  
380
 
381
<p>
382
The tiffsep device also prints the names of any spot colors
383
detected within a document to stderr.  (stderr is also use for the
384
output from the bbox device.)  For each spot color the name of
385
the color is printed preceded by '%%SeparationName:  '.  This
386
provides a simple mechanism for users and external applications to be informed about
387
the names of spot colors with a document.
388
 
389
<p>
390
Ghostscript currently limits the size of a pixel to 64 bits.
391
Since the tiffsep device uses 8 bits per colorant,  the device can handle
392
a maximum of 8 colorants per pass.  However it is possible to
393
handle more than 8 colorants by doing multiple passes.  For each
394
pass after the first one, the names of all of the separations need
395
to be specified via the SeparationColorNames parameter and the
396
names of the desired separations need to be specified via the
397
SeparationOrder parameter.  It is
398
possible to create an overall CMYK composite for more than 8
399
colorants by then adding together (via an external application like
400
imagemagick) the composite CMYK output files from the individual
401
Ghostscript passes.
402
</dl>
403
</blockquote>
404
 
405
<p>
406
The remaining TIFF drivers all produce black-and-white output with different
407
compression modes:
408
 
409
<blockquote>
410
<dl>
411
<dt><b><tt>tiffcrle</tt></b>
412
<dd>G3 fax encoding with no EOLs
413
<dt><b><tt>tiffg3</tt></b>
414
<dd>G3 fax encoding with EOLs
415
<dt><b><tt>tiffg32d</tt></b>
416
<dd>2-D G3 fax encoding
417
<dt><b><tt>tiffg4</tt></b>
418
<dd>G4 fax encoding
419
<dt><b><tt>tifflzw</tt></b>
420
<dd>LZW-compatible (tag = 5) compression
421
<dt><b><tt>tiffpack</tt></b>
422
<dd>PackBits (tag = 32773) compression
423
</dl>
424
</blockquote>
425
 
426
 
427
<h4>Options</h4>
428
 
429
<p>
430
The black-and-white TIFF drivers support creation of files that are
431
comprised of more than a single strip.  Multi-strip files reduce the memory
432
requirement on the reader, since readers need only store and process one
433
strip at a time.  These drivers provide two parameters beyond the standard
434
set:
435
 
436
<blockquote>
437
<dl>
438
<dt><b><tt>-dMaxStripSize=</tt><em>N</em></b> (non-negative integer; default = 0)
439
<dd>Set the maximum (uncompressed) size of a strip.
440
 
441
<dt><b><tt>-dAdjustWidth</tt><em>state</em></b> (0 or 1; default = 1)
442
<dd>If this option set then if the requested page width is close to either A4 (1728 columns) or B4 (2048 columns), set the page width to A4 or B4 respectively.
443
This behavior is the default. Pass -dAdjustWidth=0 to turn off this behavior.
444
</dl></blockquote>
445
 
446
<p>
447
The TIFF 6.0 specification, Section 7, page 27, recommends that the size of
448
each strip be about 8 Kbytes.  As an example, to generate the 'tiger' in
449
tiffg4 format that has the recommended strip size, use:
450
 
451
<blockquote><pre>
452
gs -sDEVICE=tiffg4 -sOutputFile=tiger.tiff -dMaxStripSize=8192 examples/tiger.eps
453
</pre></blockquote>
454
 
455
<p>
456
If the value of the <tt>MaxStripSize</tt> parameter is smaller than a
457
single image row, then no error will be generated, and the TIFF file will be
458
generated correctly using one row per strip.  Note that smaller strip sizes
459
increase the size of the file by increasing the size of the StripOffsets and
460
StripByteCounts tables, and by reducing the effectiveness of the compression
461
which must start over for each strip.
462
 
463
<p>
464
If the value of MaxStripSize is 0 (the default), then the entire image will
465
be a single strip.
466
 
467
<p>
468
Since v. 8.51 the logical order of bits within a byte, FillOrder, tag = 266 is
469
controlled by a parameter:
470
 
471
<blockquote>
472
<dl>
473
<dt><b><tt>-dFillOrder=</tt><em>1 | 2 </em></b> (default = 1)
474
<dd>If this option set to 2 then pixels are arranged within a byte such that pixels
475
with lower column values are stored in the lower-order bits of the byte; otherwise
476
pixels are arranged in reverse order.
477
</dl></blockquote>
478
 
479
Earlier versions of Ghostscript always generated TIFF files with FillOrder = 2.
480
According to the TIFF 6.0 specification, Section 8, page 32, support of
481
FillOrder = 2 is not required in a Baseline TIFF compliant reader
482
 
483
<h3><a name="fax"></a>FAX</h3>
484
 
485
<p>
486
Ghostscript supports a variety of fax encodings, both encapsulated in 
487
<acronym>TIFF</acronym> (see above) and as raw files. The later case is
488
described here.
489
</p>
490
 
491
<p>
492
The fax devices are <tt>faxg3</tt>, <tt>faxg32d</tt> and <tt>faxg4</tt>.
493
</p>
494
 
495
<h3><a name="BMP"></a>BMP</h3>
496
 
497
<p>
498
BMP is a simple uncompressed image format commonly used on MS Windows.
499
It is supported by the devices <tt>bmpmono bmpgray bmpsep1
500
   bmpsep8 bmp16 bmp256 bmp16m bmp32b</tt>.
501
</p>
502
 
503
<h3><a name="PCX"></a>PCX</h3>
504
 
505
<p>
506
PCX is an image format sometimes used on MS Windows. It has some support
507
for image compression and alternate color spaces, and so can be a useful
508
way to output CMYK. 
509
It is supported by the <tt>pcxmono pcxgray pcx16 pcx256 pcx24b pcxcmyk</tt> 
510
series of devices.
511
</p>
512
 
513
<h3><a name="PSD"></a>PSD</h3>
514
 
515
<p>
516
PSD is the image format used by Adobe Photoshop.
517
It is supported by the <tt>psdcmyk</tt> and <tt>psdrgb</tt> devices.
518
Of special interest with the <tt>psdcmyk</tt> device is that it supports spot
519
colors.  The names of the spot colors
520
must be specified prior to opening a page. This can be done via adding the
521
following to the command line: <b><tt>-c "<< /SeparationColorNames [ /Name1 /Name2 ]
522
>> setpagedevice" -f</tt></b>. The <tt>psdcmyk</tt> device will support up to four
523
spot colors.
524
To view the results properly, a color needs to be assigned to each of
525
the spot color planes within Photoshop.  (Ghostscript assigns black as
526
the default color for all spot colors in the psdcmyk device.)
527
 
528
 
529
 
530
</p>
531
 
532
<h2><a name="High-level"></a>High-level devices</h2>
533
 
534
<p>
535
In addition to raster image files, Ghostscript supports output in a number
536
of 'high-level' formats. These allow Ghostscript to preserve (as much as
537
possible) the drawing elements of the input file maintaining flexibility,
538
resolution independence, and editability.</p>
539
 
540
<h3><a name="PDF"></a>PDF writer</h3>
541
 
542
<p>The <tt>pdfwrite</tt> device outputs PDF.  Please refer to
543
<a href="Ps2pdf.htm">Ps2pdf.htm</a> for the extensive <tt>pdfwrite</tt>
544
device options.</p>
545
 
546
<h3><a name="PS"></a>PS writer</h3>
547
 
548
<p>The <tt>pswrite</tt> device outputs postscript.</p>
549
 
550
<h4>Options</h4>
551
 
552
<blockquote>
553
<dl>
554
<dt><b><tt>-dLanguageLevel=</tt><em>1 | 1.5 | 2 | 3</em></b> (default is 2)
555
<dd>Set the language level of the generated file.
556
Language level 1.5 is language level 1 with color extensions. 
557
Currently language level 3 generates the same PostScript as 2.
558
</dl></blockquote>
559
 
560
<h3><a name="EPS"></a>EPS writer</h3>
561
 
562
<p>The <tt>epswrite</tt> device outputs encapsulated postscript.</p>
563
 
564
<h4>Options</h4>
565
 
566
<blockquote>
567
<dl>
568
<dt><b><tt>-dLanguageLevel=</tt><em>1 | 1.5 | 2 | 3</em></b> (default is 2)
569
<dd>Set the language level of the generated file.
570
Language level 1.5 is language level 1 with color extensions. 
571
Currently language level 3 generates the same PostScript as 2.
572
</dl></blockquote>
573
 
574
<h3><a name="PXL"></a>PXL</h3>
575
 
576
<p>The <tt>pxlmono</tt> and <tt>pxlcolor</tt> devices output HP PCL-XL,
577
a graphic language understood by many recent laser printers.
578
 
579
<p>
580
 
581
<hr>
582
 
583
<h2><a name="Display_devices"></a>Display Devices</h2>
584
 
585
<p>
586
Ghostscript is often used for screen display of postscript and pdf documents.
587
In many cases, a client or 'viewer' application calls the Ghostscript engine
588
to do the rasterization and handles the display of the resulting image itself,
589
but it is also possible to invoke Ghostscript directly and select an output
590
device which directly handles displaying the image on screen.
591
 
592
<p>
593
This section describes the various display-oriented devices that are available
594
in Ghostscript.
595
 
596
<h3><a name="x11_devices"></a>X Window System</h3>
597
 
598
<p>
599
Perhaps the most common use of of a display device is with the X Window System
600
on unix-like systems. It is the default device on the command line client on
601
such systems, and is used more creatively by the gv client application.
602
 
603
<p>
604
The available devices are:
605
 
606
<dl>
607
<dt><b>x11</b>
608
<dd>This is the default device, handling display on X11R6.
609
 
610
<dt><b>x11alpha</b>
611
<dd>This is the x11 device, but with antialiasing. It is equivalent to
612
invoking the x11 device with the options <tt>-dGraphicsAlphaBits=4 
613
-dTextAlphaBits=4 -dMaxBitmap=50000000</tt>.
614
 
615
<dt><b>x11cmyk</b>
616
<dd>This device rasterizes the image in the CMYK color space, then flattens
617
it to RGB for display. It's intended for testing only.
618
 
619
<dt><b>x11mono</b>
620
<dd>This is a strict black-and-white device for 1-bit monochrome displays.
621
 
622
<dt><b>x11gray2</b>
623
<dd>This is a device for 2 bpp (4-level) monochrome displays.
624
 
625
<dt><b>x11gray4</b>
626
<dd>This is a device for 4 bpp (16-level) monochrome displays.
627
</dl>
628
 
629
<h3><a name="display_device"></a>display device (MS Windows, OS/2, gtk+)</h3>
630
<p>
631
The <b><tt>display</tt></b> device is used by the MS Windows, 
632
OS/2 and the gtk+ versions of ghostscript.
633
</p>
634
 
635
<h4>Options</h4>
636
 
637
<p>The display device has several user settable options.</p>
638
 
639
<blockquote>
640
<dl>
641
<dt><b><tt>-dDisplayFormat=</tt></b><b><em>N</em></b> (integer bit-field)
642
<dd>Some common values are 16#30804 for Windows RGB, 16#804 for gtk+ RGB,
643
16#20101 for Windows monochrome, 16#102 for gtk+ monochrome, 
644
16#20802 grayscale, 16#20808 for CMYK, 16#a0800 for separations.
645
The bit fields are
646
<ul>
647
<li> native (1), gray (2), RGB (4), CMYK (8), or separation (80000) 
648
  color spaces.
649
<li> unused first byte (40) or last byte (80).
650
<li> 1 (100), 4 (400), or 8 (800) bits/component.
651
<li> bigendian (00000 = RGB) or littleendian (10000 = BGR) order.
652
<li> top first (20000) or bottom first (00000) raster.
653
<li> 16 bits/pixel with 555 (00000) or 565 (40000) bitfields.
654
</ul>
655
For more details, see the <a href="API.htm#display">Ghostscript 
656
Interpreter API.</a>
657
<dt><b><tt>-dDisplayResolution=</tt></b><b><em>DPI</em></b>
658
<dd>Set the initial resolution resolution for the display device.
659
This is used by the Windows clients to set the display device
660
resolution to the Windows display logical resolution.
661
This can be overriden by the command line option 
662
<b><tt>-r</tt><em>DPI</em></b>.
663
</dl>
664
 
665
</blockquote>
666
 
667
When using the separation color space, the following options may be set
668
using setpagedevice, as described in the PostScript Language Reference:
669
 
670
<blockquote>
671
<dl>
672
<dt><b><tt>SeparationColorNames</tt></b>
673
<dd>An array giving the names of the spot colors
674
 
675
<dt><b><tt>SeparationOrder</tt></b>
676
<dd>An array giving the names and order of the colorants 
677
to be output.
678
</dl>
679
</blockquote>
680
 
681
 
682
<hr>
683
 
684
<h2><a name="IJS"></a>IJS - Inkjet and other raster devices</h2>
685
 
686
<p>
687
IJS is a relatively new initiative to improve the quality and ease of
688
use of inkjet printing with Ghostscript. Using IJS, you can add new
689
drivers, or upgrade existing ones, without recompiling Ghostscript.
690
All driver authors are encouraged to adapt their drivers for IJS, and
691
if there is an IJS driver available for your printer, it should be
692
your first choice.
693
</p>
694
 
695
<p>Please see the <a href="http://www.linuxprinting.org/ijs/">IJS web
696
page</a> for more information about IJS, including a listing of
697
IJS-compatible drivers.
698
</p>
699
 
700
<p>
701
A typical command line for IJS is:
702
</p>
703
 
704
<blockquote>
705
<b><tt>
706
gs -dSAFER -sDEVICE=ijs -sIjsServer=hpijs 
707
 -sDeviceManufacturer=HEWLETT-PACKARD -sDeviceModel='DESKJET 990'
708
 -dIjsUseOutputFD -sOutputFile=/dev/usb/lp1 -dNOPAUSE --
709
 examples/tiger.eps
710
</tt></b>
711
</blockquote>
712
 
713
 
714
<p>
715
Individual IJS command line parameters are as follows:
716
</p>
717
 
718
<dl>
719
<dt><b><tt>-sIjsServer=</tt></b><em>{path}</em>
720
<dd>Sets the pathname for the IJS server (ie printer driver).
721
Ghostscript will spawn a new process for this driver, and communicate
722
with it using the IJS protocol. The pathname need not be absolute,
723
as the PATH environment variable is searched, but it's probably a good
724
idea for robustness and security. Note also that if -dSAFER is not
725
specified, it's possible for PostScript code to set this parameter,
726
so it can cause arbitrary code to be executed. See the section on <a
727
href="Use.htm#Security">Security</a> for more information.
728
</dl>
729
 
730
<dl>
731
<dt><b><tt>-sDeviceManufacturer=</tt></b><em>{name}</em>
732
<dt><b><tt>-sDeviceModel=</tt></b><em>{name}</em>
733
<dd>These parameters select the device according to IEEE-1284 standard
734
device ID strings. In general, consult the documentation for the
735
driver to find the appropriate settings. Note that, if the value
736
contains a space, you'll want to quote the value in your shell, as
737
in the example above.
738
</dl>
739
 
740
<dl>
741
<dt><b><tt>-sIjsParams=</tt></b><em>{params}</em>
742
<dd>This parameter allows you to set arbitrary IJS parameters on
743
the IJS driver. The format is a comma-separated list of
744
<b><tt>key=value</tt></b> pairs. If it is necessary to send a
745
value containing a comma or backslash, it can be escaped with
746
a backslash. Thus, <b><tt>'-sIjsParams=Foo=bar,Baz=a\,b'</tt></b> sets
747
the parameter Foo to "bar", and Baz to "a,b".
748
</dl>
749
 
750
<dl>
751
<dt><b><tt>-dIjsUseOutputFD</tt></b>
752
<dd>This flag indicates that Ghostscript should open the output file
753
and pass a file descriptor to the server. If not set, Ghostscript
754
simply passes the filename set in OutputFile to the server. In most
755
cases, this flag won't matter, but if you have a driver which works
756
only with OutputFD (such as hpijs 1.0.2), or if you're using the
757
-sOutputFile="|cmd" syntax, you'll need to set it.
758
</dl>
759
 
760
<dl>
761
<dt><b><tt>-dBitsPerSample=</tt></b><em>N</em>
762
<dd>This parameter controls the number of bits per sample. The
763
default value of 8 should be appropriate for most work. For monochrome
764
images, use -dBitsPerSample=1.
765
</dl>
766
 
767
<p>Generic Ghostscript options that are particularly relevant for IJS
768
are summarized below:
769
</p>
770
 
771
<dl>
772
<dt><b><tt>-r</tt></b><em>number</em>
773
<br><b><tt>-r</tt></b><em>number1</em><b><tt>x</tt></b><em>number2</em>
774
<dd>Sets the resolution, in dpi. If the resolution is not specified,
775
Ghostscript queries the IJS server to determine the preferred resolution.
776
When the resolution is specified, it overrides the value (if any)
777
preferred by the IJS server.
778
</dl>
779
 
780
<dl>
781
<dt><b><tt>-dDuplex</tt></b>
782
<dt><b><tt>-dTumble</tt></b>
783
<dd>These flags enable duplex (two-sided) printing. Tumble controls
784
the orientation. When Tumble is false, the pages
785
are oriented suitably at the left or right. When Tumble is true,
786
the pages are oriented suitably for binding at the top or
787
bottom.
788
</dl>
789
 
790
<dl>
791
<dt><b><tt>-sProcessColorModel=</tt></b><em>{name}</em>
792
<dd>Use this flag to select the process color model. Suitable values
793
include DeviceGray, DeviceRGB, and DeviceCMYK.
794
</dl>
795
 
796
<h3>Building IJS</h3>
797
 
798
<p> IJS is included by default on Unix gcc builds, and also in
799
autoconf'ed builds. Others may need some makefile tweaking. First,
800
make sure the IJS device is selected:
801
 
802
<blockquote>
803
DEVICE_DEVS2=$(DD)ijs.dev
804
</blockquote>
805
 
806
<p> Next, make sure that the path and execution type are set in
807
the top level makefile. The values for Unix are as follows:
808
 
809
<blockquote>
810
IJSSRCDIR=ijs
811
IJSEXECTYPE=unix
812
</blockquote>
813
 
814
<p> At present, "unix" and "win" are the only supported values for
815
IJSEXECTYPE. If neither sounds appropriate for your system, it's
816
possible that more porting work is needed.
817
 
818
<p> Last, make sure that ijs.mak is included in the top level makefile.
819
It should be present right after the include of icclib.mak.
820
 
821
<p> IJS is not inherently platform-specific. We're very much interested
822
in taking patches from people who have ported it to non-mainstream
823
platforms. And once it's built, you won't have to recompile Ghostscript
824
to support new drivers!
825
 
826
<h2><a name="Rinkj"></a>Rinkj - Resplendent inkjet driver</h2>
827
 
828
<p>The Rinkj driver is an experimental new driver, capable of driving
829
some Epson printers at a very high level of quality. It is not
830
currently recommended for the faint of heart.</p>
831
 
832
<p>You will need to add the following line to your makefile:
833
 
834
<blockquote>
835
DEVICE_DEVS2=$(DD)rinkj.dev
836
</blockquote>
837
 
838
<p>Most of the configuration parameters, including resolution, choice
839
of printer model, and linearization curves, are in a separate setup
840
file. In addition, we rely heavily on an ICC profile for mapping
841
document colors to actual device colors.</p>
842
 
843
<p>A typical command line invocation is:</p>
844
 
845
<blockquote><tt>
846
gs -r1440x720 -sDEVICE=rinkj -sOutputFile=/dev/usb/lp0
847
  -sSetupFile=lib/rinkj-2200-setup -sProfileOut=2200-cmyk.icm
848
  -dNOPAUSE -dBATCH file.ps
849
</tt></blockquote>
850
 
851
<p>
852
Individual Rinkj command line parameters are as follows:
853
</p>
854
 
855
<dl>
856
<dt><b><tt>-sSetupFile=</tt></b><em>{path}</em>
857
<dd>Specifies the path for the setup file.
858
 
859
<dt><b><tt>-sProfileOut=</tt></b><em>{path}</em>
860
<dd>Specifies the path for the output ICC profile. This profile should
861
be a <i>link</i> profile, mapping the ProcessColorModel (DeviceCMYK by
862
default) to the device color space.
863
</dl>
864
 
865
<p>For 6- and 7-color devices, the target color space for the output
866
profile is currently a 4-component space. The conversion from this
867
into the 6- or 7-color space (the "ink split") is done by lookup
868
tables in the setup file.</p>
869
 
870
<p>Setup files are in a simple "Key: value" text format. Relevant keys
871
are:</p>
872
 
873
<dl>
874
<dt><b><tt>Manufacturer:</tt></b><em>{name}</em>
875
<dt><b><tt>Model:</tt></b><em>{name}</em>
876
<dd>The manufacturer and model of the individual device, using the
877
same syntax as IEEE printer identification strings. Currently, the
878
only supported manufacturer string is "EPSON", and the only supported
879
model strings are "Stylus Photo 2200" and "Stylus Photo 7600".
880
 
881
<dt><b><tt>Resolution:</tt></b><em>{x-dpi}</em>x<em>{y-dpi}</em>
882
<dd>The resolution in dpi. Usually, this should match the
883
Ghostscript resolution set with the <tt>-r</tt> switch. Otherwise,
884
the page image will be scaled.
885
 
886
<dt><b><tt>Dither:</tt></b><em>{int}</em>
887
<dd>Selects among variant dither options. Currently, the choices are
888
<tt>1</tt> for one-bit dither, and <tt>2</tt>, for a 2-bit variable
889
dot dither.
890
 
891
<dt><b><tt>Aspect:</tt></b><em>{int}</em>
892
<dd>Controls the aspect ratio for highlight dot placement. Valid
893
values are <tt>1</tt>, <tt>2</tt>, and <tt>4</tt>. For best results,
894
choose a value near the x resolution divided by the y resolution. For
895
example, if resolution is 1440x720, aspect should be 2.
896
 
897
<dt><b><tt>Microdot:</tt></b><em>{int}</em>
898
<dd>Chooses a microdot size. On EPSON devices, this value is passed
899
directly through to the "ESC ( e" command. See EPSON documentation
900
for further details (see, I <em>told</em> you this wasn't for the
901
faint of heart).
902
 
903
<dt><b><tt>Unidirectional:</tt></b><em>{int}</em>
904
<dd>Enables (1) or disables (0) unidirectional printing, which is
905
slower but possibly higher quality.
906
 
907
<dt><b><tt>AddLut:</tt></b><em>{plane}</em>
908
<dd>Adds a linearization look-up table. The plane is one of
909
"CcMmYKk". The lookup table data follows. The line immediately
910
following AddLut is the number of data points. Then, for each data
911
point is a line consisting of two space-separated floats - the output
912
value and the input value. If more than one LUT is specified for a
913
single plane, they are applied in sequence.
914
</dl>
915
 
916
<p>A typical setup file is supplied in <tt>lib/rinkj-2200-setup</tt>.
917
It is configured for the 2200, but can be adapted to the 7600 just by
918
changing the "Model" line.
919
 
920
<p>In addition, sample profiles are available at <a href="http://artofcode.com/rinkj/profiles/">artofcode.com/rinkj/profiles/</a>.
921
 
922
<p>A known issue with this driver is poor support for margins and
923
page size. In some cases, this will cause an additional page to be
924
ejected at the end of a job. You may be able to work around this by
925
supplying a cut-down value for <tt>-dDEVICEHEIGHTPOINTS</tt>, for
926
example 755 for an 8.5x11 inch page on the EPSON 2200.</p>
927
 
928
<h2><a name="HP_ijs"></a>HP Deskjet official drivers</h2>
929
 
930
<p>
931
HP provides official drivers for many of their Deskjet printer models.
932
In order to use these drivers, you will need the HP Inkjet Server as
933
well as Ghostscript, available from <a
934
href="http://hpinkjet.sourceforge.net">http://hpinkjet.sourceforge.net</a>.
935
This version of Ghostscript includes the patch from version 0.97 of
936
the hpijs software. If you are installing hpijs from an RPM, you will
937
only need the hpijs RPM, not the Ghostscript-hpijs one, as the code
938
needed to work with hpijs is already included.
939
 
940
<p>
941
Note that newer version of the hpijs drivers support the IJS protocol.
942
If you can, you should consider using the ijs driver instead. Among
943
other things, the hpijs Ghostscript driver is Unix-only, and is untested
944
on older Unix platforms.
945
 
946
<p>
947
As of the 0.97 version, hpijs supports the following printer models:
948
 
949
<dl><dt><b>e-Series:</b>
950
 <dd>e-20
951
<dt><b>DeskJet 350C Series:</b>
952
 <dd>350C
953
<dt><b>DeskJet 600C Series:</b>
954
 <dd>600C, 660C, 670/672C, 670TV, 680/682C
955
<dt><b>DeskJet 600C Series Photo:</b>
956
 <dd>610/612C, 640/648C, 690/692/693/694/695/697C
957
<dt><b>DeskJet 630C Series:</b>
958
 <dd>630/632C
959
<dt><b>DeskJet 800C Series:</b>
960
 <dd>810/812C, 830/832C, 840/842/843C, 880/882C, 895C
961
<dt><b>DeskJet 900C Series, PhotoSmart::</b>
962
 <dd>930/932C, 950/952C, 970C, PhotoSmart 1000/1100
963
<dt><b>DeskJet 990C, PhotoSmart:</b>
964
 <dd>960C, 980C, 990C, PhotoSmart 1215/1218
965
 
966
</dl>
967
 
968
<p>You will need to add the following line to your makefile:
969
 
970
<blockquote>
971
DEVICE_DEVS2=$(DD)DJ630.dev $(DD)DJ6xx.dev $(DD)DJ6xxP.dev $(DD)DJ8xx.dev $(DD)DJ9xx.dev $(DD)DJ9xxVIP.dev $(DD)AP21xx.dev
972
</blockquote>
973
 
974
<p>
975
Please see <a
976
href="http://hpinkjet.sourceforge.net">http://hpinkjet.sourceforge.net</a>
977
for more information about this driver. Thanks to the folks at HP,
978
especially David Suffield for making this driver available and working to
979
integrate it with Ghostscript.
980
</p>
981
 
982
<h2><a name="gimp-print"></a>Gimp-Print driver collection</h2>
983
 
984
<p>
985
The Gimp-Print project provides a large collection of printer drivers 
986
with an IJS interface. Please see their 
987
<a href="http://gimp-print.sourceforge.net/" class="offsite">website</a> 
988
for details.
989
</p>
990
 
991
<hr>
992
<h2><a name="Win"></a>MS Windows printers</h2>
993
 
994
<p>
995
This section was written by Russell Lang, the author of Ghostscript's
996
MS&nbsp;Windows-specific printer driver, and updated by
997
<a href="mailto:Pierre.Arnaud@opac.ch">Pierre Arnaud</a>,
998
the current maintainer.
999
</p>
1000
 
1001
<p>
1002
The <b><tt>mswinpr2</tt></b> device uses MS&nbsp;Windows printer drivers, and
1003
thus should work with any printer with device-independent bitmap (DIB)
1004
raster capabilities. The printer resolution cannot be selected directly
1005
using PostScript commands from Ghostscript: use the printer setup in the
1006
Control Panel instead. It is however possible to specify a maximum resolution
1007
for the printed document (see below).
1008
</p>
1009
 
1010
<p>
1011
If no Windows printer name is specified in <b><tt>-sOutputFile</tt></b>,
1012
Ghostscript prompts for a Windows printer using the standard Print Setup
1013
dialog box.  You must set the orientation to Portrait and the page size to
1014
that expected by Ghostscript; otherwise the image will be clipped.
1015
Ghostscript sets the physical device size to that of the Windows printer
1016
driver, but it does not update the PostScript clipping path.
1017
</p>
1018
 
1019
<p>
1020
If a Windows printer name is specified in <b><tt>-sOutputFile</tt></b> using
1021
the format <tt>"%printer%printer_name"</tt>, for instance
1022
</p>
1023
 
1024
<blockquote><b><tt>
1025
gs ... -sOutputFile="%printer%Apple LaserWriter II NT"
1026
</tt></b></blockquote>
1027
 
1028
<p>
1029
then Ghostscript attempts to open the Windows printer without prompting
1030
(except, of course, if the printer is connected to <b><tt>FILE:</tt></b>).
1031
Ghostscript attempts to set the Windows printer page size and orientation
1032
to match that expected by Ghostscript, but doesn't always succeed.  It uses
1033
this algorithm:
1034
</p>
1035
 
1036
<ol>
1037
<li>If the requested page size matches one of the Windows standard page
1038
sizes +/- 2mm, request that standard size.</li>
1039
 
1040
<li>Otherwise if the requested page size matches one of the Windows
1041
standard page sizes in landscape mode, ask for that standard size in
1042
landscape.</li>
1043
 
1044
<li>Otherwise ask for the page size by specifying only its dimensions.</li>
1045
 
1046
<li>Merge the requests above with the defaults.  If the printer driver
1047
ignores the requested paper size, no error is generated: it will print on
1048
the wrong paper size.</li>
1049
 
1050
<li>Open the Windows printer with the merged orientation and size.</li>
1051
</ol>
1052
 
1053
<p>
1054
The Ghostscript physical device size is updated to match the Windows
1055
printer physical device.
1056
</p>
1057
 
1058
<h3><a name="Win_properties"></a>Supported command-line parameters</h3>
1059
 
1060
<p>
1061
The <b><tt>mswinpr2</tt></b> device supports a limited number of command-line
1062
parameters (e.g. it does not support setting the printer resolution). The
1063
recognized parameters are the following:
1064
</p>
1065
 
1066
<blockquote>
1067
<dl>
1068
<dt><b><tt>-sDEVICE=mswinpr2</tt></b></dt>
1069
<dd>Selects the MS&nbsp;Windows printer device. If Ghostscript was not
1070
compiled with this device as the default output device, you have to specify
1071
it on the command line.</dd>
1072
 
1073
<dt><b><tt>-dNoCancel</tt></b></dt>
1074
<dd>Hides the progress dialog, which shows the percent of the document page
1075
already processed and also provides a <em>cancel</em> button. This option
1076
is useful if GS is intended to print pages in the background, without any
1077
user intervention.</dd>
1078
 
1079
<dt><b><tt>-sOutputFile=</tt></b><b>"%printer%<em>printer_name</em>"</b></dt>
1080
<dd>Specifies which printer should be used. The <em>printer_name</em> should be
1081
typed exactly as it appears in the Printers control panel, including spaces.</dd>
1082
 
1083
</dl>
1084
</blockquote>
1085
 
1086
<h3><a name="Win_options"></a>Supported options (device properties)</h3>
1087
 
1088
<p>
1089
Several extra options exist which cannot be set through the command-line,
1090
but only by executing the appropriate PostScript setup code. These options
1091
can be set through the inclusion of a setup file on the command-line:
1092
</p>
1093
 
1094
<blockquote><b><tt>
1095
gs ... setup.ps ...
1096
</tt></b></blockquote>
1097
 
1098
<p>
1099
The <tt>setup.ps</tt> file is responsible for the device selection, therefore
1100
you should not specify the <b><tt>-sDEVICE=mswinpr2</tt></b> option on the
1101
command-line if you are using such a setup file. Here is an example of such
1102
a setup file:
1103
</p>
1104
 
1105
<blockquote><pre>
1106
mark
1107
  /NoCancel      true                       % don't show the cancel dialog
1108
  /BitsPerPixel  4                          % force 4 bits/pixel
1109
  /UserSettings
1110
    &lt;&lt;
1111
      /DocumentName  (Ghostscript document) % name for the Windows spooler
1112
      /MaxResolution 360                    % maximum document resolution
1113
    &gt;&gt;
1114
  (mswinpr2) finddevice                     % select the Windows device driver
1115
  putdeviceprops
1116
setdevice
1117
</pre></blockquote>
1118
 
1119
<p>
1120
This example disables the progress dialog (same as the <tt><b>-dNoCancel</b></tt>
1121
option), forces a 4 bits/pixel output resolution and specifies additional user
1122
settings, such as the document name (which will be displayed by the Windows
1123
spooler for the queued document) and the maximum resolution (here 360&nbsp;dpi).
1124
It then finds and selects an instance of the MS&nbsp;Windows device printer
1125
and activates it. This will show the standard printer dialog, since no
1126
<tt><b>/OutputFile</b></tt> property was specified.
1127
</p>
1128
 
1129
<p>
1130
The following options are available:
1131
</p>
1132
 
1133
<blockquote>
1134
<dl>
1135
<dt><b><tt>/NoCancel <em>boolean</em></tt></b></dt>
1136
<dd>Disables (hides) the progress dialog when set to <em><tt>true</tt></em> or
1137
show the progress dialog if not set or set to <em><tt>false</tt></em>.</dd>
1138
 
1139
<dt><b><tt>/OutputFile <em>string</em></tt></b></dt>
1140
<dd>Specifies which printer should be used. The string should be of the form
1141
<tt><b>%printer%<em>printer_name</em></b></tt>, where the <em>printer_name</em> should be
1142
typed exactly as it appears in the Printers control panel, including spaces.</dd>
1143
 
1144
<dt><b><tt>/QueryUser <em>integer</em></tt></b></dt>
1145
<dd>Shows the standard printer dialog (<tt><b>1</b></tt> or any other value),
1146
shows the <em>printer setup dialog</em> (<tt><b>2</b></tt>) or selects the
1147
<em>default Windows printer</em> without any user interaction (<tt><b>3</b></tt>).</dd>
1148
 
1149
<dt><b><tt>/BitsPerPixel <em>integer</em></tt></b></dt>
1150
<dd>Sets the device depth to the specified bits per pixel. Currently supported
1151
values are <tt><b>1</b></tt> (monochrome), <tt><b>4</b></tt> (CMYK with screening
1152
handled by Ghostscript) and <tt><b>24</b></tt> (True Color, dithering handled by
1153
the Windows printer driver; this option can produce huge print jobs).</dd>
1154
 
1155
<dt><b><tt>/UserSettings <em>dict</em></tt></b></dt>
1156
<dd>Sets additional options, defined in a dictionary. The following properties can
1157
be set:
1158
 
1159
<dl>
1160
<dt><b><tt>/DocumentName <em>string</em></tt></b></dt>
1161
<dd>Defines the user friendly document name which will be displayed by the
1162
Windows spooler.</dd>
1163
 
1164
<dt><b><tt>/DocumentRange <em>[n1 n2]</em></tt></b></dt>
1165
<dd>Defines the range of pages contained in the document. This information can
1166
be used by the printer dialog, in conjunction with the following property.</dd>
1167
 
1168
<dt><b><tt>/SelectedRange <em>[n1 n2]</em></tt></b></dt>
1169
<dd>Defines the selected range of pages. This information will be displayed in
1170
the printer dialog and will be updated after the user interaction. A PostScript
1171
program could check these values and print only the selected page range.</dd>
1172
 
1173
<dt><b><tt>/MaxResolution <em>dpi</em></tt></b></dt>
1174
<dd>Specifies the maximum tolerated output resolution. If the selected printer has
1175
a higher resolution than <tt><b>dpi</b></tt>, then Ghostscript will render the
1176
document with a submultiple of the printer resolution. For example, if 
1177
<tt><b>MaxResolution</b></tt> is set to 360 and the output printer supports
1178
up to 1200 dpi, then Ghostscript renders the document with an internal
1179
resolution of 1200/4=300 dpi. This can be very useful to reduce the memory
1180
requirements when printing in True Color on some high resolution ink-jet color
1181
printers.</dd>
1182
 
1183
</dl></dd>
1184
 
1185
</dl>
1186
</blockquote>
1187
 
1188
<p>
1189
These properties can be queried through the <tt><b>currentpagedevice</b></tt>
1190
operator. The following PostScript code snippet shows how to do it for some
1191
of the properties:
1192
</p>
1193
 
1194
<blockquote><pre>
1195
currentpagedevice /BitsPerPixel get ==  % displays the selected depth
1196
 
1197
currentpagedevice /UserSettings get     % get the additional options..
1198
/us exch def                            % ..and assign them to a variable
1199
 
1200
us /DocumentName get ==     % displays the document name
1201
us /SelectedRange get ==    % displays the selected page range
1202
 
1203
% other misc. information (don't rely on them)
1204
 
1205
us /Color get ==            % 1 => monochrome output, 2 => color output
1206
us /PrintCopies get ==      % displays the number of copies requested
1207
</pre></blockquote>
1208
 
1209
<p>
1210
There are a few undocumented parameters stored in the <tt><b>UserSettings</b></tt>
1211
dictionary. You should not rely on them. Their use is still experimental and
1212
they could be removed in a future version.
1213
</p>
1214
 
1215
<h3><a name="Win_duplex"></a>Duplex printing</h3>
1216
 
1217
<p>
1218
If the Windows printer supports the duplex printing feature, then it will
1219
also be available through the <b><tt>mswinpr2</tt></b> device. You can query
1220
for this support through the <b><tt>/Duplex</tt></b> property of the
1221
<b><tt>currentpagedevice</tt></b>. If it returns <b><tt>null</tt></b>, then
1222
the feature is not supported by the selected printer. Otherwise, <b><tt>true</tt></b>
1223
means that the printer is currently set up to print on both faces of the paper
1224
and <b><tt>false</tt></b> that it is not, but that it can.
1225
</p>
1226
 
1227
<p>
1228
The following example shows how to print on both faces of the paper (using
1229
the long side of the paper as the reference):
1230
</p>
1231
 
1232
<blockquote><pre>
1233
&lt;&lt; /Duplex true /Tumble false &gt;&gt; setpagedevice
1234
</pre></blockquote>
1235
 
1236
<p>
1237
</p>
1238
 
1239
 
1240
<hr>
1241
 
1242
<h2><a name="SPARCprinter"></a>Sun SPARCprinter</h2>
1243
 
1244
<p>
1245
This section was contributed by Martin Schulte.
1246
 
1247
<p>
1248
With a SPARCprinter you always buy software that enables you to do
1249
PostScript printing on it.  A page image is composed on the host, which
1250
sends a bitmap to the SPARCprinter through a special SBUS video interface.
1251
So the need for a Ghostscript interface to the SPARCPrinter seems low, but
1252
on the other hand, Sun's software prints some PostScript drawings
1253
incorrectly: some pages contain a thin vertical line of rubbish, and on
1254
some Mathematica drawings the text at the axes isn't rotated.  Ghostscript,
1255
however, gives the correct results.  Moreover, replacing proprietary
1256
software should never be a bad idea.
1257
 
1258
<p>
1259
The problem is that there has yet been no effort to make the SPARCPrinter
1260
driver behave like a BSD output filter.  I made my tests using the script
1261
shown here.
1262
 
1263
<h3><a name="SPARC_install"></a>Installation</h3>
1264
 
1265
<p>
1266
Add <b><tt>sparc.dev</tt></b> to <b><tt>DEVICE_DEVS</tt></b> and compile
1267
Ghostscript as described in the documentation on <a href="Make.htm">how to
1268
build Ghostscript</a>.  Afterwards you can use the following script as an
1269
example for printing after modifying it with the right pathnames --
1270
including for <b>{GSPATH}</b> the full pathname of the Ghostscript
1271
executable:
1272
 
1273
<blockquote>
1274
<pre>outcmd1='/vol/local/lib/troff2/psxlate -r'
1275
outcmd2='<b><em>{GSPATH}</em></b> -sDEVICE=sparc -sOUTPUTFILE=/dev/lpvi0 -'
1276
 
1277
if [ $# -eq 0 ]
1278
then
1279
  $outcmd1 | $outcmd2
1280
else
1281
  cat $* | $outcmd1 | $outcmd2
1282
fi
1283
</pre></blockquote>
1284
 
1285
<h3><a name="SPARC_problems"></a>Problems</h3>
1286
 
1287
<p>
1288
Since <b><tt>/dev/lpi</tt></b> can be opened only for exclusive use, if
1289
another job has it open (engine_ctl_sparc or another Ghostscript are the
1290
most likely candidates), Ghostscript stops with "Error: /invalidfileaccess
1291
in --.outputpage--"
1292
 
1293
<p>
1294
In case of common printer problems like being out of paper, a warning
1295
describing the reason is printed to stdout.  The driver tries access again
1296
each five seconds.  Due to a problem with the device driver (in the kernel)
1297
the reason for printer failure isn't always reported correctly to the
1298
program.  This is the case, for instance, if you open the top cover (error
1299
E5 on the printer's display).  Look at the display on the printer itself if
1300
a "Printer problem with unknown reason" is reported.  Fatal errors cause
1301
the print job to be terminated.
1302
 
1303
<p>
1304
Note: there is some confusion whether the resolution setting should be
1305
the integers 300 and 400, or the symbolic constants DPI300 and DPI400
1306
(defined in lpviio.h). Ghostscript releases have had it both ways. It
1307
is currently the latter. However, INOUE Namihiko reports (in bug
1308
<a href="http://bugs.ghostscript.com/show_bug.cgi?id=215256"
1309
class="offsite">#215256</a>)
1310
that the former works better for him. If anyone
1311
has a definitive answer, please let us know.
1312
 
1313
<hr>
1314
 
1315
<h2><a name="Apple"></a>Apple dot matrix printer</h2>
1316
 
1317
<p>
1318
This section was contributed by Mark Wedel
1319
&lt;<a href="mailto:master@cats.ucsc.edu">master@cats.ucsc.edu</a>&gt;.
1320
 
1321
<p>
1322
The Apple Dot Matrix Printer (DMP) was a parallel predecessor to the
1323
Imagewriter printer.  As far as I know, Imagewriter commands are a superset
1324
of the Dot Matrix printer's, so the driver should generate output that can
1325
be printed on Imagewriters.
1326
 
1327
<p>
1328
To print images, the driver sets the printer for unidirectional printing
1329
and 15 characters per inch (cpi), or 120dpi.  It sets the line feed to 1/9
1330
inch.  When finished, it sets the printer to bidirectional printing,
1331
1/8-inch line feeds, and 12 cpi.  There appears to be no way to reset the
1332
printer to initial values.
1333
 
1334
<p>
1335
This code does not set for 8-bit characters (which is required).  It also
1336
assumes that carriage return-newline is needed, and not just carriage
1337
return.  These are all switch settings on the DMP, and I have configured
1338
them for 8-bit data and carriage return exclusively.  Ensure that the Unix
1339
printer daemon handles 8-bit (binary) data properly; in my SunOS 4.1.1
1340
<b><tt>printcap</tt></b> file the string "<b><tt>ms=pass8,-opost</tt></b>"
1341
works fine for this.
1342
 
1343
<p>
1344
Finally, you can search <b><tt>devdemp.c</tt></b> for
1345
"<b><tt>Init</tt></b>" and "<b><tt>Reset</tt></b>" to find the strings that
1346
initialize the printer and reset things when finished, and change them to
1347
meet your needs.
1348
 
1349
 
1350
<hr>
1351
 
1352
<h2><a name="Test"></a>Special and Test devices</h2>
1353
 
1354
<p>
1355
The devices in this section are intended primarily for testing. They may
1356
be interesting as code examples, as well.
1357
 
1358
<h3>Raw 'bit' devices</h3>
1359
 
1360
<p>There are a collection of 'bit' devices that don't do any special formatting
1361
but output 'raw' binary data for the page images. These are used for benchmarking
1362
but can also be useful when you want to directly access the raster data.</p>
1363
 
1364
<p>
1365
The raw devices are <tt>bit bitrgb bitcmyk</tt>.
1366
 
1367
<h3><a name="Bounding_box_output"></a>Bounding box output</h3>
1368
 
1369
<p>
1370
There is a special <b><tt>bbox</tt></b> "device" that just prints the
1371
bounding box of each page.  You select it in the usual way:
1372
 
1373
<blockquote><b><tt>
1374
gs -dSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox
1375
</tt></b></blockquote>
1376
 
1377
<p>
1378
It prints the output in a format like this:
1379
 
1380
<blockquote>
1381
<pre><b><tt>%%BoundingBox: 14 37 570 719
1382
%%HiResBoundingBox: 14.308066 37.547999 569.495061 718.319158
1383
</tt></b></pre></blockquote>
1384
<p></p>
1385
 
1386
<p>
1387
Currently, it always prints the bounding box on <b><tt>stderr</tt></b>;
1388
eventually, it should also recognize <b><tt>-sOutputFile=</tt></b>.
1389
 
1390
<p>
1391
By default, white objects don't contribute to the bounding box because
1392
many files fill the whole page with white before drawing other objects.
1393
This can be changed by:
1394
 
1395
<blockquote><tt><b>
1396
<< /WhiteIsOpaque true >> setpagedevice
1397
</b></tt></blockquote>
1398
 
1399
<p>
1400
Note that this device, like other devices, has a resolution and a (maximum)
1401
page size.  As for other devices, the product (resolution x page size) is
1402
limited to approximately 500K pixels.  By default, the resolution is 4000
1403
DPI and the maximum page size is approximately 125", or approximately 9000
1404
default (1/72") user coordinate units.  If you need to measure larger pages
1405
than this, you must reset <em>both</em> the resolution and the page size in
1406
pixels, e.g.,
1407
 
1408
<blockquote><b><tt>
1409
gs -dNOPAUSE -dBATCH -sDEVICE=bbox -r100 -g500000x500000
1410
</tt></b></blockquote>
1411
 
1412
 
1413
<h3><a name="Permute"></a>Permutation (DeviceN color model)</h3>
1414
 
1415
<p>
1416
With no additional parameters, the device named "permute" looks
1417
to Ghostscript like a standard CMYK contone device, and outputs a
1418
PPM file, using a simple CMYK-&gt;RGB transform. This should be the
1419
baseline for regression testing.
1420
 
1421
<p>
1422
With the addition of <tt><b>-dPermute=1</b></tt>, the internal behavior changes
1423
somewhat, but in most cases the resulting rendered file should be the
1424
same. In this mode, the color model becomes "DeviceN" rather than
1425
"DeviceCMYK", the number of components goes to six, and the color
1426
model is considered to be the (yellow, cyan, cyan, magenta, 0, black)
1427
tuple. This is what's rendered into the memory buffer. Finally, on
1428
conversion to RGB for output, the colors are permuted back.
1429
 
1430
<p>
1431
As such, this code should check that all imaging code paths are
1432
64-bit clean. Additionally, it should find incorrect code that assumes
1433
that the color model is one of DeviceGray, DeviceRGB, or DeviceCMYK.
1434
 
1435
<p>
1436
Currently, the code has the limitation of 8-bit continuous tone
1437
rendering only. An enhancement to do halftones is planned as well. Note,
1438
however, that when testing permuted halftones for consistency, it is
1439
important to permute the planes of the default halftone accordingly, and
1440
that any file which sets halftones explicitly will fail a consistency
1441
check.
1442
 
1443
<h3><a name="SPOT"></a>spotcmyk (DeviceN color model)</h3>
1444
 
1445
<p>
1446
The <tt>spotcmyk</tt> device was created for debugging and testing of the DeviceN
1447
extensions to Ghostscript that were released in version 8.0.
1448
There are also another device (<tt>devicen</tt>) in the same
1449
source file.  It were created for testing however it are not actually useful
1450
except as example code.
1451
 
1452
<p>The <tt>spotcmyk</tt> device was also designed to provide example code for a
1453
device which supports spot colors.
1454
Spot colors need to be specified prior to opening the
1455
first page.
1456
This can be done via adding the
1457
following to the command line: <b><tt>-c "<< /SeparationColorNames [ /Name1 /Name2 ]
1458
>> setpagedevice" -f</tt></b>.
1459
 
1460
<p>
1461
The <tt>spotcmyk</tt> device produces a binary data file (similar to the bitcmyk
1462
device) for the CMYK data.  This data file has the name specified by the "OutputFile"
1463
parameter.
1464
The device also produces a binary data file (similar to the bitmono device)
1465
for each spot color plane.
1466
These data files have the name specified by the "OutputFile"
1467
parameter with "sn" appended to the end (where "n" is the spot color number 0 to 12)".
1468
 
1469
<p>
1470
After the <tt>spotcmyk</tt> device produces the binary data files, the files are read
1471
and PCX format versions of these files are created with ".pcx" appended to the binary
1472
source file name.
1473
 
1474
<p> If the the <tt>spotcmyk</tt> is being used with three spot colors and the 
1475
"OutputFile" parameter is <tt>xxx</tt> then the following files would be created 
1476
by the device:
1477
 
1478
<blockquote>
1479
<pre>xxx - binary CMYK data
1480
xxxs0 - binary data for first spot color
1481
xxxs1 - binary data for second spot color
1482
xxxs2 - binary data for third spot color
1483
xxx.pcx - CMYK data in PCX format
1484
xxxs0.pcx - first spot color in PCX format
1485
xxxs1.pcx - second spot color in PCX format
1486
xxxs2.pcx - third spot color in PCX format
1487
</pre>
1488
</blockquote>
1489
 
1490
<p>
1491
The <tt>spotcmyk</tt> device has the creation of the binary data files separated
1492
from the creation of the PCX files since the source file is intended as example
1493
code and many people may not be interested in the PCX format. The PCX format was
1494
chosen because it was simple to implement from preexisting code and viewers are
1495
available.  The PCX format does have the disadvantage that most of those viewers
1496
are on Windows.
1497
 
1498
 
1499
<h3><a name="XCF"></a>XCF (DeviceN color model)</h3>
1500
 
1501
<p>
1502
The XCF file format is the native image format for the GIMP program. This format
1503
is currently supported by two devices: <tt> xcfrgb</tt> and <tt>xcfcmyk</tt>.
1504
 
1505
<blockquote><em>
1506
We have been warned by the people supporting the GIMP program that they reserve
1507
the right to change the
1508
XCF format at anytime and thus these devices may become invalid. They are being
1509
included in the documentation because we have received some questions about
1510
these devices do.
1511
</em></blockquote>
1512
 
1513
<p>
1514
The XCF devices were created for testing of the DeviceN extensions to Ghostscript
1515
which were released in version 8.0.
1516
 
1517
<p>
1518
The <tt>xcfrgb</tt> device uses a DeviceRGB process color model and creates
1519
a normal XCF file.
1520
 
1521
<p>
1522
The <tt>xcfcmyk</tt> device was created as a means of viewing spot colors for
1523
those users that do not have access to either Photoshop <a href=PSD">(see the PSD
1524
devices)</a> or a PCX viewer <a href=SPOT">(see the <tt>spotcmyk</tt> device)</a>.
1525
 
1526
<p>
1527
The <tt>xcfcmyk</tt> device starts by using a DeviceCMYK process color model. The
1528
DeviceCMYK process color model allows the <tt>xcfcmyk</tt> device to also
1529
support spot colors. Spot colors need to be specified prior to opening the
1530
first page.
1531
This can be done via adding the
1532
following to the command line: <b><tt>-c "<< /SeparationColorNames [ /Name1 /Name2 ]
1533
>> setpagedevice" -f</tt></b>.
1534
 
1535
<p>
1536
After a page is complete, the <tt>xcfcmyk</tt> converts the CMYK image data into
1537
RGB for storing in the XCF output file.  The XCF format does not currently
1538
support CMYK data directly. The spot color planes are converted into alpha
1539
channel planes. This is done because the XCF format does not currently support
1540
spot colors.
1541
 
1542
</p>
1543
 
1544
<!-- [2.0 end contents] ==================================================== -->
1545
 
1546
<!-- [3.0 begin visible trailer] =========================================== -->
1547
<hr>
1548
 
1549
<p>
1550
<small>Copyright &copy; 1996-2002 artofcode LLC.
1551
All rights reserved.</small>
1552
 
1553
<p>
1554
This software is provided AS-IS with no warranty, either express or
1555
implied.
1556
 
1557
This software is distributed under license and may not be copied,
1558
modified or distributed except as expressly authorized under the terms
1559
of the license contained in the file LICENSE in this distribution.
1560
 
1561
For more information about licensing, please refer to
1562
http://www.ghostscript.com/licensing/. For information on
1563
commercial licensing, go to http://www.artifex.com/licensing/ or
1564
contact Artifex Software, Inc., 101 Lucas Valley Road #110,
1565
San Rafael, CA  94903, U.S.A., +1(415)492-9861.
1566
 
1567
<p>
1568
<small>Ghostscript version 8.53, 20 October 2005
1569
 
1570
<!-- [3.0 end visible trailer] ============================================= -->
1571
 
1572
</small></body>
1573
</html>
1574