Skip to main content

Crate pdfcrate

Crate pdfcrate 

Source
Expand description

pdfcrate - A Rust library for creating and manipulating PDF documents

§Example

use pdfcrate::prelude::*;

fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
    Document::generate("hello.pdf", |doc| {
        doc.text_at("Hello, World!", [72.0, 700.0]);
        Ok(())
    })?;
    Ok(())
}

§WASM Support

This library supports WebAssembly targets. When compiled for WASM:

  • Use Document::new() and doc.render() to get PDF bytes
  • File I/O methods (save, generate) require the std feature
  • The WasmDocument wrapper provides JavaScript-friendly bindings

Modules§

api
High-level PDF API
codec
Stream encoding/decoding
content
PDF Content Stream
document
PDF Document structure
font
PDF Font handling
forms
PDF AcroForms support
image
PDF Image handling
objects
PDF object types
parser
PDF Parser
prelude
Prelude module for convenient imports
svg
SVG rendering support.
writer
PDF Writer

Macros§

pdf_array
Creates a PDF array from the given elements
pdf_dict
Creates a PDF dictionary from the given key-value pairs

Enums§

Error
Error types for PDF operations

Type Aliases§

Result
Result type alias for pdfcrate operations