Crate pdf [−] [src]
A library for creating pdf files.
Currently, simple vector graphics and text set in the 14 built-in fonts are supported. The main entry point of the crate is the struct Pdf, representing a PDF file being written.
Example
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!") }); document.finish();
Some more working usage examples exists in the examples directory.
Modules
graphicsstate |
Types for representing details in the graphics state. |
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. |
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. |