cairo::pdf_surface+x86_64 +linux

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

Index

Functions

fn add_outline(surface: *cairo::surface_t, parent_id: int, utf8: str, link_attribs: str, flags: cairo::pdf_outline_flags_t) int;
fn create(filename: str, width_in_points: f64, height_in_points: f64) (*cairo::surface_t | cairo::error);
fn set_metadata(surface: *cairo::surface_t, metadata: cairo::pdf_metadata_t, utf8: str) void;
fn set_page_label(surface: *cairo::surface_t, label: str) void;
fn set_size(surface: *cairo::surface_t, width_in_points: f64, height_in_points: f64) void;
fn set_thumbnail_size(surface: *cairo::surface_t, width: int, height: int) void;

Functions

fn add_outline[link]

fn add_outline(surface: *cairo::surface_t, parent_id: int, utf8: str, link_attribs: str, flags: cairo::pdf_outline_flags_t) int;

Adds an item to the document outline hierarchy with the name utf8 that links to the location specified by link_attribs. Link attributes have the same keys and values as the [Link Tag], excluding the "rect" attribute. The item will be a child of the item with id parent_id. Use cairo::PDF_OUTLINE_ROOT as the parent id of top level items.

Parameters

Returns the id for the added item.

fn create[link]

fn create(filename: str, width_in_points: f64, height_in_points: f64) (*cairo::surface_t | cairo::error);

Creates a PDF surface of the specified size in points to be written to filename.

Parameters

Returns the newly created surface. The caller owns the surface and should call cairo::surface::destroy when done with it. If an error such as out of memory occurs, cairo::error is returned instead.

fn set_metadata[link]

fn set_metadata(surface: *cairo::surface_t, metadata: cairo::pdf_metadata_t, utf8: str) void;

Set document metadata. The cairo::pdf_metadata_t::CREATE_DATE and cairo::pdf_metadata_t::MOD_DATE values must be in ISO-8601 format: YYYY-MM-DDThh:mm:ss.

An optional timezone of the form "[+/-]hh:mm" or "Z" for UTC time can be appended. All other metadata values can be any UTF-8 string.

For example:

cairo::pdf_surface::set_metadata(surface, cairo::pdf_metadata_t::TITLE, "My Document"); cairo::pdf_surface::set_metadata(surface, cairo::pdf_metadata_t::CREATE_DATE, "2015-12-31T23:59+02:00");

Parameters

fn set_page_label[link]

fn set_page_label(surface: *cairo::surface_t, label: str) void;

Set page label for the current page.

fn set_size[link]

fn set_size(surface: *cairo::surface_t, width_in_points: f64, height_in_points: f64) void;

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.

Parameters

fn set_thumbnail_size[link]

fn set_thumbnail_size(surface: *cairo::surface_t, width: int, height: int) void;

Set the thumbnail image size for the current and all subsequent pages. Setting a width or height of 0 disables thumbnails for the current and subsequent pages.