Crate pdf [] [src]

A library for creating pdf files.

Example

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

let mut document = Pdf::create("foo.pdf").unwrap();
let font = BuiltinFont::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.

FontRef

A font ready to be used in a TextObject.

Pdf

The top-level object for writing a PDF.

TextObject

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

Enums

BuiltinFont

The "Base14" built-in fonts in PDF. Underscores in these names are hyphens in the real names.

Traits

FontSource

This trait is implemented by any kind of font that the pdf library supports.