printwell
Early Development - This project is in active early development. APIs may change, and some features are incomplete. Some commercial features may become free in future releases. Feedback and contributions welcome!
High-fidelity HTML to PDF conversion using Chromium's rendering engine.
Features
- Rendering: Full HTML5/CSS3 support via Chromium's Blink engine
- Watermarks: Text and image overlays with positioning and opacity control
- Bookmarks: Table of contents and navigation structure
- Annotations: Highlights, sticky notes, and geometric shapes
Crates
| Crate | Description |
|---|---|
printwell |
High-level API |
printwell-core |
Rendering engine |
printwell-pdf |
PDF manipulation |
printwell-sys |
FFI bindings |
printwell-cli |
Command-line tool |
Quick Start
use ;
async
CLI Usage
# Convert HTML file
# Convert URL
# Convert with custom page size and margins
# Add watermark
# Add bookmarks
# Add annotations
# Batch convert multiple files
Bindings
Node.js (npm)
import { Converter, htmlToPdf } from 'printwell';
// Simple conversion
const result = await htmlToPdf('<h1>Hello, World!</h1>');
result.writeToFile('output.pdf');
// With options
const converter = new Converter();
const pdf = await converter.htmlToPdf(html, {}, {
pageSize: 'A4',
printBackground: true,
});
Python (PyPI)
# Simple conversion
=
# With options
=
=
Requirements
- Rust: 1.92.0 or later (MSRV)
- Docker: Required for building the native library
- Git LFS: Required for pre-built native libraries
Architecture
Printwell uses a two-layer architecture:
- Native library (
libprintwell_native.so) - Shared library with C++ code + Chromium (blink, skia, pdfium), built with ThinLTO - Rust layer - High-level API that links against the native library dynamically
The native library (~50MB) is pre-built and stored in the repo via Git LFS, so most contributors don't need to build Chromium.
Building
For Contributors (without Chromium)
Contributors can build and test without cloning/building Chromium:
# Install Git LFS and pull pre-built native library
# Build CLI (links against pre-built libprintwell_native.so)
# Build bindings
# Run tests
For Core Developers (with Chromium)
Core developers who need to modify C++ code or update Chromium:
# Setup build environment (one-time)
# Fetch Chromium source (~30GB)
# Sync Chromium dependencies
# Build native library (libprintwell_native.so)
# After C++ changes, commit the updated native library:
Testing
# Run binding tests
# Run end-to-end tests
# Run lints
License
AGPL-3.0 - See LICENSE for details.