summaryrefslogtreecommitdiff
path: root/doc/public/xml/cairo-pdf.xml
blob: 3fce42e5a002885caf34b878696336f82531f2f4 (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
<?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-pdf-surface">
<refmeta>
<refentrytitle role="top_of_page" id="cairo-pdf-surface.top_of_page">PDF Surfaces</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CAIRO Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>PDF Surfaces</refname>
<refpurpose>Rendering PDF documents</refpurpose>
</refnamediv>

<refsynopsisdiv id="cairo-pdf-surface.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
#define             <link linkend="CAIRO-HAS-PDF-SURFACE--CAPS">CAIRO_HAS_PDF_SURFACE</link>
<link linkend="cairo-surface-t">cairo_surface_t</link> *   <link linkend="cairo-pdf-surface-create">cairo_pdf_surface_create</link>            (const <link linkend="char">char</link> *filename,
                                                         <link linkend="double">double</link> width_in_points,
                                                         <link linkend="double">double</link> height_in_points);
<link linkend="cairo-surface-t">cairo_surface_t</link> *   <link linkend="cairo-pdf-surface-create-for-stream">cairo_pdf_surface_create_for_stream</link> (<link linkend="cairo-write-func-t">cairo_write_func_t</link> write_func,
                                                         <link linkend="void">void</link> *closure,
                                                         <link linkend="double">double</link> width_in_points,
                                                         <link linkend="double">double</link> height_in_points);
<link linkend="void">void</link>                <link linkend="cairo-pdf-surface-restrict-to-version">cairo_pdf_surface_restrict_to_version</link>
                                                        (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
                                                         <link linkend="cairo-pdf-version-t">cairo_pdf_version_t</link> version);
enum                <link linkend="cairo-pdf-version-t">cairo_pdf_version_t</link>;
<link linkend="void">void</link>                <link linkend="cairo-pdf-get-versions">cairo_pdf_get_versions</link>              (<link linkend="cairo-pdf-version-t">cairo_pdf_version_t</link> const **versions,
                                                         <link linkend="int">int</link> *num_versions);
const <link linkend="char">char</link> *        <link linkend="cairo-pdf-version-to-string">cairo_pdf_version_to_string</link>         (<link linkend="cairo-pdf-version-t">cairo_pdf_version_t</link> version);
<link linkend="void">void</link>                <link linkend="cairo-pdf-surface-set-size">cairo_pdf_surface_set_size</link>          (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
                                                         <link linkend="double">double</link> width_in_points,
                                                         <link linkend="double">double</link> height_in_points);
</synopsis>
</refsynopsisdiv>









<refsect1 id="cairo-pdf-surface.description" role="desc">
<title role="desc.title">Description</title>
<para>
The PDF surface is used to render cairo graphics to Adobe
PDF files and is a multi-page vector surface backend.
</para>
</refsect1>

<refsect1 id="cairo-pdf-surface.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="CAIRO-HAS-PDF-SURFACE--CAPS" role="macro">
<title>CAIRO_HAS_PDF_SURFACE</title>
<indexterm zone="CAIRO-HAS-PDF-SURFACE--CAPS"><primary sortas="CAIRO_HAS_PDF_SURFACE">CAIRO_HAS_PDF_SURFACE</primary></indexterm><programlisting>#define CAIRO_HAS_PDF_SURFACE 1
</programlisting>
<para>
Defined if the PDF surface backend is available.
This macro can be used to conditionally compile backend-specific code.
</para></refsect2>
<refsect2 id="cairo-pdf-surface-create" role="function" condition="since:1.2">
<title>cairo_pdf_surface_create ()</title>
<indexterm zone="cairo-pdf-surface-create" role="1.2"><primary sortas="cairo_pdf_surface_create">cairo_pdf_surface_create</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link> *   cairo_pdf_surface_create            (const <link linkend="char">char</link> *filename,
                                                         <link linkend="double">double</link> width_in_points,
                                                         <link linkend="double">double</link> height_in_points);</programlisting>
<para>
Creates a PDF surface of the specified size in points to be written
to <parameter>filename</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>filename</parameter>&#160;:</term>
<listitem><simpara> a filename for the PDF output (must be writable), <link linkend="NULL--CAPS"><literal>NULL</literal></link> may be
           used to specify no output. This will generate a PDF 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-pdf-surface-create-for-stream" role="function" condition="since:1.2">
<title>cairo_pdf_surface_create_for_stream ()</title>
<indexterm zone="cairo-pdf-surface-create-for-stream" role="1.2"><primary sortas="cairo_pdf_surface_create_for_stream">cairo_pdf_surface_create_for_stream</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link> *   cairo_pdf_surface_create_for_stream (<link linkend="cairo-write-func-t">cairo_write_func_t</link> write_func,
                                                         <link linkend="void">void</link> *closure,
                                                         <link linkend="double">double</link> width_in_points,
                                                         <link linkend="double">double</link> height_in_points);</programlisting>
<para>
Creates a PDF surface of the specified size in points to be written
incrementally to the stream represented by <parameter>write_func</parameter> and <parameter>closure</parameter>.</para>
<para>
</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-pdf-surface-restrict-to-version" role="function" condition="since:1.10">
<title>cairo_pdf_surface_restrict_to_version ()</title>
<indexterm zone="cairo-pdf-surface-restrict-to-version" role="1.10"><primary sortas="cairo_pdf_surface_restrict_to_version">cairo_pdf_surface_restrict_to_version</primary></indexterm><programlisting><link linkend="void">void</link>                cairo_pdf_surface_restrict_to_version
                                                        (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
                                                         <link linkend="cairo-pdf-version-t">cairo_pdf_version_t</link> version);</programlisting>
<para>
Restricts the generated PDF file to <parameter>version</parameter>. See <link linkend="cairo-pdf-get-versions"><function>cairo_pdf_get_versions()</function></link>
for a list of available version 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>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>surface</parameter>&#160;:</term>
<listitem><simpara> a PDF <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>version</parameter>&#160;:</term>
<listitem><simpara> PDF version
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.10</para></refsect2>
<refsect2 id="cairo-pdf-version-t" role="enum">
<title>enum cairo_pdf_version_t</title>
<indexterm zone="cairo-pdf-version-t"><primary sortas="cairo_pdf_version_t">cairo_pdf_version_t</primary></indexterm><programlisting>typedef enum _cairo_pdf_version {
    CAIRO_PDF_VERSION_1_4,
    CAIRO_PDF_VERSION_1_5
} cairo_pdf_version_t;
</programlisting>
<para>
<link linkend="cairo-pdf-version-t"><type>cairo_pdf_version_t</type></link> is used to describe the version number of the PDF
specification that a generated PDF file will conform to.
</para>
<para>
Since 1.10</para>
<para>
</para><variablelist role="enum">
<varlistentry id="CAIRO-PDF-VERSION-1-4--CAPS" role="constant">
<term><literal>CAIRO_PDF_VERSION_1_4</literal></term>
<listitem><simpara> The version 1.4 of the PDF specification.
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-PDF-VERSION-1-5--CAPS" role="constant">
<term><literal>CAIRO_PDF_VERSION_1_5</literal></term>
<listitem><simpara> The version 1.5 of the PDF specification.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="cairo-pdf-get-versions" role="function" condition="since:1.10">
<title>cairo_pdf_get_versions ()</title>
<indexterm zone="cairo-pdf-get-versions" role="1.10"><primary sortas="cairo_pdf_get_versions">cairo_pdf_get_versions</primary></indexterm><programlisting><link linkend="void">void</link>                cairo_pdf_get_versions              (<link linkend="cairo-pdf-version-t">cairo_pdf_version_t</link> const **versions,
                                                         <link linkend="int">int</link> *num_versions);</programlisting>
<para>
Used to retrieve the list of supported versions. See
<link linkend="cairo-pdf-surface-restrict-to-version"><function>cairo_pdf_surface_restrict_to_version()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>versions</parameter>&#160;:</term>
<listitem><simpara> supported version list
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>num_versions</parameter>&#160;:</term>
<listitem><simpara> list length
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.10</para></refsect2>
<refsect2 id="cairo-pdf-version-to-string" role="function" condition="since:1.10">
<title>cairo_pdf_version_to_string ()</title>
<indexterm zone="cairo-pdf-version-to-string" role="1.10"><primary sortas="cairo_pdf_version_to_string">cairo_pdf_version_to_string</primary></indexterm><programlisting>const <link linkend="char">char</link> *        cairo_pdf_version_to_string         (<link linkend="cairo-pdf-version-t">cairo_pdf_version_t</link> version);</programlisting>
<para>
Get the string representation of the given <parameter>version</parameter> id. This function
will return <link linkend="NULL--CAPS"><literal>NULL</literal></link> if <parameter>version</parameter> isn't valid. See <link linkend="cairo-pdf-get-versions"><function>cairo_pdf_get_versions()</function></link>
for a way to get the list of valid version ids.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>version</parameter>&#160;:</term>
<listitem><simpara> a version id
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the string associated to given version.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.10</para></refsect2>
<refsect2 id="cairo-pdf-surface-set-size" role="function" condition="since:1.2">
<title>cairo_pdf_surface_set_size ()</title>
<indexterm zone="cairo-pdf-surface-set-size" role="1.2"><primary sortas="cairo_pdf_surface_set_size">cairo_pdf_surface_set_size</primary></indexterm><programlisting><link linkend="void">void</link>                cairo_pdf_surface_set_size          (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
                                                         <link linkend="double">double</link> width_in_points,
                                                         <link linkend="double">double</link> height_in_points);</programlisting>
<para>
Changes the size of a PDF 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>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>surface</parameter>&#160;:</term>
<listitem><simpara> a PDF <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>

</refsect1>



<refsect1 id="cairo-pdf-surface.see-also">
<title>See Also</title>
<para>
<itemizedlist>
<listitem><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link></listitem>
</itemizedlist>
</para>
</refsect1>

</refentry>