Cairo: A Vector Graphics Library | ||||
---|---|---|---|---|
#define CAIRO_HAS_PDF_SURFACE cairo_surface_t* cairo_pdf_surface_create (const char *filename, double width_in_points, double height_in_points); 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); void cairo_pdf_surface_set_size (cairo_surface_t *surface, double width_in_points, double height_in_points);
The PDF surface is used to render cairo graphics to Adobe PDF files and is a multi-page vector surface backend.
#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.
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
.
|
a filename for the PDF output (must be writable) |
|
width of the surface, in points (1 point == 1/72.0 inch) |
|
height of the surface, in points (1 point == 1/72.0 inch) |
Returns : |
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
.
|
a cairo_write_func_t to accept the output data |
|
the closure argument for write_func
|
|
width of the surface, in points (1 point == 1/72.0 inch) |
|
height of the surface, in points (1 point == 1/72.0 inch) |
Returns : |
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_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()
.
|
a PDF cairo_surface_t |
|
new surface width, in points (1 point == 1/72.0 inch) |
|
new surface height, in points (1 point == 1/72.0 inch) |
Since 1.2