Expand description
§GraphitePDF Kit
A pure Rust PDF generation library with no external PDF dependencies.
§Features
- Document construction with
DocumentBuilder - Page sizing (A0-A6, Letter, Legal, Tabloid, custom sizes)
- Text rendering with
TextBuilder - Vector graphics with
Canvas - Flate compression
- Metadata support
- Optional tracing support
§Quick Start
use graphitepdf_kit::{DocumentBuilder, PageSize, TextBuilder, Canvas, Color, Metadata};
// Create text content
let text = TextBuilder::new()
.font("F1", 24.0)
.position(100.0, 700.0)
.text("Hello, World!")
.finish();
// Create vector graphics
let graphics = Canvas::new()
.fill_color(Color::RED)
.rect(100.0, 650.0, 200.0, 50.0)
.fill()
.finish();
// Combine and build the document
let content = [text, graphics].concat();
let doc = DocumentBuilder::new()
.metadata(Metadata::new()
.title("My Document")
.author("Me"))
.with_page(PageSize::A4, content);
// Save to file
doc.save("output.pdf").unwrap();Re-exports§
pub use graphitepdf_errors as errors;pub use graphitepdf_font as font;pub use graphitepdf_image as image;pub use graphitepdf_math as math;pub use graphitepdf_svg as svg;
Structs§
- Border
Style - Canvas
- Canvas for building vector graphics paths.
- Color
- Represents an RGB color.
- Document
Builder - Font
- Font
Registry - Gradient
Stop - Image
Render Options - Linear
Gradient - Metadata
- Outline
- Outline
Item - Page
- Page
Margins - Page margins in points.
- Page
Size - Page size in points (1 point = 1/72 inch).
- PdfWriter
- Permissions
- Radial
Gradient - Security
Options - SvgRender
Options - Table
Builder - Table
Cell - Table
Row - Text
Builder - Builder for constructing text content.
- Tiling
Pattern
Enums§
- Font
Weight - Font weight options.
- LineCap
- Line cap style.
- Line
Join - Line join style.
- Object
- PDF object types as specified in PDF 1.7 specification.
- Page
Orientation - Page orientation.
- Pattern
- Standard
Font - Text
Alignment - Text alignment options.
- Text
Rendering Mode - Text rendering mode.
Traits§
Functions§
- flate_
encode - render_
image_ to_ page_ content - render_
image_ to_ page_ content_ with_ options - render_
math_ to_ page_ content - render_
math_ to_ page_ content_ with_ options - render_
svg_ node_ to_ page_ content - render_
svg_ node_ to_ page_ content_ with_ options