summaryrefslogtreecommitdiff
path: root/doc/public/xml/cairo-ps.xml
blob: a61d04011a174116bc055bfc08fe3d8abae0c125 (plain)
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
<?xml version='1.0' encoding='UTF-8'?> 
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
                "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="cairo-PostScript-Surfaces">
<refmeta>
<refentrytitle role="top_of_page" id="cairo-PostScript-Surfaces.top_of_page">PostScript Surfaces</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>
  CAIRO Library
</refmiscinfo>
</refmeta>
<refnamediv>
<refname>PostScript Surfaces</refname>
<refpurpose>Rendering PostScript documents</refpurpose>
</refnamediv>

<refsynopsisdiv id="cairo-PostScript-Surfaces.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>#define             <link linkend="CAIRO-HAS-PS-SURFACE:CAPS">CAIRO_HAS_PS_SURFACE</link>
<link linkend="cairo-surface-t"><returnvalue>cairo_surface_t</returnvalue></link> *   <link linkend="cairo-ps-surface-create">cairo_ps_surface_create</link>             (<parameter>const <link linkend="char"><type>char</type></link> *filename</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> width_in_points</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> height_in_points</parameter>);
<link linkend="cairo-surface-t"><returnvalue>cairo_surface_t</returnvalue></link> *   <link linkend="cairo-ps-surface-create-for-stream">cairo_ps_surface_create_for_stream</link>  (<parameter><link linkend="cairo-write-func-t"><type>cairo_write_func_t</type></link> write_func</parameter>,
                                                         <parameter><link linkend="void"><type>void</type></link> *closure</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> width_in_points</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> height_in_points</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-ps-surface-restrict-to-level">cairo_ps_surface_restrict_to_level</link>  (<parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *surface</parameter>,
                                                         <parameter><link linkend="cairo-ps-level-t"><type>cairo_ps_level_t</type></link> level</parameter>);
enum                <link linkend="cairo-ps-level-t">cairo_ps_level_t</link>;
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-ps-get-levels">cairo_ps_get_levels</link>                 (<parameter><link linkend="cairo-ps-level-t"><type>cairo_ps_level_t</type></link> const **levels</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> *num_levels</parameter>);
const <link linkend="char"><returnvalue>char</returnvalue></link> *        <link linkend="cairo-ps-level-to-string">cairo_ps_level_to_string</link>            (<parameter><link linkend="cairo-ps-level-t"><type>cairo_ps_level_t</type></link> level</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-ps-surface-set-eps">cairo_ps_surface_set_eps</link>            (<parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *surface</parameter>,
                                                         <parameter><link linkend="cairo-bool-t"><type>cairo_bool_t</type></link> eps</parameter>);
<link linkend="cairo-bool-t"><returnvalue>cairo_bool_t</returnvalue></link>        <link linkend="cairo-ps-surface-get-eps">cairo_ps_surface_get_eps</link>            (<parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *surface</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-ps-surface-set-size">cairo_ps_surface_set_size</link>           (<parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *surface</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> width_in_points</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> height_in_points</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-ps-surface-dsc-begin-setup">cairo_ps_surface_dsc_begin_setup</link>    (<parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *surface</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-ps-surface-dsc-begin-page-setup">cairo_ps_surface_dsc_begin_page_setup</link>
                                                        (<parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *surface</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-ps-surface-dsc-comment">cairo_ps_surface_dsc_comment</link>        (<parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *surface</parameter>,
                                                         <parameter>const <link linkend="char"><type>char</type></link> *comment</parameter>);
</synopsis>
</refsynopsisdiv>

<refsect1 id="cairo-PostScript-Surfaces.description" role="desc">
<title role="desc.title">Description</title>
<para>
The PostScript surface is used to render cairo graphics to Adobe
PostScript files and is a multi-page vector surface backend.
</para>
</refsect1>
<refsect1 id="cairo-PostScript-Surfaces.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="CAIRO-HAS-PS-SURFACE:CAPS" role="macro">
<title>CAIRO_HAS_PS_SURFACE</title>
<indexterm zone="CAIRO-HAS-PS-SURFACE:CAPS"><primary sortas="HAS_PS_SURFACE">CAIRO_HAS_PS_SURFACE</primary></indexterm>
<programlisting>#define CAIRO_HAS_PS_SURFACE 1
</programlisting>
<para>
Defined if the PostScript surface backend is available.
This macro can be used to conditionally compile backend-specific code.
</para></refsect2>
<refsect2 id="cairo-ps-surface-create" role="function" condition="since:1.2">
<title>cairo_ps_surface_create ()</title>
<indexterm zone="cairo-ps-surface-create" role="1.2"><primary sortas="ps_surface_create">cairo_ps_surface_create</primary></indexterm>
<programlisting><link linkend="cairo-surface-t"><returnvalue>cairo_surface_t</returnvalue></link> *   cairo_ps_surface_create             (<parameter>const <link linkend="char"><type>char</type></link> *filename</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> width_in_points</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> height_in_points</parameter>);</programlisting>
<para>
Creates a PostScript surface of the specified size in points to be
written to <parameter>filename</parameter>. See <link linkend="cairo-ps-surface-create-for-stream"><function>cairo_ps_surface_create_for_stream()</function></link> for
a more flexible mechanism for handling the PostScript output than
simply writing it to a named file.
</para>
<para>
Note that the size of individual pages of the PostScript output can
vary. See <link linkend="cairo-ps-surface-set-size"><function>cairo_ps_surface_set_size()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>filename</parameter>&#160;:</term>
<listitem><simpara>a filename for the PS output (must be writable), <link linkend="NULL:CAPS"><literal>NULL</literal></link> may be
           used to specify no output. This will generate a PS surface that
           may be queried and used as a source, without generating a
           temporary file.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>width_in_points</parameter>&#160;:</term>
<listitem><simpara>width of the surface, in points (1 point == 1/72.0 inch)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>height_in_points</parameter>&#160;:</term>
<listitem><simpara>height of the surface, in points (1 point == 1/72.0 inch)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a pointer to the newly created surface. The caller
owns the surface and should call <link linkend="cairo-surface-destroy"><function>cairo_surface_destroy()</function></link> when done
with it.

This function always returns a valid pointer, but it will return a
pointer to a "nil" surface if an error such as out of memory
occurs. You can use <link linkend="cairo-surface-status"><function>cairo_surface_status()</function></link> to check for this.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.2</para></refsect2>
<refsect2 id="cairo-ps-surface-create-for-stream" role="function" condition="since:1.2">
<title>cairo_ps_surface_create_for_stream ()</title>
<indexterm zone="cairo-ps-surface-create-for-stream" role="1.2"><primary sortas="ps_surface_create_for_stream">cairo_ps_surface_create_for_stream</primary></indexterm>
<programlisting><link linkend="cairo-surface-t"><returnvalue>cairo_surface_t</returnvalue></link> *   cairo_ps_surface_create_for_stream  (<parameter><link linkend="cairo-write-func-t"><type>cairo_write_func_t</type></link> write_func</parameter>,
                                                         <parameter><link linkend="void"><type>void</type></link> *closure</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> width_in_points</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> height_in_points</parameter>);</programlisting>
<para>
Creates a PostScript surface of the specified size in points to be
written incrementally to the stream represented by <parameter>write_func</parameter> and
<parameter>closure</parameter>. See <link linkend="cairo-ps-surface-create"><function>cairo_ps_surface_create()</function></link> for a more convenient way
to simply direct the PostScript output to a named file.
</para>
<para>
Note that the size of individual pages of the PostScript
output can vary. See <link linkend="cairo-ps-surface-set-size"><function>cairo_ps_surface_set_size()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>write_func</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="cairo-write-func-t"><type>cairo_write_func_t</type></link> to accept the output data, may be <link linkend="NULL:CAPS"><literal>NULL</literal></link>
             to indicate a no-op <parameter>write_func</parameter>. With a no-op <parameter>write_func</parameter>,
             the surface may be queried or used as a source without
             generating any temporary files.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>closure</parameter>&#160;:</term>
<listitem><simpara>the closure argument for <parameter>write_func</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>width_in_points</parameter>&#160;:</term>
<listitem><simpara>width of the surface, in points (1 point == 1/72.0 inch)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>height_in_points</parameter>&#160;:</term>
<listitem><simpara>height of the surface, in points (1 point == 1/72.0 inch)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a pointer to the newly created surface. The caller
owns the surface and should call <link linkend="cairo-surface-destroy"><function>cairo_surface_destroy()</function></link> when done
with it.

This function always returns a valid pointer, but it will return a
pointer to a "nil" surface if an error such as out of memory
occurs. You can use <link linkend="cairo-surface-status"><function>cairo_surface_status()</function></link> to check for this.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.2</para></refsect2>
<refsect2 id="cairo-ps-surface-restrict-to-level" role="function" condition="since:1.6">
<title>cairo_ps_surface_restrict_to_level ()</title>
<indexterm zone="cairo-ps-surface-restrict-to-level" role="1.6"><primary sortas="ps_surface_restrict_to_level">cairo_ps_surface_restrict_to_level</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_ps_surface_restrict_to_level  (<parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *surface</parameter>,
                                                         <parameter><link linkend="cairo-ps-level-t"><type>cairo_ps_level_t</type></link> level</parameter>);</programlisting>
<para>
Restricts the generated PostSript file to <parameter>level</parameter>. See
<link linkend="cairo-ps-get-levels"><function>cairo_ps_get_levels()</function></link> for a list of available level values that
can be used here.
</para>
<para>
This function should only be called before any drawing operations
have been performed on the given surface. The simplest way to do
this is to call this function immediately after creating the
surface.
</para><variablelist role="params">
<varlistentry><term><parameter>surface</parameter>&#160;:</term>
<listitem><simpara>a PostScript <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>level</parameter>&#160;:</term>
<listitem><simpara>PostScript level
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.6</para></refsect2>
<refsect2 id="cairo-ps-level-t" role="enum">
<title>enum cairo_ps_level_t</title>
<indexterm zone="cairo-ps-level-t"><primary sortas="ps_level_t">cairo_ps_level_t</primary></indexterm>
<programlisting>typedef enum _cairo_ps_level {
    CAIRO_PS_LEVEL_2,
    CAIRO_PS_LEVEL_3
} cairo_ps_level_t;
</programlisting>
<para>
<link linkend="cairo-ps-level-t"><type>cairo_ps_level_t</type></link> is used to describe the language level of the
PostScript Language Reference that a generated PostScript file will
conform to.
</para><variablelist role="enum">
<varlistentry id="CAIRO-PS-LEVEL-2:CAPS" role="constant">
<term><literal>CAIRO_PS_LEVEL_2</literal></term>
<listitem><simpara>The language level 2 of the PostScript specification.
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-PS-LEVEL-3:CAPS" role="constant">
<term><literal>CAIRO_PS_LEVEL_3</literal></term>
<listitem><simpara>The language level 3 of the PostScript specification.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="cairo-ps-get-levels" role="function" condition="since:1.6">
<title>cairo_ps_get_levels ()</title>
<indexterm zone="cairo-ps-get-levels" role="1.6"><primary sortas="ps_get_levels">cairo_ps_get_levels</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_ps_get_levels                 (<parameter><link linkend="cairo-ps-level-t"><type>cairo_ps_level_t</type></link> const **levels</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> *num_levels</parameter>);</programlisting>
<para>
Used to retrieve the list of supported levels. See
<link linkend="cairo-ps-surface-restrict-to-level"><function>cairo_ps_surface_restrict_to_level()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>levels</parameter>&#160;:</term>
<listitem><simpara>supported level list
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>num_levels</parameter>&#160;:</term>
<listitem><simpara>list length
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.6</para></refsect2>
<refsect2 id="cairo-ps-level-to-string" role="function" condition="since:1.6">
<title>cairo_ps_level_to_string ()</title>
<indexterm zone="cairo-ps-level-to-string" role="1.6"><primary sortas="ps_level_to_string">cairo_ps_level_to_string</primary></indexterm>
<programlisting>const <link linkend="char"><returnvalue>char</returnvalue></link> *        cairo_ps_level_to_string            (<parameter><link linkend="cairo-ps-level-t"><type>cairo_ps_level_t</type></link> level</parameter>);</programlisting>
<para>
Get the string representation of the given <parameter>level</parameter> id. This function
will return <link linkend="NULL:CAPS"><literal>NULL</literal></link> if <parameter>level</parameter> id isn't valid. See <link linkend="cairo-ps-get-levels"><function>cairo_ps_get_levels()</function></link>
for a way to get the list of valid level ids.
</para><variablelist role="params">
<varlistentry><term><parameter>level</parameter>&#160;:</term>
<listitem><simpara>a level id
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the string associated to given level.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.6</para></refsect2>
<refsect2 id="cairo-ps-surface-set-eps" role="function" condition="since:1.6">
<title>cairo_ps_surface_set_eps ()</title>
<indexterm zone="cairo-ps-surface-set-eps" role="1.6"><primary sortas="ps_surface_set_eps">cairo_ps_surface_set_eps</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_ps_surface_set_eps            (<parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *surface</parameter>,
                                                         <parameter><link linkend="cairo-bool-t"><type>cairo_bool_t</type></link> eps</parameter>);</programlisting>
<para>
If <parameter>eps</parameter> is <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, the PostScript surface will output Encapsulated
PostScript.
</para>
<para>
This function should only be called before any drawing operations
have been performed on the current page. The simplest way to do
this is to call this function immediately after creating the
surface. An Encapsulated PostScript file should never contain more
than one page.
</para><variablelist role="params">
<varlistentry><term><parameter>surface</parameter>&#160;:</term>
<listitem><simpara>a PostScript <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>eps</parameter>&#160;:</term>
<listitem><simpara><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> to output EPS format PostScript
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.6</para></refsect2>
<refsect2 id="cairo-ps-surface-get-eps" role="function" condition="since:1.6">
<title>cairo_ps_surface_get_eps ()</title>
<indexterm zone="cairo-ps-surface-get-eps" role="1.6"><primary sortas="ps_surface_get_eps">cairo_ps_surface_get_eps</primary></indexterm>
<programlisting><link linkend="cairo-bool-t"><returnvalue>cairo_bool_t</returnvalue></link>        cairo_ps_surface_get_eps            (<parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *surface</parameter>);</programlisting>
<para>
Check whether the PostScript surface will output Encapsulated PostScript.
</para><variablelist role="params">
<varlistentry><term><parameter>surface</parameter>&#160;:</term>
<listitem><simpara>a PostScript <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the surface will output Encapsulated PostScript.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.6</para></refsect2>
<refsect2 id="cairo-ps-surface-set-size" role="function" condition="since:1.2">
<title>cairo_ps_surface_set_size ()</title>
<indexterm zone="cairo-ps-surface-set-size" role="1.2"><primary sortas="ps_surface_set_size">cairo_ps_surface_set_size</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_ps_surface_set_size           (<parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *surface</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> width_in_points</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> height_in_points</parameter>);</programlisting>
<para>
Changes the size of a PostScript surface for the current (and
subsequent) pages.
</para>
<para>
This function should only be called before any drawing operations
have been performed on the current page. The simplest way to do
this is to call this function immediately after creating the
surface or immediately after completing a page with either
<link linkend="cairo-show-page"><function>cairo_show_page()</function></link> or <link linkend="cairo-copy-page"><function>cairo_copy_page()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>surface</parameter>&#160;:</term>
<listitem><simpara>a PostScript <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>width_in_points</parameter>&#160;:</term>
<listitem><simpara>new surface width, in points (1 point == 1/72.0 inch)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>height_in_points</parameter>&#160;:</term>
<listitem><simpara>new surface height, in points (1 point == 1/72.0 inch)
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.2</para></refsect2>
<refsect2 id="cairo-ps-surface-dsc-begin-setup" role="function" condition="since:1.2">
<title>cairo_ps_surface_dsc_begin_setup ()</title>
<indexterm zone="cairo-ps-surface-dsc-begin-setup" role="1.2"><primary sortas="ps_surface_dsc_begin_setup">cairo_ps_surface_dsc_begin_setup</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_ps_surface_dsc_begin_setup    (<parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *surface</parameter>);</programlisting>
<para>
This function indicates that subsequent calls to
<link linkend="cairo-ps-surface-dsc-comment"><function>cairo_ps_surface_dsc_comment()</function></link> should direct comments to the Setup
section of the PostScript output.
</para>
<para>
This function should be called at most once per surface, and must
be called before any call to <link linkend="cairo-ps-surface-dsc-begin-page-setup"><function>cairo_ps_surface_dsc_begin_page_setup()</function></link>
and before any drawing is performed to the surface.
</para>
<para>
See <link linkend="cairo-ps-surface-dsc-comment"><function>cairo_ps_surface_dsc_comment()</function></link> for more details.
</para><variablelist role="params">
<varlistentry><term><parameter>surface</parameter>&#160;:</term>
<listitem><simpara>a PostScript <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link>
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.2</para></refsect2>
<refsect2 id="cairo-ps-surface-dsc-begin-page-setup" role="function" condition="since:1.2">
<title>cairo_ps_surface_dsc_begin_page_setup ()</title>
<indexterm zone="cairo-ps-surface-dsc-begin-page-setup" role="1.2"><primary sortas="ps_surface_dsc_begin_page_setup">cairo_ps_surface_dsc_begin_page_setup</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_ps_surface_dsc_begin_page_setup
                                                        (<parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *surface</parameter>);</programlisting>
<para>
This function indicates that subsequent calls to
<link linkend="cairo-ps-surface-dsc-comment"><function>cairo_ps_surface_dsc_comment()</function></link> should direct comments to the
PageSetup section of the PostScript output.
</para>
<para>
This function call is only needed for the first page of a
surface. It should be called after any call to
<link linkend="cairo-ps-surface-dsc-begin-setup"><function>cairo_ps_surface_dsc_begin_setup()</function></link> and before any drawing is
performed to the surface.
</para>
<para>
See <link linkend="cairo-ps-surface-dsc-comment"><function>cairo_ps_surface_dsc_comment()</function></link> for more details.
</para><variablelist role="params">
<varlistentry><term><parameter>surface</parameter>&#160;:</term>
<listitem><simpara>a PostScript <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link>
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.2</para></refsect2>
<refsect2 id="cairo-ps-surface-dsc-comment" role="function" condition="since:1.2">
<title>cairo_ps_surface_dsc_comment ()</title>
<indexterm zone="cairo-ps-surface-dsc-comment" role="1.2"><primary sortas="ps_surface_dsc_comment">cairo_ps_surface_dsc_comment</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_ps_surface_dsc_comment        (<parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *surface</parameter>,
                                                         <parameter>const <link linkend="char"><type>char</type></link> *comment</parameter>);</programlisting>
<para>
Emit a comment into the PostScript output for the given surface.
</para>
<para>
The comment is expected to conform to the PostScript Language
Document Structuring Conventions (DSC). Please see that manual for
details on the available comments and their meanings. In
particular, the %%IncludeFeature comment allows a
device-independent means of controlling printer device features. So
the PostScript Printer Description Files Specification will also be
a useful reference.
</para>
<para>
The comment string must begin with a percent character (%) and the
total length of the string (including any initial percent
characters) must not exceed 255 characters. Violating either of
these conditions will place <parameter>surface</parameter> into an error state. But
beyond these two conditions, this function will not enforce
conformance of the comment with any particular specification.
</para>
<para>
The comment string should not have a trailing newline.
</para>
<para>
The DSC specifies different sections in which particular comments
can appear. This function provides for comments to be emitted
within three sections: the header, the Setup section, and the
PageSetup section.  Comments appearing in the first two sections
apply to the entire document while comments in the BeginPageSetup
section apply only to a single page.
</para>
<para>
For comments to appear in the header section, this function should
be called after the surface is created, but before a call to
<link linkend="cairo-ps-surface-dsc-begin-setup"><function>cairo_ps_surface_dsc_begin_setup()</function></link>.
</para>
<para>
For comments to appear in the Setup section, this function should
be called after a call to <link linkend="cairo-ps-surface-dsc-begin-setup"><function>cairo_ps_surface_dsc_begin_setup()</function></link> but
before a call to <link linkend="cairo-ps-surface-dsc-begin-page-setup"><function>cairo_ps_surface_dsc_begin_page_setup()</function></link>.
</para>
<para>
For comments to appear in the PageSetup section, this function
should be called after a call to
<link linkend="cairo-ps-surface-dsc-begin-page-setup"><function>cairo_ps_surface_dsc_begin_page_setup()</function></link>.
</para>
<para>
Note that it is only necessary to call
<link linkend="cairo-ps-surface-dsc-begin-page-setup"><function>cairo_ps_surface_dsc_begin_page_setup()</function></link> for the first page of any
surface. After a call to <link linkend="cairo-show-page"><function>cairo_show_page()</function></link> or <link linkend="cairo-copy-page"><function>cairo_copy_page()</function></link>
comments are unambiguously directed to the PageSetup section of the
current page. But it doesn't hurt to call this function at the
beginning of every page as that consistency may make the calling
code simpler.
</para>
<para>
As a final note, cairo automatically generates several comments on
its own. As such, applications must not manually generate any of
the following comments:
</para>
<para>
Header section: %!PS-Adobe-3.0, %%Creator, %%CreationDate, %%Pages,
%%BoundingBox, %%DocumentData, %%LanguageLevel, %%EndComments.
</para>
<para>
Setup section: %%BeginSetup, %%EndSetup
</para>
<para>
PageSetup section: %%BeginPageSetup, %%PageBoundingBox, %%EndPageSetup.
</para>
<para>
Other sections: %%BeginProlog, %%EndProlog, %%Page, %%Trailer, %%EOF
</para>
<para>
Here is an example sequence showing how this function might be used:
</para>
<para>
<informalexample><programlisting>
cairo_surface_t *surface = cairo_ps_surface_create (filename, width, height);
...
cairo_ps_surface_dsc_comment (surface, "%%Title: My excellent document");
cairo_ps_surface_dsc_comment (surface, "%%Copyright: Copyright (C) 2006 Cairo Lover")
...
cairo_ps_surface_dsc_begin_setup (surface);
cairo_ps_surface_dsc_comment (surface, "%%IncludeFeature: *MediaColor White");
...
cairo_ps_surface_dsc_begin_page_setup (surface);
cairo_ps_surface_dsc_comment (surface, "%%IncludeFeature: *PageSize A3");
cairo_ps_surface_dsc_comment (surface, "%%IncludeFeature: *InputSlot LargeCapacity");
cairo_ps_surface_dsc_comment (surface, "%%IncludeFeature: *MediaType Glossy");
cairo_ps_surface_dsc_comment (surface, "%%IncludeFeature: *MediaColor Blue");
... draw to first page here ..
cairo_show_page (cr);
...
cairo_ps_surface_dsc_comment (surface, "%%IncludeFeature: *PageSize A5");
...
</programlisting></informalexample>
</para><variablelist role="params">
<varlistentry><term><parameter>surface</parameter>&#160;:</term>
<listitem><simpara>a PostScript <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>comment</parameter>&#160;:</term>
<listitem><simpara>a comment string to be emitted into the PostScript output
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.2</para></refsect2>

</refsect1>
<refsect1 id="cairo-PostScript-Surfaces.see-also">
<title>See Also</title>
<link linkend="cairo-surface-t"><type>cairo_surface_t</type></link>
</refsect1>

</refentry>