1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Details of Ghostscript output devices</title>
<!-- $Id: Devices.htm,v 1.58.2.1 2004/01/30 06:57:34 giles Exp $ -->
<!-- Originally: devices.txt -->
<link rel="stylesheet" type="text/css" href="gs.css" title="Ghostscript Style">
</head>
<body>
<!-- [1.0 begin visible header] ============================================ -->
<!-- [1.1 begin headline] ================================================== -->
<h1>Details of Ghostscript output devices</h1>
<!-- [1.1 end headline] ==================================================== -->
<!-- [1.2 begin table of contents] ========================================= -->
<h2>Table of contents</h2>
<blockquote><ul>
<li><a href="#Measurements">Notes on measurements</a>
<li><a href="#File_formats">Image file formats</a>
<ul>
<li><a href="#PNG">PNG file format</a>
<li><a href="#JFIF">JPEG file format (JFIF)</a>
<li><a href="#PNM">PNM file format</a>
<li><a href="#TIFF">TIFF file formats</a>
<li><a href="#fax">fax file formats</a>
<li><a href="#BMP">BMP file format</a>
<li><a href="#PCX">PCX file format</a>
</ul>
<li><a href="#High-level">High level formats</a>
<ul>
<li><a href="#PDF">PDF file output</a>
<li><a href="#PS">PostScript file output</a>
<li><a href="#EPS">EPS file output</a>
<li><a href="#PXL">PCL-XL file output</a>
</ul>
<li><a href="#Display_devices">Display devices</a>
<ul>
<li><a href="#x11_devices">X Window System</a>
</ul>
<li><a href="#IJS">IJS - Inkjet and other raster devices</a>
<li><a href="#HP_ijs">HP Deskjet official drivers</a>
<li><a href="#gimp-print">Gimp-Print driver collection</a>
<li><a href="#Win">MS Windows printers</a>
<li><a href="#SPARCprinter">Sun SPARCprinter</a>
<ul>
<li><a href="#SPARC_install">Installation</a>
<li><a href="#SPARC_problems">Problems</a>
</ul>
<li><a href="#Apple">Apple dot matrix printer</a>
<li><a href="#Test">Test devices
<ul>
<li><a href="#Permute">Permutation (DeviceN color model)</a>
<li><a href="#bitraw">Raw 'bit' devices</a>
</ul>
</ul></blockquote>
<!-- [1.2 end table of contents] =========================================== -->
<!-- [1.3 begin hint] ====================================================== -->
<p>For other information, see the <a href="Readme.htm">Ghostscript
overview</a>. You may also be interested in <a href="Make.htm">how to
build Ghostscript</a> and <a href="Install.htm">install it</a>, as well as
the description of the <a href="Drivers.htm">driver interface</a>.
<p>Documentation for some older, superceeded devices has been moved to
<a href="Deprecated.htm">another document</a>. In general such devices are deprecated
and will be removed in future versions of ghostscript. In general all older printer
drivers can be replaced by the ijs interface and one of the available 3rd party raster
driver collections. We recommend moving to the ijs device for all such printing.</p>
<!-- [1.3 end hint] ======================================================== -->
<hr>
<!-- [1.0 end visible header] ============================================== -->
<!-- [2.0 begin contents] ================================================== -->
<h2><a name="Measurements"></a>Notes on measurements</h2>
<p>
Several different important kinds of measures appear throughout this
document: inches, centimeters and millimeters, points, and bits per pixel.
<dl>
<dt>Centimeters and millimeters</dt>
<dd>ISO standard paper sizes such as A4 and A3 are commonly represented in
the SI units of centimeters and millimeters. Centimeters are abbreviated
<dfn><abbr>cm</abbr></dfn>, millimeters <dfn><abbr>mm</abbr></dfn>. ISO A4 paper is
quite close to 210×297 millimeters (approximately 8.3×11.7
inches).</dd>
<dt>Inches</dt>
<dd>1 inch equals 2.54 centimeters. The inch measure is sometimes
represented by <dfn><abr>in</abr></dfn> or a quotation mark (<abr>"</abr>) to the right
of a measure, like 8.5in or 8.5".
U.S. "letter" paper is exactly
8.5in×11in, approximately 21.6cm×27.9cm. (See in the usage
documentation all the <a href="Use.htm#Known_paper_sizes">paper sizes
predefined in Ghostscript</a>.)</dd>
<dt>Points</dt>
<dd>Points are a measure traditionally used in the printing trade and now
in PostScript, which specifies exactly 72 points per inch (approximately
28.35 per centimeter). The <a href="Use.htm#Known_paper_sizes">paper sizes
known to Ghostscript</a> are defined in the initialization file
<tt>gs_statd.ps</tt> in terms of points.</dd>
<dt>Dots per inch</dt>
<dd>Dots per inch or <dfn><abbr>dpi</abbr></dfn> is the common measure of
printing resolution in the US.</dd>
<dt>Bits per pixel</dt>
<dd>Commonly abbreviated <dfn><abbr>bpp</abbr></dfn> this is the number of
digital bits used to represent the color of each pixel. This is also refered
to as 'bit depth' or 'pixel depth'.</dd>
</dl>
<hr>
<h2><a name="File_formats"></a>Image file formats</h2>
<p>
Ghostscript supports output to a variety of image file formats
and is widely used for rasterizing postscript and pdf files.
A collection of such formats ('output devices' in Ghostscript terminology)
are described in this section.
</p>
<p>
Here are some commonly useful driver options that apply to all raster drivers.
Options specific to particular file formats are described in their respective
sections below.</p>
<blockquote><dl>
<dt>-sOutputFile=<em>filename</em></dt>
<dd><p>This is a general option telling ghostscript what to name the output.
It can either be a single filename '<tt>tiger.png</tt>' or a template
'<tt>figure-%03d.jpg</tt>' where the <tt>%03d</tt> is replaced by the page number.</p>
</dt>
<dt>-r<em>res</em></dt>
<dt>-r<em>xres</em>x<em>yres</em></dt>
<dd><p>This option sets the resolution of the output file in dots per inch.
The default value if you don't specify this options is usually 72 <abbr>dpi</abbr>.</p></dd>
<dt>-dTextAlphaBits=<em>n</em></dt>
<dt>-dGraphicsAlphaBits=<em>n</em></dt>
<dd><p>These options control the use of subsample antialiasing. Their use is highly recommended
for producing high quality rasterizations of the input files. The size of the subsampling
box <em>n</em> should be 4 for optimum output, but smaller values can be used for faster
rendering. Antialiasing is enabled separately for text and graphics content.</p></dd>
</dl></blockquote>
<p>
It is also conventional to call ghostscript with the '<tt>-dSAFER -dBATCH -dNOPAUSE</tt>' trio
of options when rasterizing to a file. These suppress interactive prompts and enable some
security checks on the file to be run. Please see the <a href="Use.htm">Use documentation</a>
for a complete description.
</p>
<h3><a name="PNG"></a>PNG file format</h3>
<p><acronym>PNG</acronym> (pronounced 'ping') stands for Portable Network Graphics,
and is the recommended format for high-quality images. It supports full quality
color and transparency, offers excellent lossless compression of the image data,
and is widely supported. Please see the
<a href="http://www.libpng.org/pub/png/pngintro.html" class="offsite">PNG website</a>
for a complete description of the format.</p>
<p>Ghostscript provides a variety of devices for <acronymn>PNG</acronym> output
varying by bit depth. For normal use we recommend <tt>png16m</tt> for 24-bit RGB color,
or <tt>pnggray</tt> for grayscale. The png256, png16 and pngmono devices respectively
provide 8-bit color, 4-bit color and black-and-white for special needs.</p>
<h4>Options</h4>
<p>The png devices have no special options.</p>
<h4>Examples</h4>
<p>Examples of how to use ghostscript to convert postscript to PNG image files:
<blockquote>
<pre>
<kbd>gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -dGraphicsAlphaBits=4 \
-sOutputFile=tiger.png examples/tiger.png</kbd>
<kbd>gs -dSAFER -dBATCH -dNOPAUSE -r150 -sDEVICE=pnggray -dTextAlphaBits=4 \
-sOutputFile=doc-%02d.png doc.pdf</kbd>
</pre>
</blockquote>
</p>
<h3><a name="JFIF"></a>JPEG file format (JFIF)</h3>
<p>
Ghostscript includes output drivers that can produce jpeg files
from postscript or pdf images. These are the <tt>jpeg</tt> and
<tt>jpeggray</tt> devices.
<p>Technically these produce <a href="http://www.ijg.org/">Independent JPEG Group</a>
JFIF (JPEG File Interchange Format) files, the common sort found on the web.</p>
<p><strong>Please note</strong> that
JPEG is a compression method specifically intended for continuous-tone
images such as photographs, not for graphics, and it is therefore quite
unsuitable for the vast majority of page images produced with PostScript.
For anthing other than pages containing simple images the lossy compression
of the jpeg format will result in poor quality output regardless of the input.
To learn more about the distinction, consult a reference about uses and abuses of JPEG,
such as the JPEG FAQ
<blockquote>
<a href="http://www.faqs.org/faqs/jpeg-faq/" class="offsite">http://www.faqs.org/faqs/jpeg-faq/</a>
</blockquote>
<h4>Examples</h4>
<p>
You can use the JPEG output drivers -- <b><tt>jpeg</tt></b> to produce
color JPEG files and <b><tt>jpeggray</tt></b> for grayscale JPEGs -- the
same as other file-format drivers: by specifying the device name and an
output file name, for example
<blockquote>
<pre><kbd>gs -sDEVICE=jpeg -sOutputFile=foo.jpg foo.ps</kbd></pre>
</blockquote>
<h4>Options</h4>
<p>
The JPEG devices support several special parameters to control the JPEG
"quality setting" (DCT quantization level).</p>
<blockquote>
<dl>
<dt><b><tt>-dJPEGQ=</tt></b><b><em>N</em></b> (integer from 0 to 100, default 75)
<dd>Set the quality level <b><em>N</em></b> according to the widely used
IJG quality scale, which balances the extent of compression against the
fidelity of the image when reconstituted. Lower values drop more
information from the image to achieve higher compression, and therefore
have lower quality when reconstituted.
<dt><b><tt>-dQFactor=</tt></b><b><em>M</em></b> (float from 0.0 to 1.0)
<dd>Adobe's QFactor quality scale, which you may use in place of
<b><tt>JPEGQ</tt></b> above. The QFactor scale is used by PostScript's
DCTEncode filter but is nearly unheard-of elsewhere.
</dl>
</blockquote>
<p>
At this writing the default JPEG quality level of 75 is equivalent to
<b><tt>-dQFactor=0.5</tt></b>, but the JPEG default might change in the
future. There is currently no support for any additional JPEG
compression options, such as the other DCTEncode filter parameters.
</p>
<h3><a name="PNM"></a>PNM</h3>
<p>The PNM (portable network map) family of formats are very simple
uncompressed image formats commonly used on unix-like systems. They
are particularly useful for testing or as input to an external conversion
utility.</p>
<p>A wide variety of data formats and depths is supported. Devices include
<tt>pbm
pbmraw pgm pgmraw pgnm pgnmraw pnm pnmraw ppm ppmraw pkm pkmraw pksm
pksmraw</tt>.
</p>
<h3><a name="TIFF"></a>TIFF file formats</h3>
<p><acronym>TIFF</acronym> is a loose collection of formats, now largely
superceeded by <acronym>PNG</acronym> except in applications where backward
compatibility or special compression is required. The <acronym>TIFF</acronym>
file format is described in the
<a href="http://partners.adobe.com/asn/developer/pdfs/tn/TIFF6.pdf" class="offset">TIFF 6.0 Specification</a>
published by Adobe Systems Incorporated.</p>
<p>
There are two unrelated sets of TIFF drivers. There are two color TIFF
drivers that produce uncompressed output:
<blockquote>
<dl>
<dt><b><tt>tiff24nc</tt></b>
<dd>Produces 24-bit RGB output (8 bits per component).
<dt><b><tt>tiff12nc</tt></b>
<dd>Produces 12-bit RGB output (4 bits per component).
</dl>
</blockquote>
<p>
The remaining TIFF drivers all produce black-and-white output with different
compression modes:
<blockquote>
<dl>
<dt><b><tt>tiffcrle</tt></b>
<dd>G3 fax encoding with no EOLs
<dt><b><tt>tiffg3</tt></b>
<dd>G3 fax encoding with EOLs
<dt><b><tt>tiffg32d</tt></b>
<dd>2-D G3 fax encoding
<dt><b><tt>tiffg4</tt></b>
<dd>G4 fax encoding
<dt><b><tt>tifflzw</tt></b>
<dd>LZW-compatible (tag = 5) compression
<dt><b><tt>tiffpack</tt></b>
<dd>PackBits (tag = 32773) compression
</dl>
</blockquote>
<h4>Options</h4>
<p>
The black-and-white TIFF drivers support creation of files that are
comprised of more than a single strip. Multi-strip files reduce the memory
requirement on the reader, since readers need only store and process one
strip at a time. These drivers provide two parameters beyond the standard
set:
<blockquote>
<dl>
<dt><b><tt>-dMaxStripSize=</tt><em>N</em></b> (non-negative integer; default = 0)
<dd>Set the maximum (uncompressed) size of a strip.
<dt><b><tt>-dAdjustWidth=</tt><em>true|false</em></b> (Boolean; default =
true)
<dd>If true, 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.
</dl></blockquote>
<p>
The TIFF 6.0 specification, Section 7, page 27, recommends that the size of
each strip be about 8 Kbytes. As an example, to generate the 'tiger' in
tiffg4 format that has the recommended strip size, use:
<blockquote><pre>
gs -sDEVICE=tiffg4 -sOutputFile=tiger.tiff -dMaxStripSize=8192 examples/tiger.eps
</pre></blockquote>
<p>
If the value of the <tt>MaxStripSize</tt> parameter is smaller than a
single image row, then no error will be generated, and the TIFF file will be
generated correctly using one row per strip. Note that smaller strip sizes
increase the size of the file by increasing the size of the StripOffsets and
StripByteCounts tables, and by reducing the effectiveness of the compression
which must start over for each strip.
<p>
If the value of MaxStripSize is 0 (the default), then the entire image will
be a single strip.
<h3><a name="fax"></a>FAX</h3>
<p>
Ghostscript supports a variety of fax encodings, both encapsulated in
<acronym>TIFF</acronym> (see above) and as raw files. The later case is
described here.
</p>
<p>
The fax devices are <tt>faxg3</tt>, <tt>faxg32d</tt> and <tt>faxg4</tt>.
</p>
<h3><a name="BMP"></a>BMP</h3>
<p>
BMP is a simple uncompressed image format commonly used on MS Windows.
It is supported by the devices <tt>bmpmono bmpgray bmpsep1
bmpsep8 bmp16 bmp256 bmp16m bmp32b</tt>.
</p>
<h3><a name="PCX"></a>PCX</h3>
<p>
PCX is an image format sometimes used on MS Windows. It has some support
for image compression and alternate color spaces, and so can be a useful
way to output CMYK.
It is supported by the <tt>pcxmono pcxgray pcx16 pcx256 pcx24b pcxcmyk</tt>
series of devices.
</p>
<h2><a name="High-level"></a>High-level devices</h2>
<p>
In addition to raster image files, Ghostscript supports output in a number
of 'high-level' formats. These allow Ghostscript to preserve (as much as
possible) the drawing elements of the input file maintaining flexibility,
resolution independence, and editability.</p>
<h3><a name="PDF"></a>PDF writer</h3>
<p>The <tt>pdfwrite</tt> device outputs PDF.</p>
<h3><a name="PS"></a>PS writer</h3>
<p>The <tt>pswrite</tt> device outputs postscript.</p>
<h4>Options</h4>
<blockquote>
<dl>
<dt><b><tt>-dLanguageLevel=</tt><em>1 | 1.5 | 2 | 3</em></b> (default is 2)
<dd>Set the language level of the generated file.
Language level 1.5 is language level 1 with color extensions.
Currently language level 3 generates the same PostScript as 2.
</dl></blockquote>
<h3><a name="EPS"></a>EPS writer</h3>
<p>The <tt>epswrite</tt> device outputs encapsulated postscript.</p>
<h4>Options</h4>
<blockquote>
<dl>
<dt><b><tt>-dLanguageLevel=</tt><em>1 | 1.5 | 2 | 3</em></b> (default is 2)
<dd>Set the language level of the generated file.
Language level 1.5 is language level 1 with color extensions.
Currently language level 3 generates the same PostScript as 2.
</dl></blockquote>
<h3><a name="PXL"></a>PXL</h3>
<p>The <tt>pxlmono</tt> and <tt>pxlcolor</tt> devices output HP PCL-XL,
a graphic language understood by many recent laser printers.</p>
<hr>
<h2><a name="Display_devices"></a>Display Devices</h2>
<p>
Ghostscript is often used for screen display of postscript and pdf documents.
In many cases, a client or 'viewer' application calls the ghostscript engine
to do the rasterization and handles the display of the resulting image itself,
but it is also possible to invoke ghostscript directly and select an output
device which directly handles displaying the image on screen.
<p>
This section describes the various display-oriented devices that are available
in ghostscript.
<h3><a name="x11_devices"></a>X Window System</h3>
<p>
Perhaps the most common use of of a display device is with the X Window System
on unix-like systems. It is the default device on the command line client on
such systems, and is used more creatively by the gv client application.
<p>
The available devices are:
<dl>
<dt><b>x11</b>
<dd>This is the default device, handling display on X11R6.
<dt><b>x11alpha</b>
<dd>This is the x11 device, but with antialiasing. It is equivalent to
invoking the x11 device with the options <tt>-dGraphicsAlphaBits=4
-dTextAlphaBits=4 -dMaxBitmap=50000000</tt>.
<dt><b>x11cmyk</b>
<dd>This device rasterizes the image in the CMKY color space, then flattens
it to RGB for display. It's intended for testing only.
<dt><b>x11mono</b>
<dd>This is a strict black-and-white device for 1-bit monochrome displays.
<dt><b>x11gray2</b>
<dd>This is a device for 2 bpp (4-level) monochrome displays.
<dt><b>x11gray4</b>
<dd>This is a device for 4 bpp (16-level) monochrome displays.
</dl>
<hr>
<h2><a name="IJS"></a>IJS - Inkjet and other raster devices</h2>
<p>
IJS is a relatively new initiative to improve the quality and ease of
use of inkjet printing with Ghostscript. Using IJS, you can add new
drivers, or upgrade existing ones, without recompiling Ghostscript.
All driver authors are encouraged to adapt their drivers for IJS, and
if there is an IJS driver available for your printer, it should be
your first choice.
</p>
<p>Please see the <a href="http://www.linuxprinting.org/ijs/">IJS web
page</a> for more information about IJS, including a listing of
IJS-compatible drivers.
</p>
<p>
A typical command line for IJS is:
</p>
<blockquote>
<b><tt>
gs -DSAFER -sDEVICE=ijs -sIjsServer=hpijs
-sDeviceManufacturer=HEWLETT-PACKARD -sDeviceModel='DESKJET 990'
-DIjsUseOutputFD -sOutputFile=/dev/usb/lp1 -DNOPAUSE --
examples/tiger.eps
</tt></b>
</blockquote>
<p>
Individual IJS command line parameters are as follows:
</p>
<dl>
<dt><b><tt>-sIjsServer=</tt></b><em>{path}</em>
<dd>Sets the pathname for the IJS server (ie printer driver).
Ghostscript will spawn a new process for this driver, and communicate
with it using the IJS protocol. The pathname need not be absolute,
as the PATH environment variable is searched, but it's probably a good
idea for robustness and security. Note also that if -dSAFER is not
specified, it's possible for PostScript code to set this parameter,
so it can cause arbitrary code to be executed. See the section on <a
href="Use.htm#Security">Security</a> for more information.
</dl>
<dl>
<dt><b><tt>-sDeviceManufacturer=</tt></b><em>{name}</em>
<dt><b><tt>-sDeviceModel=</tt></b><em>{name}</em>
<dd>These parameters select the device according to IEEE-1284 standard
device ID strings. In general, consult the documentation for the
driver to find the appropriate settings. Note that, if the value
contains a space, you'll want to quote the value in your shell, as
in the example above.
</dl>
<dl>
<dt><b><tt>-sIjsParams=</tt></b><em>{params}</em>
<dd>This parameter allows you to set arbitrary IJS parameters on
the IJS driver. The format is a comma-separated list of
<b><tt>key=value</tt></b> pairs. If it is necessary to send a
value containing a comma or backslash, it can be escaped with
a backslash. Thus, <b><tt>'-sIjsParams=Foo=bar,Baz=a\,b'</tt></b> sets
the parameter Foo to "bar", and Baz to "a,b".
</dl>
<dl>
<dt><b><tt>-dIjsUseOutputFD</tt></b>
<dd>This flag indicates that Ghostscript should open the output file
and pass a file descriptor to the server. If not set, Ghostscript
simply passes the filename set in OutputFile to the server. In most
cases, this flag won't matter, but if you have a driver which works
only with OutputFD (such as hpijs 1.0.2), or if you're using the
-sOutputFile="|cmd" syntax, you'll need to set it.
</dl>
<dl>
<dt><b><tt>-dBitsPerSample=</tt></b><em>N</em>
<dd>This parameter controls the number of bits per sample. The
default value of 8 should be appropriate for most work. For monochrome
images, use -dBitsPerSample=1.
</dl>
<p>Generic Ghostscript options that are particularly relevant for IJS
are summarized below:
</p>
<dl>
<dt><b><tt>-r</tt></b><em>number</em>
<br><b><tt>-r</tt></b><em>number1</em><b><tt>x</tt></b><em>number2</em>
<dd>Sets the resolution, in dpi. If the resolution is not specified,
Ghostscript queries the IJS server to determine the preferred resolution.
When the resolution is specified, it overrides the value (if any)
preferred by the IJS server.
</dl>
<dl>
<dt><b><tt>-dDuplex</tt></b>
<dt><b><tt>-dTumble</tt></b>
<dd>These flags enable duplex (two-sided) printing. Tumble controls
the orientation. When Tumble is false, the pages
are oriented suitably at the left or right. When Tumble is true,
the pages are oriented suitably for binding at the top or
bottom.
</dl>
<dl>
<dt><b><tt>-sProcessColorModel=</tt></b><em>{name}</em>
<dd>Use this flag to select the process color model. Suitable values
include DeviceGray, DeviceRGB, and DeviceCMYK.
</dl>
<h3>Building IJS</h3>
<p> IJS is included by default on Unix gcc builds, and also in
autoconf'ed builds. Others may need some makefile tweaking. First,
make sure the IJS device is selected:
<blockquote>
DEVICE_DEVS2=$(DD)ijs.dev
</blockquote>
<p> Next, make sure that the path and execution type are set in
the toplevel makefile. The values for Unix are as follows:
<blockquote>
IJSSRCDIR=ijs
IJSEXECTYPE=unix
</blockquote>
<p> At present, "unix" and "win" are the only supported values for
IJSEXECTYPE. If neither sounds appropriate for your system, it's
possible that more porting work is needed.
<p> Last, make sure that ijs.mak is included in the toplevel makefile.
It should be present right after the include of icclib.mak.
<p> IJS is not inherently platform-specific. We're very much interested
in taking patches from people who have ported it to non-mainstream
platforms. And once it's built, you won't have to recompile Ghostscript
to support new drivers!
<h2><a name="HP_ijs"></a>HP Deskjet official drivers</h2>
<p>
HP provides official drivers for many of their Deskjet printer models.
In order to use these drivers, you will need the HP Inkjet Server as
well as Ghostscript, available from <a
href="http://hpinkjet.sourceforge.net">http://hpinkjet.sourceforge.net</a>.
This version of Ghostscript includes the patch from version 0.97 of
the hpijs software. If you are installing hpijs from an RPM, you will
only need the hpijs RPM, not the ghostscript-hpijs one, as the code
needed to work with hpijs is already included.
<p>
Note that newer version of the hpijs drivers support the IJS protocol.
If you can, you should consider using the ijs driver instead. Among
other things, the hpijs Ghostscript driver is Unix-only, and is untested
on older Unix platforms.
<p>
As of the 0.97 version, hpijs supports the following printer models:
<dl><dt><b>e-Series:</b>
<dd>e-20
<dt><b>DeskJet 350C Series:</b>
<dd>350C
<dt><b>DeskJet 600C Series:</b>
<dd>600C, 660C, 670/672C, 670TV, 680/682C
<dt><b>DeskJet 600C Series Photo:</b>
<dd>610/612C, 640/648C, 690/692/693/694/695/697C
<dt><b>DeskJet 630C Series:</b>
<dd>630/632C
<dt><b>DeskJet 800C Series:</b>
<dd>810/812C, 830/832C, 840/842/843C, 880/882C, 895C
<dt><b>DeskJet 900C Series, PhotoSmart::</b>
<dd>930/932C, 950/952C, 970C, PhotoSmart 1000/1100
<dt><b>DeskJet 990C, PhotoSmart:</b>
<dd>960C, 980C, 990C, PhotoSmart 1215/1218
</ul>
</dl>
<p>You will need to add the following line to your makefile:
<blockquote>
DEVICE_DEVS2=$(DD)DJ630.dev $(DD)DJ6xx.dev $(DD)DJ6xxP.dev $(DD)DJ8xx.dev $(DD)DJ9xx.dev $(DD)DJ9xxVIP.dev $(DD)AP21xx.dev
</blockquote>
<p>
Please see <a
href="http://hpinkjet.sourceforge.net">http://hpinkjet.sourceforge.net</a>
for more information about this driver. Thanks to the folks at HP,
especially David Suffield for making this driver available and working to
integrate it with Ghostscript.
</p>
<h2><a name="gimp-print"></a>Gimp-Print driver collection</a></h2>
<p>
The Gimp-Print project provides a large collection of printer drivers
with an IJS interface. Please see their
<a href="http://gimp-print.sourceforge.net/" class="offsite">website</a>
for details.</a>
</p>
<hr>
<h2><a name="Win"></a>MS Windows printers</h2>
<p>
This section was written by Russell Lang, the author of Ghostscript's
MS Windows-specific printer driver, and updated by
<a href="mailto:Pierre.Arnaud@opac.ch">Pierre Arnaud</a>,
the current maintainer.
</p>
<p>
The <b><tt>mswinpr2</tt></b> device uses MS Windows printer drivers, and
thus should work with any printer with device-independent bitmap (DIB)
raster capabilities. The printer resolution cannot be selected directly
using PostScript commands from Ghostscript: use the printer setup in the
Control Panel instead. It is however possible to specify a maximum resolution
for the printed document (see below).
</p>
<p>
If no Windows printer name is specified in <b><tt>-sOutputFile</tt></b>,
Ghostscript prompts for a Windows printer using the standard Print Setup
dialog box. You must set the orientation to Portrait and the page size to
that expected by Ghostscript; otherwise the image will be clipped.
Ghostscript sets the physical device size to that of the Windows printer
driver, but it does not update the PostScript clipping path.
</p>
<p>
If a Windows printer name is specified in <b><tt>-sOutputFile</tt></b> using
the format <tt>"%printer%printer_name"</tt>, for instance
</p>
<blockquote><b><tt>
gs ... -sOutputFile="%printer%Apple LaserWriter II NT"
</tt></b></blockquote>
<p>
then Ghostscript attempts to open the Windows printer without prompting
(except, of course, if the printer is connected to <b><tt>FILE:</tt></b>).
Ghostscript attempts to set the Windows printer page size and orientation
to match that expected by Ghostscript, but doesn't always succeed. It uses
this algorithm:
</p>
<ol>
<li>If the requested page size matches one of the Windows standard page
sizes +/- 2mm, request that standard size.</li>
<li>Otherwise if the requested page size matches one of the Windows
standard page sizes in landscape mode, ask for that standard size in
landscape.</li>
<li>Otherwise ask for the page size by specifying only its dimensions.</li>
<li>Merge the requests above with the defaults. If the printer driver
ignores the requested paper size, no error is generated: it will print on
the wrong paper size.</li>
<li>Open the Windows printer with the merged orientation and size.</li>
</ol>
<p>
The Ghostscript physical device size is updated to match the Windows
printer physical device.
</p>
<h3><a name="Win_properties"></a>Supported command-line parameters</h3>
<p>
The <b><tt>mswinpr2</tt></b> device supports a limited number of command-line
parameters (e.g. it does not support setting the printer resolution). The
recognized parameters are the following:
</p>
<blockquote>
<dl>
<dt><b><tt>-sDEVICE=mswinpr2</tt></b></dt>
<dd>Selects the MS Windows printer device. If Ghostscript was not
compiled with this device as the default output device, you have to specify
it on the command line.</dd>
<dt><b><tt>-dNoCancel</tt></b></dt>
<dd>Hides the progress dialog, which shows the percent of the document page
already processed and also provides a <em>cancel</em> button. This option
is useful if GS is intended to print pages in the background, without any
user intervention.</dd>
<dt><b><tt>-sOutputFile=</tt></b><b>"%printer%<em>printer_name</em>"</b></dt>
<dd>Specifies which printer should be used. The <em>printer_name</em> should be
typed exactly as it appears in the Printers control panel, including spaces.</dd>
</dl>
</blockquote>
<h3><a name="Win_options"></a>Supported options (device properties)</h3>
<p>
Several extra options exist which cannot be set through the command-line,
but only by executing the appropriate PostScript setup code. These options
can be set through the inclusion of a setup file on the command-line:
</p>
<blockquote><b><tt>
gs ... setup.ps ...
</tt></b></blockquote>
<p>
The <tt>setup.ps</tt> file is responsible for the device selection, therefore
you should not specify the <b><tt>-sDEVICE=mswinpr2</tt></b> option on the
command-line if you are using such a setup file. Here is an example of such
a setup file:
</p>
<blockquote><pre>
mark
/NoCancel true % don't show the cancel dialog
/BitsPerPixel 4 % force 4 bits/pixel
/UserSettings
<<
/DocumentName (Ghostscript document) % name for the Windows spooler
/MaxResolution 360 % maximum document resolution
>>
(mswinpr2) finddevice % select the Windows device driver
putdeviceprops
setdevice
</pre></blockquote>
<p>
This example disables the progress dialog (same as the <tt><b>-dNoCancel</b></tt>
option), forces a 4 bits/pixel output resolution and specifies additional user
settings, such as the document name (which will be displayed by the Windows
spooler for the queued document) and the maximum resolution (here 360 dpi).
It then finds and selects an instance of the MS Windows device printer
and activates it. This will show the standard printer dialog, since no
<tt><b>/OutputFile</b></tt> property was specified.
</p>
<p>
The following options are available:
</p>
<blockquote>
<dl>
<dt><b><tt>/NoCancel <em>boolean</em></tt></b></dt>
<dd>Disables (hides) the progress dialog when set to <em><tt>true</tt></em> or
show the progress dialog if not set or set to <em><tt>false</tt></em>.</dd>
<dt><b><tt>/OutputFile <em>string</em></tt></b></dt>
<dd>Specifies which printer should be used. The string should be of the form
<tt><b>%printer%<em>printer_name</em></b></tt>, where the <em>printer_name</em> should be
typed exactly as it appears in the Printers control panel, including spaces.</dd>
<dt><b><tt>/QueryUser <em>integer</em></tt></b></dt>
<dd>Shows the standard printer dialog (<tt><b>1</b></tt> or any other value),
shows the <em>printer setup dialog</em> (<tt><b>2</b></tt>) or selects the
<em>default Windows printer</em> without any user interaction (<tt><b>3</b></tt>).</dd>
<dt><b><tt>/BitsPerPixel <em>integer</em></tt></b></dt>
<dd>Sets the device depth to the specified bits per pixel. Currently supported
values are <tt><b>1</b></tt> (monochrome), <tt><b>4</b></tt> (CMYK with screening
handled by Ghostscript) and <tt><b>24</b></tt> (True Color, dithering handled by
the Windows printer driver; this option can produce huge print jobs).</dd>
<dt><b><tt>/UserSettings <em>dict</em></tt></b></dt>
<dd>Sets additional options, defined in a dictionary. The following properties can
be set:
<dl>
<dt><b><tt>/DocumentName <em>string</em></tt></b></dt>
<dd>Defines the user friendly document name which will be displayed by the
Windows spooler.</dd>
<dt><b><tt>/DocumentRange <em>[n1 n2]</em></tt></b></dt>
<dd>Defines the range of pages contained in the document. This information can
be used by the printer dialog, in conjunction with the following property.</dd>
<dt><b><tt>/SelectedRange <em>[n1 n2]</em></tt></b></dt>
<dd>Defines the selected range of pages. This information will be displayed in
the printer dialog and will be updated after the user interaction. A PostScript
program could check these values and print only the selected page range.</dd>
<dt><b><tt>/MaxResolution <em>dpi</em></tt></b></dt>
<dd>Specifies the maximum tolerated output resolution. If the selected printer has
a higher resolution than <tt><b>dpi</b></tt>, then Ghostscript will render the
document with a submultiple of the printer resolution. For example, if
<tt><b>MaxResolution</b></tt> is set to 360 and the output printer supports
up to 1200 dpi, then Ghostscript renders the document with an internal
resolution of 1200/4=300 dpi. This can be very useful to reduce the memory
requirements when printing in True Color on some high resolution ink-jet color
printers.</dd>
</dl></dd>
</dl>
</blockquote>
<p>
These properties can be queried through the <tt><b>currentpagedevice</b></tt>
operator. The following PostScript code snippet shows how to do it for some
of the properties:
</p>
<blockquote><pre>
currentpagedevice /BitsPerPixel get == % displays the selected depth
currentpagedevice /UserSettings get % get the additional options..
/us exch def % ..and assign them to a variable
us /DocumentName get == % displays the document name
us /SelectedRange get == % displays the selected page range
% other misc. informations (don't rely on them)
us /Color get == % 1 => monochrome output, 2 => color output
us /PrintCopies get == % displays the number of copies requested
</pre></blockquote>
<p>
There are a few undocumented informations stored in the <tt><b>UserSettings</b></tt>
dictionary. You should not rely on them. Their use is still experimental and
they could be removed in a future version.
</p>
<h3><a name="Win_duplex"></a>Duplex printing</h3>
<p>
If the Windows printer supports the duplex printing feature, then it will
also be available through the <b><tt>mswinpr2</tt></b> device. You can query
for this support through the <b><tt>/Duplex</tt></b> propery of the
<b><tt>currentpagedevice</tt></b>. If it returns <b><tt>null</tt></b>, then
the feature is not supported by the selected printer. Otherwise, <b><tt>true</tt></b>
means that the printer is currently set up to print on both faces of the paper
and <b><tt>false</tt></b> that it is not, but that it can.
</p>
<p>
The following example shows how to print on both faces of the paper (using
the long side of the paper as the reference):
</p>
<blockquote><pre>
<< /Duplex true /Tumble false >> setpagedevice
</pre></blockquote>
<p>
</p>
<hr>
<h2><a name="SPARCprinter"></a>Sun SPARCprinter</h2>
<p>
This section was contributed by Martin Schulte.
<p>
With a SPARCprinter you always buy software that enables you to do
PostScript printing on it. A page image is composed on the host, which
sends a bitmap to the SPARCprinter through a special SBUS video interface.
So the need for a Ghostscript interface to the SPARCPrinter seems low, but
on the other hand, Sun's software prints some PostScript drawings
incorrectly: some pages contain a thin vertical line of rubbish, and on
some Mathematica drawings the text at the axes isn't rotated. Ghostscript,
however, gives the correct results. Moreover, replacing proprietary
software should never be a bad idea.
<p>
The problem is that there has yet been no effort to make the SPARCPrinter
driver behave like a BSD output filter. I made my tests using the script
shown here.
<h3><a name="SPARC_install"></a>Installation</h3>
<p>
Add <b><tt>sparc.dev</tt></b> to <b><tt>DEVICE_DEVS</tt></b> and compile
Ghostscript as described in the documentation on <a href="Make.htm">how to
build Ghostscript</a>. Afterwards you can use the following script as an
example for printing after modifying it with the right pathnames --
including for <b>{GSPATH}</b> the full pathname of the Ghostscript
executable:
<blockquote>
<pre>outcmd1='/vol/local/lib/troff2/psxlate -r'
outcmd2='<b><em>{GSPATH}</em></b> -sDEVICE=sparc -sOUTPUTFILE=/dev/lpvi0 -'
if [ $# -eq 0 ]
then
$outcmd1 | $outcmd2
else
cat $* | $outcmd1 | $outcmd2
fi
</pre></blockquote>
<h3><a name="SPARC_problems"></a>Problems</h3>
<p>
Since <b><tt>/dev/lpi</tt></b> can be opened only for exclusive use, if
another job has it open (engine_ctl_sparc or another Ghostscript are the
most likely candidates), Ghostscript stops with "Error: /invalidfileaccess
in --.outputpage--"
<p>
In case of common printer problems like being out of paper, a warning
describing the reason is printed to stdout. The driver tries access again
each five seconds. Due to a problem with the device driver (in the kernel)
the reason for printer failure isn't always reported correctly to the
program. This is the case, for instance, if you open the top cover (error
E5 on the printer's display). Look at the display on the printer itself if
a "Printer problem with unknown reason" is reported. Fatal errors cause
the print job to be terminated.
<p>
Note: there is some confusion whether the resolution setting should be
the integers 300 and 400, or the symbolic constants DPI300 and DPI400
(defined in lpviio.h). Ghostscript releases have had it both ways. It
is currently the latter. However, INOUE Namihiko reports (in
SourceForge bug #215256) that the former works better for him. If anyone
has a definitive answer, please let us know.
<hr>
<h2><a name="Apple"></a>Apple dot matrix printer</h2>
<p>
This section was contributed by Mark Wedel
<<a href="mailto:master@cats.ucsc.edu">master@cats.ucsc.edu</a>>.
<p>
The Apple Dot Matrix Printer (DMP) was a parallel predecessor to the
Imagewriter printer. As far as I know, Imagewriter commands are a superset
of the Dot Matrix printer's, so the driver should generate output that can
be printed on Imagewriters.
<p>
To print images, the driver sets the printer for unidirectional printing
and 15 characters per inch (cpi), or 120dpi. It sets the line feed to 1/9
inch. When finished, it sets the printer to bidirectional printing,
1/8-inch line feeds, and 12 cpi. There appears to be no way to reset the
printer to initial values.
<p>
This code does not set for 8-bit characters (which is required). It also
assumes that carriage return-newline is needed, and not just carriage
return. These are all switch settings on the DMP, and I have configured
them for 8-bit data and carriage return exclusively. Ensure that the Unix
printer daemon handles 8-bit (binary) data properly; in my SunOS 4.1.1
<b><tt>printcap</tt></b> file the string "<b><tt>ms=pass8,-opost</tt></b>"
works fine for this.
<p>
Finally, you can search <b><tt>devdemp.c</tt></b> for
"<b><tt>Init</tt></b>" and "<b><tt>Reset</tt></b>" to find the strings that
initialize the printer and reset things when finished, and change them to
meet your needs.
<hr>
<h2><a name="Test"></a>Special and Test devices</h2>
<p>
The devices in this section are intended primarily for testing. They may
be interesting as code examples, as well.
<h3>Raw 'bit' devices</h3>
<p>There are a collection of 'bit' devices that don't do any special formatting
but output 'raw' binary data for the page images. These are used for benchmarking
but can also be useful when you want to directly access the raster data.</p>
<p>
The raw devices are <tt>bit bitrgb bitcmyk</tt>.
<h3><a name="Bounding_box_output"></a>Bounding box output</h3>
<p>
There is a special <b><tt>bbox</tt></b> "device" that just prints the
bounding box of each page. You select it in the usual way:
<blockquote><b><tt>
gs -dSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox
</tt></b></blockquote>
<p>
It prints the output in a format like this:
<blockquote>
<pre><b><tt>%%BoundingBox: 14 37 570 719
%%HiResBoundingBox: 14.308066 37.547999 569.495061 718.319158
</tt></b></pre></blockquote>
</p>
<p>
Currently, it always prints the bounding box on <b><tt>stderr</tt></b>;
eventually, it should also recognize <b><tt>-sOutputFile=</tt></b>.
<p>
Note that this device, like other devices, has a resolution and a (maximum)
page size. As for other devices, the product (resolution x page size) is
limited to approximately 500K pixels. By default, the resolution is 4000
DPI and the maximum page size is approximately 125", or approximately 9000
default (1/72") user coordinate units. If you need to measure larger pages
than this, you must reset <em>both</em> the resolution and the page size in
pixels, e.g.,
<blockquote><b><tt>
gs -dNOPAUSE -dBATCH -sDEVICE=bbox -r100 -g500000x500000
</tt></b></blockquote>
<h3><a name="Permute"></a>Permutation (DeviceN color model)</h3>
<p>
With no additional parameters, the device named "permute" looks
to Ghostscript like a standard CMYK contone device, and outputs a
PPM file, using a simple CMYK->RGB transform. This should be the
baseline for regression testing.
<p>
With the addition of <tt><b>-dPermute=1</b></tt>, the internal behavior changes
somewhat, but in most cases the resulting rendered file should be the
same. In this mode, the color model becomes "DeviceN" rather than
"DeviceCMYK", the number of components goes to six, and the color
model is considered to be the (yellow, cyan, cyan, magenta, 0, black)
tuple. This is what's rendered into the memory buffer. Finally, on
conversion to RGB for output, the colors are permuted back.
<p>
As such, this code should check that all imaging code paths are
64-bit clean. Additionally, it should find incorrect code that assumes
that the color model is one of DeviceGray, DeviceRGB, or DeviceCMYK.
<p>
Currently, the code has the limitation of 8-bit continuous tone
rendering only. An enhancement to do halftones is planned as well. Note,
however, that when testing permuted halftones for consistency, it is
important to permute the planes of the default halftone accordingly, and
that any file which sets halftones explicitly will fail a consistency
check.
<!-- [2.0 end contents] ==================================================== -->
<!-- [3.0 begin visible trailer] =========================================== -->
<hr>
<p>
<small>Copyright © 1996-2002 artofcode LLC.
All rights reserved.</small>
<p>
This software is provided AS-IS with no warranty, either express or
implied.
This software is distributed under license and may not be copied,
modified or distributed except as expressly authorized under the terms
of the license contained in the file LICENSE in this distribution.
For more information about licensing, please refer to
http://www.ghostscript.com/licensing/. For information on
commercial licensing, go to http://www.artifex.com/licensing/ or
contact Artifex Software, Inc., 101 Lucas Valley Road #110,
San Rafael, CA 94903, U.S.A., +1(415)492-9861.
<p>
<small>Ghostscript version 8.01, 30 January 2004
<!-- [3.0 end visible trailer] ============================================= -->
</body>
</html>
|