| Crates.io | micropdf |
| lib.rs | micropdf |
| version | 0.9.0 |
| created_at | 2026-01-14 18:06:41.826516+00 |
| updated_at | 2026-01-22 16:17:04.751611+00 |
| description | A pure Rust PDF library - drop-in replacement for MuPDF with 100% API compatibility |
| homepage | https://bitbucket.org/lexmata/micropdf |
| repository | https://bitbucket.org/lexmata/micropdf |
| max_upload_size | |
| id | 2043384 |
| size | 4,993,805 |
A pure Rust PDF library designed as a drop-in replacement for MuPDF.
MicroPDF is a complete reimplementation of the MuPDF library in safe Rust. It provides:
MicroPDF is designed to be faster than MuPDF through modern concurrency features:
| Feature | MuPDF | MicroPDF |
|---|---|---|
| Multi-threaded page rendering | ❌ Single-threaded | ✅ Parallel with Rayon |
| Async file I/O | ❌ Blocking | ✅ Non-blocking with Tokio |
| Multi-page processing | ❌ Sequential | ✅ Parallel batch operations |
| Image decoding | ❌ Single-threaded | ✅ Parallel decompression |
Enable performance features:
[dependencies]
micropdf = { version = "0.1", features = ["parallel", "async"] }
See our benchmark dashboard for detailed performance comparisons.
We created MicroPDF to solve two critical problems:
1. Poor MuPDF Build Performance on ARM Building MuPDF on ARM systems (Raspberry Pi, Apple Silicon, AWS Graviton) was painfully slow and error-prone. MicroPDF compiles 3-5x faster on ARM thanks to Rust's superior build system and native ARM optimization.
2. Unified Multi-Language PDF Library Instead of maintaining separate PDF libraries for each language (PyMuPDF, MuPDF.js, go-fitz, etc.), we wanted one battle-tested core with idiomatic bindings for Rust, Node.js, Go, Python, Deno, and Bun.
Additional Benefits:
MicroPDF's C headers (include/mupdf/*.h) mirror MuPDF's API exactly. Existing C/C++ code using MuPDF can switch to MicroPDF by:
libmicropdf.a instead of libmupdf.aNo code changes required.
rayontokioAdd to your Cargo.toml:
[dependencies]
micropdf = "0.1"
[dependencies]
micropdf = { version = "0.1", features = ["parallel", "async"] }
parallel - Enable parallel processing using rayonasync - Enable async I/O using tokiojpeg2000 - Enable JPEG 2000 supportuse micropdf::fitz::buffer::Buffer;
use micropdf::fitz::stream::Stream;
use micropdf::fitz::geometry::{Point, Rect, Matrix};
// Create a buffer
let buffer = Buffer::from_slice(b"Hello, PDF!");
// Open a stream from memory
let mut stream = Stream::open_memory(b"PDF data here");
// Work with geometry
let point = Point::new(100.0, 200.0);
let rect = Rect::new(0.0, 0.0, 612.0, 792.0); // US Letter
let matrix = Matrix::scale(2.0, 2.0);
Complete documentation is available in multiple formats:
docs.rs/micropdf - Complete API documentation with examples
crates.io/crates/micropdf - Package information
Building Guide - Comprehensive build instructions
Makefile Targets - 40+ build, test, and install targets
MicroPDF provides 660+ C-compatible FFI functions:
context, document, page, buffer, stream, pixmap, colorspace, font, image, cookie, device, path, output, and moreMicroPDF provides bindings for multiple languages:
Node.js/TypeScript - Native N-API bindings
Go - CGO bindings with pure-Go mock
The library can be built as a static library for C/C++ integration:
cargo build --release
This produces:
target/release/libmicropdf.a (Unix)target/release/micropdf.lib (Windows MSVC)Dual-licensed under MIT or Apache 2.0.