Next: , Previous: Image Surfaces, Up: Top


13 PDF Surfaces

Rendering PDF documents

13.1 Overview

13.2 Usage

— Function: cairo-pdf-surface-create (filename <char>) (width-in-points <double>) (height-in-points <double>) =>  (ret <cairo-surface-t>)

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)
ret
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

— Function: cairo-pdf-surface-set-size (surface <cairo-surface-t>) (width-in-points <double>) (height-in-points <double>)

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