Crate pdf [] [src]

A library for creating pdf files.

Example

use std::fs::File;
use pdf::{Pdf, FontSource};

let mut file = File::create("foo.pdf").unwrap();
let mut document = Pdf::new(&mut file).unwrap();
let font = FontSource::Times_Roman;

document.render_page(180.0, 240.0, |canvas| {
    canvas.center_text(90.0, 200.0, font, 24.0, "Hello World!")
});

Structs

Canvas

An visual area where content can be drawn (a page).

Encoding

Represent a text encoding used in PDF. An encoding maintains the connection between unicode code points, bytes in PDF strings, and glyph names.

FontMetrics

Relevant data that can be loaded from an AFM (Adobe Font Metrics) file. A FontMetrics object is specific to a given encoding (WinAnsiEncoding for the built-in FontMetrics objects).

FontRef

A font ready to be used in a TextObject.

OutlineItem

An item in the document outline.

Pdf

The top-level object for writing a PDF.

TextObject

A text object is where text is put on the canvas.

WIN_ANSI_ENCODING

Enums

FontSource

The "Base14" built-in fonts in PDF. Underscores in these names are hyphens in the real names. TODO Add a way to handle other fonts.