]>
Commit | Line | Data |
---|---|---|
ed486911 | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> |
2 | <html> | |
3 | <!-- SECTION: Specifications --> | |
4 | <head> | |
5 | <title>Generating PostScript for CUPS</title> | |
6 | <meta name='keywords' content='Programming, PostScript, Document Structuring Conventions'> | |
7 | <link rel='stylesheet' type='text/css' href='../cups.css'> | |
8 | </head> | |
9 | <body> | |
10 | <!-- | |
11 | "$Id$" | |
12 | ||
13 | CUPS PostScript file specification for the Common UNIX Printing System (CUPS). | |
14 | ||
15 | Copyright 2006 by Easy Software Products. | |
16 | ||
17 | These coded instructions, statements, and computer programs are the | |
18 | property of Easy Software Products and are protected by Federal | |
19 | copyright law. Distribution and use rights are outlined in the file | |
20 | "LICENSE.txt" which should have been included with this file. If this | |
21 | file is missing or damaged please contact Easy Software Products | |
22 | at: | |
23 | ||
24 | Attn: CUPS Licensing Information | |
25 | Easy Software Products | |
26 | 44141 Airport View Drive, Suite 204 | |
27 | Hollywood, Maryland 20636 USA | |
28 | ||
29 | Voice: (301) 373-9600 | |
30 | EMail: cups-info@cups.org | |
31 | WWW: http://www.cups.org | |
32 | --> | |
33 | ||
34 | <h2 class='title'><a name='INTRODUCTION'>Introduction</a></h2> | |
35 | ||
36 | <p>This document describes how to generate PostScript output for | |
37 | CUPS and is largely based on the <a | |
38 | href="http://partners.adobe.com/public/developer/en/ps/5001.DSC_Spec.pdf"> | |
39 | Adobe TechNote #5001: PostScript Language Document Structuring | |
40 | Conventions Specification Version 3.0</a>. While CUPS can | |
41 | generally print any PostScript file, following the rules in the | |
42 | Adobe TechNote and this document will ensure that your PostScript | |
43 | output will work reliably.</p> | |
44 | ||
45 | <blockquote><b>Note:</b> While PostScript is currently the | |
46 | defacto-standard print job file format/language for UNIX-based | |
47 | applications, it is slowly being phased out in favor of Adobe's | |
48 | Portable Document Format ("PDF") which offers many advantages | |
49 | over PostScript. MacOS X uses PDF as the primary print job file | |
50 | format, and we expect Linux to soon follow. Both PostScript and | |
51 | PDF are complex formats, and we highly recommend using high-level | |
52 | toolkits whenever possible.</blockquote> | |
53 | ||
54 | <h3>Anatomy of a PostScript File</h3> | |
55 | ||
56 | <p>PostScript files are ASCII text files starting with a header | |
57 | line (<tt>%!PS-Adobe-3.0</tt>) followed by a combination of | |
58 | comment lines starting with two percent signs (<tt>%%</tt>) and | |
59 | PostScript code lines. The lines themselves should not exceed 255 | |
60 | characters to conform to the DSC. The following short PostScript | |
61 | file produces a box with a smiley face in it:</p> | |
62 | ||
63 | <pre class="command"> | |
64 | %!PS-Adobe-3.0 | |
65 | %%BoundingBox: 36 36 576 756 | |
66 | %%Pages: 1 | |
67 | %%LanguageLevel: 2 | |
68 | %%EndComments | |
69 | %%Page: (1) 1 | |
70 | % Draw a black box around the page | |
71 | 0 setgray | |
72 | 1 setlinewidth | |
73 | 36 36 540 720 rectstroke | |
74 | ||
75 | % Draw a two inch blue circle in the middle of the page | |
76 | 0 0 1 setrgbcolor | |
77 | 306 396 144 0 360 arc closepath fill | |
78 | ||
79 | % Draw two half inch yellow circles for eyes | |
80 | 1 1 0 setrgbcolor | |
81 | 252 432 36 0 360 arc closepath fill | |
82 | 360 432 36 0 360 arc closepath fill | |
83 | ||
84 | % Draw the smile | |
85 | 1 setlinecap | |
86 | 18 setlinewidth | |
87 | 306 396 99 200 340 arc stroke | |
88 | ||
89 | % Print it! | |
90 | showpage | |
91 | %%EOF | |
92 | </pre> | |
93 | ||
94 | <div class="figure"><table summary="Sample PostScript File Output"> | |
95 | <caption>Figure 1: <a name="FIGURE_1">Sample PostScript File Output</a></caption> | |
96 | <tr><td align="center"><img src="../images/smiley.jpg" | |
97 | width="445" height="570" alt="Sample PostScript File Output"></td></tr> | |
98 | </table></div> | |
99 | ||
100 | ||
101 | <h2>Embedding Printer Options</h2> | |
102 | ||
103 | ||
104 | <h2>Embedding Fonts and Text</h2> | |
105 | ||
106 | ||
107 | <h2>Embedding Images</h2> | |
108 | ||
109 | ||
110 | <blockquote><b>Note:</b> While some printers support arbitrary | |
111 | binary data in PostScript files, we do not recommend this | |
112 | practice because it does not work with all printers or | |
113 | interfaces. In most cases, the Base-85 encoding and compression | |
114 | filters can be used to embed images with very little, if any, | |
115 | increase in data size.</blockquote> | |
116 | ||
117 | ||
118 | ||
119 | </body> | |
120 | </html> |