Skip to main content

Crate graphitepdf_kit

Crate graphitepdf_kit 

Source
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§

BorderStyle
Canvas
Canvas for building vector graphics paths.
Color
Represents an RGB color.
DocumentBuilder
Font
FontRegistry
GradientStop
ImageRenderOptions
LinearGradient
Metadata
Outline
OutlineItem
Page
PageMargins
Page margins in points.
PageSize
Page size in points (1 point = 1/72 inch).
PdfWriter
Permissions
RadialGradient
SecurityOptions
SvgRenderOptions
TableBuilder
TableCell
TableRow
TextBuilder
Builder for constructing text content.
TilingPattern

Enums§

FontWeight
Font weight options.
LineCap
Line cap style.
LineJoin
Line join style.
Object
PDF object types as specified in PDF 1.7 specification.
PageOrientation
Page orientation.
Pattern
StandardFont
TextAlignment
Text alignment options.
TextRenderingMode
Text rendering mode.

Traits§

ToPdfPageContent

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

Type Aliases§

GraphitePdfKitError
Result