Top |
cairo_surface_t * | cairo_pdf_surface_create () |
cairo_surface_t * | cairo_pdf_surface_create_for_stream () |
void | cairo_pdf_surface_restrict_to_version () |
void | cairo_pdf_get_versions () |
const char * | cairo_pdf_version_to_string () |
void | cairo_pdf_surface_set_size () |
The PDF surface is used to render cairo graphics to Adobe PDF files and is a multi-page vector surface backend.
The following mime types are supported: CAIRO_MIME_TYPE_JPEG
,
CAIRO_MIME_TYPE_JP2
, CAIRO_MIME_TYPE_UNIQUE_ID
,
CAIRO_MIME_TYPE_JBIG2
, CAIRO_MIME_TYPE_JBIG2_GLOBAL
,
CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID
.
JBIG2 data in PDF must be in the embedded format as described in
ISO/IEC 11544. Image specific JBIG2 data must be in
CAIRO_MIME_TYPE_JBIG2
. Any global segments in the JBIG2 data
(segments with page association field set to 0) must be in
CAIRO_MIME_TYPE_JBIG2_GLOBAL
. The global data may be shared by
multiple images. All images sharing the same global data must set
CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID
to a unique identifer. At least
one of the images must provide the global data using
CAIRO_MIME_TYPE_JBIG2_GLOBAL
. The global data will only be
embedded once but shared by all JBIG2 images with the same
CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID
.
cairo_surface_t * cairo_pdf_surface_create (const char *filename
,double width_in_points
,double height_in_points
);
Creates a PDF surface of the specified size in points to be written
to filename
.
filename |
a filename for the PDF output (must be writable), |
|
width_in_points |
width of the surface, in points (1 point == 1/72.0 inch) |
|
height_in_points |
height of the surface, in points (1 point == 1/72.0 inch) |
a pointer to the newly created surface. The caller
owns the surface and should call cairo_surface_destroy()
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 cairo_surface_status()
to check for this.
Since 1.2
cairo_surface_t * cairo_pdf_surface_create_for_stream (cairo_write_func_t write_func
,void *closure
,double width_in_points
,double height_in_points
);
Creates a PDF surface of the specified size in points to be written
incrementally to the stream represented by write_func
and closure
.
write_func |
a cairo_write_func_t to accept the output data, may be |
|
closure |
the closure argument for |
|
width_in_points |
width of the surface, in points (1 point == 1/72.0 inch) |
|
height_in_points |
height of the surface, in points (1 point == 1/72.0 inch) |
a pointer to the newly created surface. The caller
owns the surface and should call cairo_surface_destroy()
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 cairo_surface_status()
to check for this.
Since 1.2
void cairo_pdf_surface_restrict_to_version (cairo_surface_t *surface
,cairo_pdf_version_t version
);
Restricts the generated PDF file to version
. See cairo_pdf_get_versions()
for a list of available version values that can be used here.
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.
Since 1.10
void cairo_pdf_get_versions (cairo_pdf_version_t const **versions
,int *num_versions
);
Used to retrieve the list of supported versions. See
cairo_pdf_surface_restrict_to_version()
.
Since 1.10
const char *
cairo_pdf_version_to_string (cairo_pdf_version_t version
);
Get the string representation of the given version
id. This function
will return NULL
if version
isn't valid. See cairo_pdf_get_versions()
for a way to get the list of valid version ids.
Since 1.10
void cairo_pdf_surface_set_size (cairo_surface_t *surface
,double width_in_points
,double height_in_points
);
Changes the size of a PDF surface for the current (and subsequent) pages.
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
cairo_show_page()
or cairo_copy_page()
.
surface |
a PDF cairo_surface_t |
|
width_in_points |
new surface width, in points (1 point == 1/72.0 inch) |
|
height_in_points |
new surface height, in points (1 point == 1/72.0 inch) |
Since 1.2
#define CAIRO_HAS_PDF_SURFACE 1
Defined if the PDF surface backend is available. This macro can be used to conditionally compile backend-specific code.
Since 1.2
cairo_pdf_version_t is used to describe the version number of the PDF specification that a generated PDF file will conform to.
Since 1.10