Next: , Previous: Image Surfaces, Up: Top

17 PDF Surfaces

Rendering PDF documents

17.1 Overview

The PDF surface is used to render cairo graphics to Adobe PDF files and is a multi-page vector surface backend.

17.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.

a filename for the PDF output (must be writable), ‘#f’ 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.
width of the surface, in points (1 point == 1/72.0 inch)
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

— Function: cairo-pdf-get-versions ⇒  (versions <cairo-pdf-version-t const*>) (num-versions <int>)

Used to retrieve the list of supported versions. See cairo-pdf-surface-restrict-to-version.

supported version list
list length

Since 1.10

— 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.

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