Repository files navigation

Rustybara logo

Rustybara

Prepress-focused PDF manipulation toolkit for graphic designers and print operators.

Crates.ioDownloadsDocumentationLicense


Rustybara dashboard

Rustybara is the convergence of three standalone prepress CLI tools into a unified Rust library and interactive toolset, built on the same primitives those tools proved in production:

Origin ToolPrimitive
pdf-mark-removalContent stream filtering, CTM math
resize_to_bleed_or_trim_pdfPage box geometry (MediaBox, TrimBox, BleedBox)
pdf-2-imagePDF rasterization and image encoding

It ships as a library crate (rustybara), a CLI/TUI binary (rbara), and a GPU-accelerated PDF page viewer (rbv).


Workspace

CrateDescriptionLicense
rustybaraCore PDF manipulation libraryLGPLv3
rustybara-iccICC color management — 22 bundled profilesLGPLv3
rustybara-wasmWebAssembly bindings — browser, Node.js, edgeLGPLv3
rbaraTerminal UI (Ratatui TUI)GPLv3
rbara-guiNative desktop GUI (Tauri v2)GPLv3
rbvPrepress PDF viewer (Skia + OpenGL + winit)GPLv3

Features

Featurerustybararustybara-iccrustybara-wasm
Page trim & resize
CMYK remap
Split / stitch pages
Extract page ranges
Flatten spot colors
Rasterization (pdfium)
XMP metadata embed & read
Page object tree + hit-testing
Plate separation filtering
Outline text (glyph → paths)
ICC color transforms
WebAssembly / browser
Node.js / edge runtime
  • Pipeline API — Chain operations fluently: open → trim → resize → remap → save.
  • Batch processing — Process entire directories of PDFs from CLI or TUI.
  • Interactive TUI — App-style terminal interface for designers who prefer guided workflows over raw CLI flags. Configurable output directory.
  • Prepress vocabulary — Every API surface speaks in boxes, bleeds, and DPI — not generic PDF primitives.

Installation

Pre-built installers for rbara (the CLI/TUI binary) are published with each release. Each installer bundles its own pdfium runtime — no system pdfium needed.

Windows

Download rbara-setup-<version>-x64.exe from the Releases page and run it. This is a per-user Inno Setup installer (no admin required) that installs to %LOCALAPPDATA%\Programs\rbara\, registers an opt-in PATH entry, and adds an Add/Remove Programs entry. SmartScreen may warn the first time — the binary is currently unsigned.

macOS

# Apple silicon
tar -xzf rbara-<version>-macos-arm64.tar.gz &&cd rbara-<version>-macos-arm64
./install.sh # installs to ~/.local# Intel
tar -xzf rbara-<version>-macos-x86_64.tar.gz &&cd rbara-<version>-macos-x86_64
./install.sh

The bundle is unsigned; install.sh strips the com.apple.quarantine attribute automatically. To uninstall: ./uninstall.sh.

Linux (glibc x86_64)

tar -xzf rbara-<version>-linux-x64.tar.gz &&cd rbara-<version>-linux-x64
./install.sh # ~/.local
sudo PREFIX=/usr/local ./install.sh # system-wide

Tested on Ubuntu 22.04+, Debian 12+, Fedora 38+, RHEL 9+, Arch, openSUSE Tumbleweed. Musl distros (Alpine) need a source build. To uninstall: ./uninstall.sh.

Docker

docker pull ghcr.io/addy-a/rbara:latest
# CLI usage — bind-mount your working directory
docker run --rm -v "$PWD:/work" ghcr.io/addy-a/rbara:latest \
trim /work/in.pdf -o /work/out.pdf

The image is ~175 MB (debian:bookworm-slim base) and runs as a non-root user.

Building from source

See the Contributing section. The maintainer-side installer scripts live in installer/ (one subdir per platform, each with its own README).


Quick Start

As a library

Add to your Cargo.toml:

[dependencies]
rustybara = "0.1"
use rustybara::PdfPipeline;fnmain() -> rustybara::Result<()>{// Trim marks, resize to 9pt bleed, savePdfPipeline::open("input.pdf")?
.trim()?
.resize(9.0)?
.split_pages(5.83*72.0)? // split spreads into 5.83" panels.save_pdf("output.pdf")?;Ok(())}

Rasterize a page

use rustybara::{PdfPipeline, encode::OutputFormat, raster::RenderConfig};fnmain() -> rustybara::Result<()>{let pipeline = PdfPipeline::open("input.pdf")?;let config = RenderConfig::prepress();// 300 DPI
pipeline.save_page_image(0,"page_1.jpg",&OutputFormat::Jpg,&config)?;Ok(())}

Embed XMP provenance metadata

use rustybara::{PdfPipeline, xmp};fnmain() -> rustybara::Result<()>{let source_hash = xmp::hash_file(std::path::Path::new("input.pdf"))?;let timestamp = "2026-05-28T12:00:00Z".to_string();PdfPipeline::open("input.pdf")?
.trim()?
.resize(9.0)?
.embed_metadata(&source_hash,&timestamp,&[("trim",""),("resize","bleed_pts=9")])?
.save_pdf("output.pdf")?;Ok(())}

Inspect the page object tree

use rustybara::{PdfPipeline, objects::tree::build_object_tree};fnmain() -> rustybara::Result<()>{let pipeline = PdfPipeline::open("input.pdf")?;let page_id = pipeline.doc().get_pages()[&1];let tree = build_object_tree(pipeline.doc(), page_id)?;for obj in&tree.objects{println!("{:?} bbox={:?}", obj.kind, obj.bbox);}Ok(())}

CLI

# Trim print marks
rbara trim input.pdf
# Resize to 1/8-inch bleed (--bleed remains available for point-based scripts)
rbara resize --bleed-inches 0.125 input.pdf
# Add a TrimBox, set page size, or rotate pages
rbara add-trim-box --bleed-inches 0.125 input.pdf
rbara set-media-box --width-inches 8.5 --height-inches 11 input.pdf
rbara rotate --degrees 90 input.pdf
# Export pages as 300 DPI PNGs at quality 90
rbara image --format png --dpi 300 --quality 90 input.pdf
# Extract, split, or stitch pages
rbara extract-pages --pages "1,3-5" input.pdf
rbara split-pages --panel-width 5.83 input.pdf
rbara split-pages --panel-widths 3.625,3.6875,3.6875 --axis horizontal input.pdf
rbara stitch-pages --spread-width 8.5 input.pdf
# Remap a CMYK color (rich black → 60/40/20/100)
rbara remap-color --from 1.0 1.0 1.0 1.0 --to 0.6 0.4 0.2 1.0 input.pdf
# Convert or flatten colors, and outline text
rbara convert-color-space --from-profile AdobeRGB1998 --to-profile USWebCoatedSWOP input.pdf
rbara flatten-spots input.pdf
rbara outline-text input.pdf
# Inspect page boxes, document color usage, and Rustybara provenance
rbara info input.pdf

Every PDF-writing command accepts multiple input files, --output <DIR>, and --overwrite. Without --overwrite, outputs receive an operation suffix such as _processed, _extracted, _split, or _stitch. Image export never overwrites a PDF source and also supports --annotations and --forms.

split-pages --panel-widths accepts an ordered, comma-separated plan containing at least two positive sizes in inches. The sizes must total the source page's TrimBox extent (within half a PDF point). --axis horizontal emits panels left to right; --axis vertical emits them bottom to top. The existing singular --panel-width behavior remains unchanged and defaults to the horizontal axis. PDF outputs include a Rustybara XMP provenance block.

TUI

Launch rbara with no arguments to enter the interactive terminal interface:

rbara

Arrow keys navigate, Enter selects, and Esc goes back. The menu scrolls on smaller terminals; press ? for the full keyboard reference.


rustybara-wasm

WebAssembly bindings for rustybara. Run PDF manipulation in any JavaScript or TypeScript environment — browser, Node.js, Deno, or Cloudflare Workers — with no native dependencies.

Exposes the pure-Rust pipeline subset:

  • trim() — strip content outside TrimBox
  • resize(bleed_pts) — expand page boxes by a bleed margin
  • split_pages_explicit(panel_widths_pts, axis) — split panels by exact widths
  • remap_color(from, to, tolerance) — substitute CMYK values in content streams
  • to_pdf_bytes() — serialize result as bytes for download or further processing

Rasterization (pdfium), object tree rendering, and ICC color transforms (lcms2) require the native crate and are not available in the wasm build. XMP provenance metadata is supported by the WASM package.

Browser quickstart

importinit,{PipelineHandle}from'./pkg/rustybara_wasm.js'awaitinit('./pkg/rustybara_wasm_bg.wasm')constbytes=newUint8Array(awaitfetch('input.pdf').then((r)=>r.arrayBuffer()),)lethandle=newPipelineHandle(bytes)handle=handle.trim()handle=handle.resize(8.504)constresult=handle.to_pdf_bytes()

Build

cd rustybara-wasm
wasm-pack build --target web --out-dir pkg --release

npm

The Node.js package is built as rustybara-wasm, with generated TypeScript declarations and no native runtime dependency. After the first registry release:

npm install rustybara-wasm
constfs=require('node:fs')const{ PanelAxis, PipelineHandle }=require('rustybara-wasm')constinput=fs.readFileSync('input.pdf')constpdf=newPipelineHandle(input).split_pages_explicit(Float64Array.from([261,265.5,265.5]),PanelAxis.Vertical,)fs.writeFileSync('output.pdf',pdf.to_pdf_bytes())

See rustybara-wasm/README.md for the complete Node API and local packaging instructions. The browser build remains available via the rustybara playground.


Architecture

Module Map

rustybara/src/
lib.rs — Public re-exports
pipeline.rs — PdfPipeline: high-level chaining API
error.rs — Unified error type
xmp.rs — XMP metadata embedding, reading, and SHA-256 provenance hashing
geometry/
rect.rs — Rect (position + dimensions, PDF coordinate system)
matrix.rs — Matrix (2D affine CTM transformations)
pages/
boxes.rs — PageBoxes: TrimBox, MediaBox, BleedBox, CropBox reader
split.rs — Page extraction and splitting utilities
stitch.rs — Spread stitching utilities
layout.rs — Page layout helpers
stream/
filter.rs — ContentFilter: CTM-walking content stream filter
color_ops.rs — ColorRemap: CMYK→CMYK value substitution in content streams
objects/
tree.rs — build_object_tree: full page object list (paths, images, text)
with color, CTM, overprint state, and subpath geometry
hittest.rs — Spatial hit-testing against the ObjectTree
separation.rs — filter_by_ink: plate isolation by CMYK channel or spot name
outline/ — (feature-gated: "outline")
font.rs — Extract raw font bytes from PDF resource dictionaries
encoding.rs — Resolve character codes to GlyphId
paths.rs — outline_page_text: walk content stream → per-glyph path geometry
writer.rs — glyphs_to_content_stream: serialize glyphs back to PDF operators
raster/
render.rs — PageRenderer trait, CpuRenderer (pdfium-render)
config.rs — RenderConfig (DPI, annotation toggles)
encode/
save.rs — OutputFormat enum, image encoding (JPG/PNG/WebP/TIFF)
color/ — (feature-gated: "color")
icc.rs — Re-exports from rustybara-icc crate
transform.rs — Re-exports from rustybara-icc crate
rustybara-icc/src/ (separate crate, optionally used via "color" feature)
lib.rs — ICC color management engine
color_space.rs — ColorSpaceKind enum (CMYK, RGB, Gray, Lab)
error.rs — IccError type for color operations
intent.rs — RenderingIntent enum for ICC transforms
pixel_format.rs — PixelFormat enum (RGB8, CMYK8, etc.)
transform.rs — ColorTransform: pixel-level ICC profile transforms
pdf.rs — PdfColorConverter: document-level color space conversion
profiles/ — Bundled ICC profiles (FOGRA39, GRACoL2006, etc.)

Public API

rustybara is a high-level, prepress-scoped crate. The public API speaks in prepress vocabulary:

// Prepress operationsPdfPipeline::open(path)?
.trim()? // Remove content outside TrimBox.resize(bleed_pts)? // Expand page boxes by bleed margin.remap_color(from, to, tolerance)? // Substitute CMYK values.add_trim_box(bleed_pts)? // Inset MediaBox to set a TrimBox.embed_metadata(hash, ts, ops)? // Embed rbara: XMP provenance block.save_pdf(path)?;// Write the result// Rasterization
pipeline.render_page(0,&config)?;// → DynamicImage
pipeline.save_page_image(0, path,&format,&config)?;// → file// Page operationslet new_pipeline = pipeline.extract_pages(&[0,2,4])?;// → new pipelinelet spreads = pipeline.split_pages(panel_width_pts)?;// → new pipelinelet panels = pipeline.split_pages_explicit(&[261.0,265.5,265.5],
rustybara::pages::SplitAxis::Horizontal,)?;// → new pipelinelet stitched = pipeline.stitch_pages(spread_width_pts)?;// → new pipeline// Page inspectionlet boxes = PageBoxes::read(&doc, page_id)?;
boxes.trim_or_media()// TrimBox if present, else MediaBox
boxes.bleed_rect(9.0)// Expand trim by bleed amount// XMP provenance
let hash = xmp::hash_file(path)?;// sha256:<hex>let block = pipeline.read_xmp_block();// Option<RbaraXmpBlock>// Object tree (paths, images, text — full geometry + color)let tree = objects::tree::build_object_tree(doc, page_id)?;let plate_objs = objects::separation::filter_by_ink(&tree,&InkSelector::CmykChannel(CmykChannel::Cyan),);// Text outline extraction (requires "outline" feature)#[cfg(feature = "outline")]{use rustybara::outline::{outline_page_text, writer::glyphs_to_content_stream};let glyphs = outline_page_text(doc, page_id)?;let pdf_ops = glyphs_to_content_stream(&glyphs);// → PDF path operators}// Color space conversion (requires "color" feature)#[cfg(feature = "color")]{use rustybara::color::{ColorTransform,RenderingIntent, profiles};let transform = ColorTransform::new(&profiles::COATED_FOGRA_39,&profiles::COATED_GRACOL_2006,RenderingIntent::RelativeColorimetric,)?;
pipeline.convert_color_space(&transform)?;// Convert entire document}

Feature Flags

FlagWhat it enablesDefault
rasterpdfium-render, image, webp — page rasterization
outlinettf-parser — text outline / glyph-path extraction
colorrustybara-icc / lcms2 — ICC color management
wasmWebAssembly build gate
gpuReserved for future GPU renderer

Renderer Trait

Rendering is behind a trait for future GPU backend support:

pubtraitPageRenderer{fnrender(&self,page:&PdfPage,config:&RenderConfig)
-> Result<DynamicImage>;}pubstructCpuRenderer;// pdfium-render — ships today// pub struct GpuRenderer; // vello/wgpu — future work

Dependencies

CrateRole
lopdf 0.40PDF object graph manipulation
pdfium-render 0.9PDF rasterization via PDFium
image 0.25Bitmap encoding (JPEG, PNG, WebP, TIFF)
rayon 1.11Parallel page rendering
ttf-parser 0.25TrueType glyph outline extraction (outline feature)
uuid 1UUID v4 generation for XMP provenance
sha2 0.11SHA-256 source file hashing for XMP provenance
rustybara-icc 0.1ICC color management (optional, color feature)
lcms2 6.1Little CMS color engine (via rustybara-icc, color feature)

Runtime Requirement — PDFium

The render_page and save_page_image functions require the PDFium shared library at runtime. Place the appropriate binary alongside your executable:

PlatformFile
Windowspdfium.dll
macOSlibpdfium.dylib
Linuxlibpdfium.so

Pre-built binaries: pdfium-binaries

Note: End-users of the rbara binary do not need to do this manually — the pre-built installers bundle the matching pdfium for each platform. This requirement applies only when consuming rustybara as a library in your own Rust project.

Operations that do not rasterize (trim, resize, save_pdf, page_count, PageBoxes::read, build_object_tree, embed_metadata) work without PDFium.


rbara — CLI & TUI Binary

rbara is the interactive front-end for rustybara. It provides both a flag-based CLI for scripting and a TUI for guided workflows.

Keyboard Reference (TUI)

KeyAction
tTrim print marks
rResize to bleed
bAdd TrimBox
sSet MediaBox
gRotate pages
xExport to image
eExtract pages
pSplit pages
hStitch pages
mRemap colors
cConvert color space
kFlatten spot colors
lOutline text
/Output path
oToggle overwrite mode
fChange files
qQuit
EnterRun selected action
?Keyboard reference overlay

UX Model

The TUI follows an app-style keyboard model — arrow keys, Enter, Esc — designed for designers who have never used a terminal before. Vim-style bindings may be layered on as aliases in a future version.

File-first workflow: launch → select file or directory → commands become available. Directories auto-glob *.pdf files.


rbv — PDF Page Viewer

rbv is a prepress-focused PDF viewer built on Skia (OpenGL) + winit. It is designed for quick go/no-go QC decisions — bleed check, color space, spot ink declaration — not sub-pixel vector fidelity. Pages are rasterized by pdfium and displayed as a bitmap; the object tree layer adds wireframe, hit-testing, and color diagnostics on top.

rbv <file> [page] [--dpi <dpi>]

The initial preview renders at 72 DPI for fast startup, then a full-resolution render (at the specified DPI, default 300) replaces it in the background.

Keyboard Shortcuts

KeyAction
WToggle wireframe mode
OToggle prepress box overlays (bleed/trim/crop)
Ctrl + = / Ctrl + +Zoom in
Ctrl + -Zoom out
Ctrl + 0Reset zoom and pan
Ctrl + ScrollZoom toward cursor
Left dragPan
Left clickSelect object + sample color
H / / K / Previous page
L / / J / Next page
NgJump to page N (e.g. 5g)
Ctrl+Shift+DToggle debug overlay
Ctrl+Shift+EExport wireframe diagnostic PDF
EscExit

Wireframe Mode

W replaces the raster image with a vector outline view derived from the page's ObjectTree. Every path, image, and text block is drawn as a thin black stroke in page-space coordinates. The selected object receives a 2px blue highlight. Glyph outlines (extracted via outline_page_text) are drawn on top when available. Ctrl+Shift+E exports the wireframe geometry to a diagnostic PDF for cross-referencing with qpdf --qdf.

Color Diagnostics

Left-click any area to sample:

  • Pixel RGBA — what the monitor is displaying (sampled from the rasterized bitmap)
  • PDF color — the declared fill/stroke color of the hit object from the content stream (DeviceGray / DeviceRGB / DeviceCMYK / Separation)
  • ICC CMYK — the pixel RGB converted to CMYK via Little CMS 2 (destination: US Web Coated SWOP)

A crosshair marker is stored in PDF coordinates and projected to screen each frame, so it stays locked to the correct page position as you zoom and pan.

File Watching

rbv monitors the opened file via notify. When the file changes on disk (e.g. after an InDesign export), it automatically re-opens the document, rebuilds the object tree, and re-renders — supporting a save-and-preview loop without restarting.

IPC

rbara-gui can send commands to a running rbv instance (e.g. switch to a different file after processing). rbv accepts these via a local IPC channel when launched with --listen.


Known Limitations

LimitationNotes
sRGB rasterization onlyCMYK→sRGB via PDFium. ICC color transforms available via color feature for stream-level operations.
JPEG quality not configurableFixed encoder quality. --quality flag planned.
Spot color approximationPDFium renders spot inks as CMYK approximations.
No Form XObject ColorSpace pruningInherited limitation from content stream filtering.
rbv requires display serverNo headless preview. Graceful error on missing GPU.
rbv zoom qualityRaster-only rendering degrades past ~150–200% zoom. LOD tiling planned.
CFF / Type1 glyph outlinesttf-parser requires sfnt container; raw CFF fonts use a OTTO header shim with ongoing refinement.
Very large PDFs (~200 MB+)Hard-blocked on add in rbara-gui. See below.

Large file handling

rustybara opens PDFs eagerly: lopdf parses the entire object graph into memory on load, and the PDFium render path round-trips through a full document serialization. For very large files (roughly 200 MB and up, e.g. imposed print runs of hundreds of pages) this parse can take tens of seconds and consume multiple gigabytes of RAM — long enough to make the desktop app appear frozen.

We explored splitting large files into page-range chunks (processing each independently) and re-merging the results into a single output. It worked mechanically but didn't hold up as a real solution: chunking still pays the full parse cost, the merge re-materializes the whole document in memory, and neither approaches the performance of mature tools like Acrobat or PitStop, which use lazy/random-access parsing. That experiment has been removed.

For now, rbara-guihard-blocks files above a configurable size limit (default 200 MB, set in Settings → Behavior; 0 disables the limit at your own risk) and surfaces a clear warning rather than freezing. The underlying library operations remain available for callers who can afford the memory/time.

A proper fix — lazy/streaming parse and metadata extraction that never loads the whole document — is planned for a future release (see Roadmap).


Roadmap

  • ICC color management (color module via lcms2) — v0.1.2
  • CMYK→CMYK color remapping in content streams — v0.1.2
  • Cross-platform installers (Windows / macOS / Linux / Docker) with bundled pdfium — v0.1.3
  • GitHub Actions release pipeline (one tag → all installers + GHCR image) — v0.1.3
  • rbv GPU-accelerated page viewer (wgpu + winit) — v0.1.4
  • rbara-gui native desktop GUI (Tauri v2) — v0.1.4
  • Split Pages — divide spreads into individual panels at a configurable width — v0.1.5
  • Stitch Pages — combine panels back into spreads at a configurable spread width — v0.1.5
  • Extract Pages — extract arbitrary page ranges into a new PDF — v0.1.5
  • Flatten Spot Colors — flatten spot color inks to CMYK process — v0.1.5
  • Command bar (: mode) with chord shortcuts and live preview — v0.1.5
  • Page object tree with spatial hit-testing — v0.1.6
  • Wireframe mode in rbv (Skia/OpenGL renderer) — v0.1.6
  • Color diagnostics panel with ICC pixel sampling — v0.1.6
  • Outline Text — vectorize embedded TrueType glyphs to PDF path operators — v0.1.6
  • Plate separation filtering (filter_by_ink, InkSelector) — v0.1.6
  • Wireframe diagnostic PDF export — v0.1.6
  • File watching / live reload in rbv — v0.1.6
  • XMP provenance metadata embedding and reading (rbara: namespace) — v0.1.7
  • Tile rendering system in rbv for large pages — v0.1.7
  • Resizable panels and activity log in rbara-gui — v0.1.7
  • Rotate PDF (/Rotate page action) — v0.1.9
  • Set Media Box action — v0.1.9
  • Configurable JPEG/WebP export quality — v0.1.9
  • System / network print for fast proofs — v0.1.9
  • Fix: macOS rbv dock-icon / defunct process on exit (clean event_loop.exit() + child reaping) — v0.1.9
  • Fix: Windows rbv console window on launch (windows_subsystem) — v0.1.9
  • RGB→CMYK conversion (vector graphics + embedded images)
  • Spot color detection service
  • LOD-aware zoom tiling in rbv
  • PDF/X validation and preflight reports
  • Configurable JPEG quality (--quality flag)
  • Lazy / streaming PDF parsing for large files (remove the hard size block)

Contributing

cargo test --workspace
  • MSRV is Rust 1.85 (edition 2024). Do not raise this floor without discussion.
  • Targets:x86_64, aarch64, wasm32-unknown-unknown (via rustybara-wasm)
  • The TrimBox is always the source-of-truth reference box. It is never modified by any operation.
  • Public API additions require documentation and at least one integration test.
  • The app-style keyboard model is the UX baseline for rbara. Modal bindings are opt-in aliases only.

Cutting a release

Releases are fully automated by .github/workflows/release.yml. To cut a new version:

  1. Bump version in rbara/Cargo.toml (and rustybara/Cargo.toml if the lib changed).
  2. Commit and push.
  3. Tag and push the tag:
    git tag v0.1.7
    git push --tags
  4. The workflow will build the Windows installer, the Linux tarball, both macOS tarballs (Apple silicon + Intel), and the Docker image, then create a GitHub Release with all artifacts and a SHA256SUMS.txt attached.

Hyphenated compatibility-iteration tags such as v0.2.0-1 create a prerelease containing only the rbara CLI/TUI installers and Docker image. The GUI and ICC packages are left at their existing versions. Tags without a hyphen continue to produce the full release suite.

The pdfium chromium build is pinned via PDFIUM_CHROMIUM env var in the workflow (currently 7776). Bump it there to refresh pdfium across all artifacts in lockstep.


Playground

Try rustybara-wasm live in the browser at rustybara.com/playground. Upload a PDF or use a sample file — trim, resize, and remap CMYK values entirely client-side via WebAssembly. No account, no upload, no server.


License

The LGPL license on the library allows downstream tools to link against rustybara without copyleft obligations on their own code, while the binaries remain fully copyleft.

Copyright (c) 2026 Addy Alvarado

capybara chillin

About

Rust library, interactive CLI, and desktop GUI for prepress PDF work — trim printer marks, manage bleed, rasterize pages, and more. A free, open-source alternative to proprietary prepress tools.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Repository files navigation

Rustybara logo

Rustybara

Prepress-focused PDF manipulation toolkit for graphic designers and print operators.

Crates.ioDownloadsDocumentationLicense


Rustybara dashboard

Rustybara is the convergence of three standalone prepress CLI tools into a unified Rust library and interactive toolset, built on the same primitives those tools proved in production:

Origin ToolPrimitive
pdf-mark-removalContent stream filtering, CTM math
resize_to_bleed_or_trim_pdfPage box geometry (MediaBox, TrimBox, BleedBox)
pdf-2-imagePDF rasterization and image encoding

It ships as a library crate (rustybara), a CLI/TUI binary (rbara), and a GPU-accelerated PDF page viewer (rbv).


Workspace

CrateDescriptionLicense
rustybaraCore PDF manipulation libraryLGPLv3
rustybara-iccICC color management — 22 bundled profilesLGPLv3
rustybara-wasmWebAssembly bindings — browser, Node.js, edgeLGPLv3
rbaraTerminal UI (Ratatui TUI)GPLv3
rbara-guiNative desktop GUI (Tauri v2)GPLv3
rbvPrepress PDF viewer (Skia + OpenGL + winit)GPLv3

Features

Featurerustybararustybara-iccrustybara-wasm
Page trim & resize
CMYK remap
Split / stitch pages
Extract page ranges
Flatten spot colors
Rasterization (pdfium)
XMP metadata embed & read
Page object tree + hit-testing
Plate separation filtering
Outline text (glyph → paths)
ICC color transforms
WebAssembly / browser
Node.js / edge runtime
  • Pipeline API — Chain operations fluently: open → trim → resize → remap → save.
  • Batch processing — Process entire directories of PDFs from CLI or TUI.
  • Interactive TUI — App-style terminal interface for designers who prefer guided workflows over raw CLI flags. Configurable output directory.
  • Prepress vocabulary — Every API surface speaks in boxes, bleeds, and DPI — not generic PDF primitives.

Installation

Pre-built installers for rbara (the CLI/TUI binary) are published with each release. Each installer bundles its own pdfium runtime — no system pdfium needed.

Windows

Download rbara-setup-<version>-x64.exe from the Releases page and run it. This is a per-user Inno Setup installer (no admin required) that installs to %LOCALAPPDATA%\Programs\rbara\, registers an opt-in PATH entry, and adds an Add/Remove Programs entry. SmartScreen may warn the first time — the binary is currently unsigned.

macOS

# Apple silicon
tar -xzf rbara-<version>-macos-arm64.tar.gz &&cd rbara-<version>-macos-arm64
./install.sh # installs to ~/.local# Intel
tar -xzf rbara-<version>-macos-x86_64.tar.gz &&cd rbara-<version>-macos-x86_64
./install.sh

The bundle is unsigned; install.sh strips the com.apple.quarantine attribute automatically. To uninstall: ./uninstall.sh.

Linux (glibc x86_64)

tar -xzf rbara-<version>-linux-x64.tar.gz &&cd rbara-<version>-linux-x64
./install.sh # ~/.local
sudo PREFIX=/usr/local ./install.sh # system-wide

Tested on Ubuntu 22.04+, Debian 12+, Fedora 38+, RHEL 9+, Arch, openSUSE Tumbleweed. Musl distros (Alpine) need a source build. To uninstall: ./uninstall.sh.

Docker

docker pull ghcr.io/addy-a/rbara:latest
# CLI usage — bind-mount your working directory
docker run --rm -v "$PWD:/work" ghcr.io/addy-a/rbara:latest \
trim /work/in.pdf -o /work/out.pdf

The image is ~175 MB (debian:bookworm-slim base) and runs as a non-root user.

Building from source

See the Contributing section. The maintainer-side installer scripts live in installer/ (one subdir per platform, each with its own README).


Quick Start

As a library

Add to your Cargo.toml:

[dependencies]
rustybara = "0.1"
use rustybara::PdfPipeline;fnmain() -> rustybara::Result<()>{// Trim marks, resize to 9pt bleed, savePdfPipeline::open("input.pdf")?
.trim()?
.resize(9.0)?
.split_pages(5.83*72.0)? // split spreads into 5.83" panels.save_pdf("output.pdf")?;Ok(())}

Rasterize a page

use rustybara::{PdfPipeline, encode::OutputFormat, raster::RenderConfig};fnmain() -> rustybara::Result<()>{let pipeline = PdfPipeline::open("input.pdf")?;let config = RenderConfig::prepress();// 300 DPI
pipeline.save_page_image(0,"page_1.jpg",&OutputFormat::Jpg,&config)?;Ok(())}

Embed XMP provenance metadata

use rustybara::{PdfPipeline, xmp};fnmain() -> rustybara::Result<()>{let source_hash = xmp::hash_file(std::path::Path::new("input.pdf"))?;let timestamp = "2026-05-28T12:00:00Z".to_string();PdfPipeline::open("input.pdf")?
.trim()?
.resize(9.0)?
.embed_metadata(&source_hash,&timestamp,&[("trim",""),("resize","bleed_pts=9")])?
.save_pdf("output.pdf")?;Ok(())}

Inspect the page object tree

use rustybara::{PdfPipeline, objects::tree::build_object_tree};fnmain() -> rustybara::Result<()>{let pipeline = PdfPipeline::open("input.pdf")?;let page_id = pipeline.doc().get_pages()[&1];let tree = build_object_tree(pipeline.doc(), page_id)?;for obj in&tree.objects{println!("{:?} bbox={:?}", obj.kind, obj.bbox);}Ok(())}

CLI

# Trim print marks
rbara trim input.pdf
# Resize to 1/8-inch bleed (--bleed remains available for point-based scripts)
rbara resize --bleed-inches 0.125 input.pdf
# Add a TrimBox, set page size, or rotate pages
rbara add-trim-box --bleed-inches 0.125 input.pdf
rbara set-media-box --width-inches 8.5 --height-inches 11 input.pdf
rbara rotate --degrees 90 input.pdf
# Export pages as 300 DPI PNGs at quality 90
rbara image --format png --dpi 300 --quality 90 input.pdf
# Extract, split, or stitch pages
rbara extract-pages --pages "1,3-5" input.pdf
rbara split-pages --panel-width 5.83 input.pdf
rbara split-pages --panel-widths 3.625,3.6875,3.6875 --axis horizontal input.pdf
rbara stitch-pages --spread-width 8.5 input.pdf
# Remap a CMYK color (rich black → 60/40/20/100)
rbara remap-color --from 1.0 1.0 1.0 1.0 --to 0.6 0.4 0.2 1.0 input.pdf
# Convert or flatten colors, and outline text
rbara convert-color-space --from-profile AdobeRGB1998 --to-profile USWebCoatedSWOP input.pdf
rbara flatten-spots input.pdf
rbara outline-text input.pdf
# Inspect page boxes, document color usage, and Rustybara provenance
rbara info input.pdf

Every PDF-writing command accepts multiple input files, --output <DIR>, and --overwrite. Without --overwrite, outputs receive an operation suffix such as _processed, _extracted, _split, or _stitch. Image export never overwrites a PDF source and also supports --annotations and --forms.

split-pages --panel-widths accepts an ordered, comma-separated plan containing at least two positive sizes in inches. The sizes must total the source page's TrimBox extent (within half a PDF point). --axis horizontal emits panels left to right; --axis vertical emits them bottom to top. The existing singular --panel-width behavior remains unchanged and defaults to the horizontal axis. PDF outputs include a Rustybara XMP provenance block.

TUI

Launch rbara with no arguments to enter the interactive terminal interface:

rbara

Arrow keys navigate, Enter selects, and Esc goes back. The menu scrolls on smaller terminals; press ? for the full keyboard reference.


rustybara-wasm

WebAssembly bindings for rustybara. Run PDF manipulation in any JavaScript or TypeScript environment — browser, Node.js, Deno, or Cloudflare Workers — with no native dependencies.

Exposes the pure-Rust pipeline subset:

  • trim() — strip content outside TrimBox
  • resize(bleed_pts) — expand page boxes by a bleed margin
  • split_pages_explicit(panel_widths_pts, axis) — split panels by exact widths
  • remap_color(from, to, tolerance) — substitute CMYK values in content streams
  • to_pdf_bytes() — serialize result as bytes for download or further processing

Rasterization (pdfium), object tree rendering, and ICC color transforms (lcms2) require the native crate and are not available in the wasm build. XMP provenance metadata is supported by the WASM package.

Browser quickstart

importinit,{PipelineHandle}from'./pkg/rustybara_wasm.js'awaitinit('./pkg/rustybara_wasm_bg.wasm')constbytes=newUint8Array(awaitfetch('input.pdf').then((r)=>r.arrayBuffer()),)lethandle=newPipelineHandle(bytes)handle=handle.trim()handle=handle.resize(8.504)constresult=handle.to_pdf_bytes()

Build

cd rustybara-wasm
wasm-pack build --target web --out-dir pkg --release

npm

The Node.js package is built as rustybara-wasm, with generated TypeScript declarations and no native runtime dependency. After the first registry release:

npm install rustybara-wasm
constfs=require('node:fs')const{ PanelAxis, PipelineHandle }=require('rustybara-wasm')constinput=fs.readFileSync('input.pdf')constpdf=newPipelineHandle(input).split_pages_explicit(Float64Array.from([261,265.5,265.5]),PanelAxis.Vertical,)fs.writeFileSync('output.pdf',pdf.to_pdf_bytes())

See rustybara-wasm/README.md for the complete Node API and local packaging instructions. The browser build remains available via the rustybara playground.


Architecture

Module Map

rustybara/src/
lib.rs — Public re-exports
pipeline.rs — PdfPipeline: high-level chaining API
error.rs — Unified error type
xmp.rs — XMP metadata embedding, reading, and SHA-256 provenance hashing
geometry/
rect.rs — Rect (position + dimensions, PDF coordinate system)
matrix.rs — Matrix (2D affine CTM transformations)
pages/
boxes.rs — PageBoxes: TrimBox, MediaBox, BleedBox, CropBox reader
split.rs — Page extraction and splitting utilities
stitch.rs — Spread stitching utilities
layout.rs — Page layout helpers
stream/
filter.rs — ContentFilter: CTM-walking content stream filter
color_ops.rs — ColorRemap: CMYK→CMYK value substitution in content streams
objects/
tree.rs — build_object_tree: full page object list (paths, images, text)
with color, CTM, overprint state, and subpath geometry
hittest.rs — Spatial hit-testing against the ObjectTree
separation.rs — filter_by_ink: plate isolation by CMYK channel or spot name
outline/ — (feature-gated: "outline")
font.rs — Extract raw font bytes from PDF resource dictionaries
encoding.rs — Resolve character codes to GlyphId
paths.rs — outline_page_text: walk content stream → per-glyph path geometry
writer.rs — glyphs_to_content_stream: serialize glyphs back to PDF operators
raster/
render.rs — PageRenderer trait, CpuRenderer (pdfium-render)
config.rs — RenderConfig (DPI, annotation toggles)
encode/
save.rs — OutputFormat enum, image encoding (JPG/PNG/WebP/TIFF)
color/ — (feature-gated: "color")
icc.rs — Re-exports from rustybara-icc crate
transform.rs — Re-exports from rustybara-icc crate
rustybara-icc/src/ (separate crate, optionally used via "color" feature)
lib.rs — ICC color management engine
color_space.rs — ColorSpaceKind enum (CMYK, RGB, Gray, Lab)
error.rs — IccError type for color operations
intent.rs — RenderingIntent enum for ICC transforms
pixel_format.rs — PixelFormat enum (RGB8, CMYK8, etc.)
transform.rs — ColorTransform: pixel-level ICC profile transforms
pdf.rs — PdfColorConverter: document-level color space conversion
profiles/ — Bundled ICC profiles (FOGRA39, GRACoL2006, etc.)

Public API

rustybara is a high-level, prepress-scoped crate. The public API speaks in prepress vocabulary:

// Prepress operationsPdfPipeline::open(path)?
.trim()? // Remove content outside TrimBox.resize(bleed_pts)? // Expand page boxes by bleed margin.remap_color(from, to, tolerance)? // Substitute CMYK values.add_trim_box(bleed_pts)? // Inset MediaBox to set a TrimBox.embed_metadata(hash, ts, ops)? // Embed rbara: XMP provenance block.save_pdf(path)?;// Write the result// Rasterization
pipeline.render_page(0,&config)?;// → DynamicImage
pipeline.save_page_image(0, path,&format,&config)?;// → file// Page operationslet new_pipeline = pipeline.extract_pages(&[0,2,4])?;// → new pipelinelet spreads = pipeline.split_pages(panel_width_pts)?;// → new pipelinelet panels = pipeline.split_pages_explicit(&[261.0,265.5,265.5],
rustybara::pages::SplitAxis::Horizontal,)?;// → new pipelinelet stitched = pipeline.stitch_pages(spread_width_pts)?;// → new pipeline// Page inspectionlet boxes = PageBoxes::read(&doc, page_id)?;
boxes.trim_or_media()// TrimBox if present, else MediaBox
boxes.bleed_rect(9.0)// Expand trim by bleed amount// XMP provenance
let hash = xmp::hash_file(path)?;// sha256:<hex>let block = pipeline.read_xmp_block();// Option<RbaraXmpBlock>// Object tree (paths, images, text — full geometry + color)let tree = objects::tree::build_object_tree(doc, page_id)?;let plate_objs = objects::separation::filter_by_ink(&tree,&InkSelector::CmykChannel(CmykChannel::Cyan),);// Text outline extraction (requires "outline" feature)#[cfg(feature = "outline")]{use rustybara::outline::{outline_page_text, writer::glyphs_to_content_stream};let glyphs = outline_page_text(doc, page_id)?;let pdf_ops = glyphs_to_content_stream(&glyphs);// → PDF path operators}// Color space conversion (requires "color" feature)#[cfg(feature = "color")]{use rustybara::color::{ColorTransform,RenderingIntent, profiles};let transform = ColorTransform::new(&profiles::COATED_FOGRA_39,&profiles::COATED_GRACOL_2006,RenderingIntent::RelativeColorimetric,)?;
pipeline.convert_color_space(&transform)?;// Convert entire document}

Feature Flags

FlagWhat it enablesDefault
rasterpdfium-render, image, webp — page rasterization
outlinettf-parser — text outline / glyph-path extraction
colorrustybara-icc / lcms2 — ICC color management
wasmWebAssembly build gate
gpuReserved for future GPU renderer

Renderer Trait

Rendering is behind a trait for future GPU backend support:

pubtraitPageRenderer{fnrender(&self,page:&PdfPage,config:&RenderConfig)
-> Result<DynamicImage>;}pubstructCpuRenderer;// pdfium-render — ships today// pub struct GpuRenderer; // vello/wgpu — future work

Dependencies

CrateRole
lopdf 0.40PDF object graph manipulation
pdfium-render 0.9PDF rasterization via PDFium
image 0.25Bitmap encoding (JPEG, PNG, WebP, TIFF)
rayon 1.11Parallel page rendering
ttf-parser 0.25TrueType glyph outline extraction (outline feature)
uuid 1UUID v4 generation for XMP provenance
sha2 0.11SHA-256 source file hashing for XMP provenance
rustybara-icc 0.1ICC color management (optional, color feature)
lcms2 6.1Little CMS color engine (via rustybara-icc, color feature)

Runtime Requirement — PDFium

The render_page and save_page_image functions require the PDFium shared library at runtime. Place the appropriate binary alongside your executable:

PlatformFile
Windowspdfium.dll
macOSlibpdfium.dylib
Linuxlibpdfium.so

Pre-built binaries: pdfium-binaries

Note: End-users of the rbara binary do not need to do this manually — the pre-built installers bundle the matching pdfium for each platform. This requirement applies only when consuming rustybara as a library in your own Rust project.

Operations that do not rasterize (trim, resize, save_pdf, page_count, PageBoxes::read, build_object_tree, embed_metadata) work without PDFium.


rbara — CLI & TUI Binary

rbara is the interactive front-end for rustybara. It provides both a flag-based CLI for scripting and a TUI for guided workflows.

Keyboard Reference (TUI)

KeyAction
tTrim print marks
rResize to bleed
bAdd TrimBox
sSet MediaBox
gRotate pages
xExport to image
eExtract pages
pSplit pages
hStitch pages
mRemap colors
cConvert color space
kFlatten spot colors
lOutline text
/Output path
oToggle overwrite mode
fChange files
qQuit
EnterRun selected action
?Keyboard reference overlay

UX Model

The TUI follows an app-style keyboard model — arrow keys, Enter, Esc — designed for designers who have never used a terminal before. Vim-style bindings may be layered on as aliases in a future version.

File-first workflow: launch → select file or directory → commands become available. Directories auto-glob *.pdf files.


rbv — PDF Page Viewer

rbv is a prepress-focused PDF viewer built on Skia (OpenGL) + winit. It is designed for quick go/no-go QC decisions — bleed check, color space, spot ink declaration — not sub-pixel vector fidelity. Pages are rasterized by pdfium and displayed as a bitmap; the object tree layer adds wireframe, hit-testing, and color diagnostics on top.

rbv <file> [page] [--dpi <dpi>]

The initial preview renders at 72 DPI for fast startup, then a full-resolution render (at the specified DPI, default 300) replaces it in the background.

Keyboard Shortcuts

KeyAction
WToggle wireframe mode
OToggle prepress box overlays (bleed/trim/crop)
Ctrl + = / Ctrl + +Zoom in
Ctrl + -Zoom out
Ctrl + 0Reset zoom and pan
Ctrl + ScrollZoom toward cursor
Left dragPan
Left clickSelect object + sample color
H / / K / Previous page
L / / J / Next page
NgJump to page N (e.g. 5g)
Ctrl+Shift+DToggle debug overlay
Ctrl+Shift+EExport wireframe diagnostic PDF
EscExit

Wireframe Mode

W replaces the raster image with a vector outline view derived from the page's ObjectTree. Every path, image, and text block is drawn as a thin black stroke in page-space coordinates. The selected object receives a 2px blue highlight. Glyph outlines (extracted via outline_page_text) are drawn on top when available. Ctrl+Shift+E exports the wireframe geometry to a diagnostic PDF for cross-referencing with qpdf --qdf.

Color Diagnostics

Left-click any area to sample:

  • Pixel RGBA — what the monitor is displaying (sampled from the rasterized bitmap)
  • PDF color — the declared fill/stroke color of the hit object from the content stream (DeviceGray / DeviceRGB / DeviceCMYK / Separation)
  • ICC CMYK — the pixel RGB converted to CMYK via Little CMS 2 (destination: US Web Coated SWOP)

A crosshair marker is stored in PDF coordinates and projected to screen each frame, so it stays locked to the correct page position as you zoom and pan.

File Watching

rbv monitors the opened file via notify. When the file changes on disk (e.g. after an InDesign export), it automatically re-opens the document, rebuilds the object tree, and re-renders — supporting a save-and-preview loop without restarting.

IPC

rbara-gui can send commands to a running rbv instance (e.g. switch to a different file after processing). rbv accepts these via a local IPC channel when launched with --listen.


Known Limitations

LimitationNotes
sRGB rasterization onlyCMYK→sRGB via PDFium. ICC color transforms available via color feature for stream-level operations.
JPEG quality not configurableFixed encoder quality. --quality flag planned.
Spot color approximationPDFium renders spot inks as CMYK approximations.
No Form XObject ColorSpace pruningInherited limitation from content stream filtering.
rbv requires display serverNo headless preview. Graceful error on missing GPU.
rbv zoom qualityRaster-only rendering degrades past ~150–200% zoom. LOD tiling planned.
CFF / Type1 glyph outlinesttf-parser requires sfnt container; raw CFF fonts use a OTTO header shim with ongoing refinement.
Very large PDFs (~200 MB+)Hard-blocked on add in rbara-gui. See below.

Large file handling

rustybara opens PDFs eagerly: lopdf parses the entire object graph into memory on load, and the PDFium render path round-trips through a full document serialization. For very large files (roughly 200 MB and up, e.g. imposed print runs of hundreds of pages) this parse can take tens of seconds and consume multiple gigabytes of RAM — long enough to make the desktop app appear frozen.

We explored splitting large files into page-range chunks (processing each independently) and re-merging the results into a single output. It worked mechanically but didn't hold up as a real solution: chunking still pays the full parse cost, the merge re-materializes the whole document in memory, and neither approaches the performance of mature tools like Acrobat or PitStop, which use lazy/random-access parsing. That experiment has been removed.

For now, rbara-guihard-blocks files above a configurable size limit (default 200 MB, set in Settings → Behavior; 0 disables the limit at your own risk) and surfaces a clear warning rather than freezing. The underlying library operations remain available for callers who can afford the memory/time.

A proper fix — lazy/streaming parse and metadata extraction that never loads the whole document — is planned for a future release (see Roadmap).


Roadmap

  • ICC color management (color module via lcms2) — v0.1.2
  • CMYK→CMYK color remapping in content streams — v0.1.2
  • Cross-platform installers (Windows / macOS / Linux / Docker) with bundled pdfium — v0.1.3
  • GitHub Actions release pipeline (one tag → all installers + GHCR image) — v0.1.3
  • rbv GPU-accelerated page viewer (wgpu + winit) — v0.1.4
  • rbara-gui native desktop GUI (Tauri v2) — v0.1.4
  • Split Pages — divide spreads into individual panels at a configurable width — v0.1.5
  • Stitch Pages — combine panels back into spreads at a configurable spread width — v0.1.5
  • Extract Pages — extract arbitrary page ranges into a new PDF — v0.1.5
  • Flatten Spot Colors — flatten spot color inks to CMYK process — v0.1.5
  • Command bar (: mode) with chord shortcuts and live preview — v0.1.5
  • Page object tree with spatial hit-testing — v0.1.6
  • Wireframe mode in rbv (Skia/OpenGL renderer) — v0.1.6
  • Color diagnostics panel with ICC pixel sampling — v0.1.6
  • Outline Text — vectorize embedded TrueType glyphs to PDF path operators — v0.1.6
  • Plate separation filtering (filter_by_ink, InkSelector) — v0.1.6
  • Wireframe diagnostic PDF export — v0.1.6
  • File watching / live reload in rbv — v0.1.6
  • XMP provenance metadata embedding and reading (rbara: namespace) — v0.1.7
  • Tile rendering system in rbv for large pages — v0.1.7
  • Resizable panels and activity log in rbara-gui — v0.1.7
  • Rotate PDF (/Rotate page action) — v0.1.9
  • Set Media Box action — v0.1.9
  • Configurable JPEG/WebP export quality — v0.1.9
  • System / network print for fast proofs — v0.1.9
  • Fix: macOS rbv dock-icon / defunct process on exit (clean event_loop.exit() + child reaping) — v0.1.9
  • Fix: Windows rbv console window on launch (windows_subsystem) — v0.1.9
  • RGB→CMYK conversion (vector graphics + embedded images)
  • Spot color detection service
  • LOD-aware zoom tiling in rbv
  • PDF/X validation and preflight reports
  • Configurable JPEG quality (--quality flag)
  • Lazy / streaming PDF parsing for large files (remove the hard size block)

Contributing

cargo test --workspace
  • MSRV is Rust 1.85 (edition 2024). Do not raise this floor without discussion.
  • Targets:x86_64, aarch64, wasm32-unknown-unknown (via rustybara-wasm)
  • The TrimBox is always the source-of-truth reference box. It is never modified by any operation.
  • Public API additions require documentation and at least one integration test.
  • The app-style keyboard model is the UX baseline for rbara. Modal bindings are opt-in aliases only.

Cutting a release

Releases are fully automated by .github/workflows/release.yml. To cut a new version:

  1. Bump version in rbara/Cargo.toml (and rustybara/Cargo.toml if the lib changed).
  2. Commit and push.
  3. Tag and push the tag:
    git tag v0.1.7
    git push --tags
  4. The workflow will build the Windows installer, the Linux tarball, both macOS tarballs (Apple silicon + Intel), and the Docker image, then create a GitHub Release with all artifacts and a SHA256SUMS.txt attached.

Hyphenated compatibility-iteration tags such as v0.2.0-1 create a prerelease containing only the rbara CLI/TUI installers and Docker image. The GUI and ICC packages are left at their existing versions. Tags without a hyphen continue to produce the full release suite.

The pdfium chromium build is pinned via PDFIUM_CHROMIUM env var in the workflow (currently 7776). Bump it there to refresh pdfium across all artifacts in lockstep.


Playground

Try rustybara-wasm live in the browser at rustybara.com/playground. Upload a PDF or use a sample file — trim, resize, and remap CMYK values entirely client-side via WebAssembly. No account, no upload, no server.


License

The LGPL license on the library allows downstream tools to link against rustybara without copyleft obligations on their own code, while the binaries remain fully copyleft.

Copyright (c) 2026 Addy Alvarado

capybara chillin

About

Rust library, interactive CLI, and desktop GUI for prepress PDF work — trim printer marks, manage bleed, rasterize pages, and more. A free, open-source alternative to proprietary prepress tools.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

Rustybara logo

Rustybara

Prepress-focused PDF manipulation toolkit for graphic designers and print operators.

Crates.ioDownloadsDocumentationLicense


Rustybara dashboard

Rustybara is the convergence of three standalone prepress CLI tools into a unified Rust library and interactive toolset, built on the same primitives those tools proved in production:

Origin ToolPrimitive
pdf-mark-removalContent stream filtering, CTM math
resize_to_bleed_or_trim_pdfPage box geometry (MediaBox, TrimBox, BleedBox)
pdf-2-imagePDF rasterization and image encoding

It ships as a library crate (rustybara), a CLI/TUI binary (rbara), and a GPU-accelerated PDF page viewer (rbv).


Workspace

CrateDescriptionLicense
rustybaraCore PDF manipulation libraryLGPLv3
rustybara-iccICC color management — 22 bundled profilesLGPLv3
rustybara-wasmWebAssembly bindings — browser, Node.js, edgeLGPLv3
rbaraTerminal UI (Ratatui TUI)GPLv3
rbara-guiNative desktop GUI (Tauri v2)GPLv3
rbvPrepress PDF viewer (Skia + OpenGL + winit)GPLv3

Features

Featurerustybararustybara-iccrustybara-wasm
Page trim & resize
CMYK remap
Split / stitch pages
Extract page ranges
Flatten spot colors
Rasterization (pdfium)
XMP metadata embed & read
Page object tree + hit-testing
Plate separation filtering
Outline text (glyph → paths)
ICC color transforms
WebAssembly / browser
Node.js / edge runtime
  • Pipeline API — Chain operations fluently: open → trim → resize → remap → save.
  • Batch processing — Process entire directories of PDFs from CLI or TUI.
  • Interactive TUI — App-style terminal interface for designers who prefer guided workflows over raw CLI flags. Configurable output directory.
  • Prepress vocabulary — Every API surface speaks in boxes, bleeds, and DPI — not generic PDF primitives.

Installation

Pre-built installers for rbara (the CLI/TUI binary) are published with each release. Each installer bundles its own pdfium runtime — no system pdfium needed.

Windows

Download rbara-setup-<version>-x64.exe from the Releases page and run it. This is a per-user Inno Setup installer (no admin required) that installs to %LOCALAPPDATA%\Programs\rbara\, registers an opt-in PATH entry, and adds an Add/Remove Programs entry. SmartScreen may warn the first time — the binary is currently unsigned.

macOS

# Apple silicon
tar -xzf rbara-<version>-macos-arm64.tar.gz &&cd rbara-<version>-macos-arm64
./install.sh # installs to ~/.local# Intel
tar -xzf rbara-<version>-macos-x86_64.tar.gz &&cd rbara-<version>-macos-x86_64
./install.sh

The bundle is unsigned; install.sh strips the com.apple.quarantine attribute automatically. To uninstall: ./uninstall.sh.

Linux (glibc x86_64)

tar -xzf rbara-<version>-linux-x64.tar.gz &&cd rbara-<version>-linux-x64
./install.sh # ~/.local
sudo PREFIX=/usr/local ./install.sh # system-wide

Tested on Ubuntu 22.04+, Debian 12+, Fedora 38+, RHEL 9+, Arch, openSUSE Tumbleweed. Musl distros (Alpine) need a source build. To uninstall: ./uninstall.sh.

Docker

docker pull ghcr.io/addy-a/rbara:latest
# CLI usage — bind-mount your working directory
docker run --rm -v "$PWD:/work" ghcr.io/addy-a/rbara:latest \
trim /work/in.pdf -o /work/out.pdf

The image is ~175 MB (debian:bookworm-slim base) and runs as a non-root user.

Building from source

See the Contributing section. The maintainer-side installer scripts live in installer/ (one subdir per platform, each with its own README).


Quick Start

As a library

Add to your Cargo.toml:

[dependencies]
rustybara = "0.1"
use rustybara::PdfPipeline;fnmain() -> rustybara::Result<()>{// Trim marks, resize to 9pt bleed, savePdfPipeline::open("input.pdf")?
.trim()?
.resize(9.0)?
.split_pages(5.83*72.0)? // split spreads into 5.83" panels.save_pdf("output.pdf")?;Ok(())}

Rasterize a page

use rustybara::{PdfPipeline, encode::OutputFormat, raster::RenderConfig};fnmain() -> rustybara::Result<()>{let pipeline = PdfPipeline::open("input.pdf")?;let config = RenderConfig::prepress();// 300 DPI
pipeline.save_page_image(0,"page_1.jpg",&OutputFormat::Jpg,&config)?;Ok(())}

Embed XMP provenance metadata

use rustybara::{PdfPipeline, xmp};fnmain() -> rustybara::Result<()>{let source_hash = xmp::hash_file(std::path::Path::new("input.pdf"))?;let timestamp = "2026-05-28T12:00:00Z".to_string();PdfPipeline::open("input.pdf")?
.trim()?
.resize(9.0)?
.embed_metadata(&source_hash,&timestamp,&[("trim",""),("resize","bleed_pts=9")])?
.save_pdf("output.pdf")?;Ok(())}

Inspect the page object tree

use rustybara::{PdfPipeline, objects::tree::build_object_tree};fnmain() -> rustybara::Result<()>{let pipeline = PdfPipeline::open("input.pdf")?;let page_id = pipeline.doc().get_pages()[&1];let tree = build_object_tree(pipeline.doc(), page_id)?;for obj in&tree.objects{println!("{:?} bbox={:?}", obj.kind, obj.bbox);}Ok(())}

CLI

# Trim print marks
rbara trim input.pdf
# Resize to 1/8-inch bleed (--bleed remains available for point-based scripts)
rbara resize --bleed-inches 0.125 input.pdf
# Add a TrimBox, set page size, or rotate pages
rbara add-trim-box --bleed-inches 0.125 input.pdf
rbara set-media-box --width-inches 8.5 --height-inches 11 input.pdf
rbara rotate --degrees 90 input.pdf
# Export pages as 300 DPI PNGs at quality 90
rbara image --format png --dpi 300 --quality 90 input.pdf
# Extract, split, or stitch pages
rbara extract-pages --pages "1,3-5" input.pdf
rbara split-pages --panel-width 5.83 input.pdf
rbara split-pages --panel-widths 3.625,3.6875,3.6875 --axis horizontal input.pdf
rbara stitch-pages --spread-width 8.5 input.pdf
# Remap a CMYK color (rich black → 60/40/20/100)
rbara remap-color --from 1.0 1.0 1.0 1.0 --to 0.6 0.4 0.2 1.0 input.pdf
# Convert or flatten colors, and outline text
rbara convert-color-space --from-profile AdobeRGB1998 --to-profile USWebCoatedSWOP input.pdf
rbara flatten-spots input.pdf
rbara outline-text input.pdf
# Inspect page boxes, document color usage, and Rustybara provenance
rbara info input.pdf

Every PDF-writing command accepts multiple input files, --output <DIR>, and --overwrite. Without --overwrite, outputs receive an operation suffix such as _processed, _extracted, _split, or _stitch. Image export never overwrites a PDF source and also supports --annotations and --forms.

split-pages --panel-widths accepts an ordered, comma-separated plan containing at least two positive sizes in inches. The sizes must total the source page's TrimBox extent (within half a PDF point). --axis horizontal emits panels left to right; --axis vertical emits them bottom to top. The existing singular --panel-width behavior remains unchanged and defaults to the horizontal axis. PDF outputs include a Rustybara XMP provenance block.

TUI

Launch rbara with no arguments to enter the interactive terminal interface:

rbara

Arrow keys navigate, Enter selects, and Esc goes back. The menu scrolls on smaller terminals; press ? for the full keyboard reference.


rustybara-wasm

WebAssembly bindings for rustybara. Run PDF manipulation in any JavaScript or TypeScript environment — browser, Node.js, Deno, or Cloudflare Workers — with no native dependencies.

Exposes the pure-Rust pipeline subset:

  • trim() — strip content outside TrimBox
  • resize(bleed_pts) — expand page boxes by a bleed margin
  • split_pages_explicit(panel_widths_pts, axis) — split panels by exact widths
  • remap_color(from, to, tolerance) — substitute CMYK values in content streams
  • to_pdf_bytes() — serialize result as bytes for download or further processing

Rasterization (pdfium), object tree rendering, and ICC color transforms (lcms2) require the native crate and are not available in the wasm build. XMP provenance metadata is supported by the WASM package.

Browser quickstart

importinit,{PipelineHandle}from'./pkg/rustybara_wasm.js'awaitinit('./pkg/rustybara_wasm_bg.wasm')constbytes=newUint8Array(awaitfetch('input.pdf').then((r)=>r.arrayBuffer()),)lethandle=newPipelineHandle(bytes)handle=handle.trim()handle=handle.resize(8.504)constresult=handle.to_pdf_bytes()

Build

cd rustybara-wasm
wasm-pack build --target web --out-dir pkg --release

npm

The Node.js package is built as rustybara-wasm, with generated TypeScript declarations and no native runtime dependency. After the first registry release:

npm install rustybara-wasm
constfs=require('node:fs')const{ PanelAxis, PipelineHandle }=require('rustybara-wasm')constinput=fs.readFileSync('input.pdf')constpdf=newPipelineHandle(input).split_pages_explicit(Float64Array.from([261,265.5,265.5]),PanelAxis.Vertical,)fs.writeFileSync('output.pdf',pdf.to_pdf_bytes())

See rustybara-wasm/README.md for the complete Node API and local packaging instructions. The browser build remains available via the rustybara playground.


Architecture

Module Map

rustybara/src/
lib.rs — Public re-exports
pipeline.rs — PdfPipeline: high-level chaining API
error.rs — Unified error type
xmp.rs — XMP metadata embedding, reading, and SHA-256 provenance hashing
geometry/
rect.rs — Rect (position + dimensions, PDF coordinate system)
matrix.rs — Matrix (2D affine CTM transformations)
pages/
boxes.rs — PageBoxes: TrimBox, MediaBox, BleedBox, CropBox reader
split.rs — Page extraction and splitting utilities
stitch.rs — Spread stitching utilities
layout.rs — Page layout helpers
stream/
filter.rs — ContentFilter: CTM-walking content stream filter
color_ops.rs — ColorRemap: CMYK→CMYK value substitution in content streams
objects/
tree.rs — build_object_tree: full page object list (paths, images, text)
with color, CTM, overprint state, and subpath geometry
hittest.rs — Spatial hit-testing against the ObjectTree
separation.rs — filter_by_ink: plate isolation by CMYK channel or spot name
outline/ — (feature-gated: "outline")
font.rs — Extract raw font bytes from PDF resource dictionaries
encoding.rs — Resolve character codes to GlyphId
paths.rs — outline_page_text: walk content stream → per-glyph path geometry
writer.rs — glyphs_to_content_stream: serialize glyphs back to PDF operators
raster/
render.rs — PageRenderer trait, CpuRenderer (pdfium-render)
config.rs — RenderConfig (DPI, annotation toggles)
encode/
save.rs — OutputFormat enum, image encoding (JPG/PNG/WebP/TIFF)
color/ — (feature-gated: "color")
icc.rs — Re-exports from rustybara-icc crate
transform.rs — Re-exports from rustybara-icc crate
rustybara-icc/src/ (separate crate, optionally used via "color" feature)
lib.rs — ICC color management engine
color_space.rs — ColorSpaceKind enum (CMYK, RGB, Gray, Lab)
error.rs — IccError type for color operations
intent.rs — RenderingIntent enum for ICC transforms
pixel_format.rs — PixelFormat enum (RGB8, CMYK8, etc.)
transform.rs — ColorTransform: pixel-level ICC profile transforms
pdf.rs — PdfColorConverter: document-level color space conversion
profiles/ — Bundled ICC profiles (FOGRA39, GRACoL2006, etc.)

Public API

rustybara is a high-level, prepress-scoped crate. The public API speaks in prepress vocabulary:

// Prepress operationsPdfPipeline::open(path)?
.trim()? // Remove content outside TrimBox.resize(bleed_pts)? // Expand page boxes by bleed margin.remap_color(from, to, tolerance)? // Substitute CMYK values.add_trim_box(bleed_pts)? // Inset MediaBox to set a TrimBox.embed_metadata(hash, ts, ops)? // Embed rbara: XMP provenance block.save_pdf(path)?;// Write the result// Rasterization
pipeline.render_page(0,&config)?;// → DynamicImage
pipeline.save_page_image(0, path,&format,&config)?;// → file// Page operationslet new_pipeline = pipeline.extract_pages(&[0,2,4])?;// → new pipelinelet spreads = pipeline.split_pages(panel_width_pts)?;// → new pipelinelet panels = pipeline.split_pages_explicit(&[261.0,265.5,265.5],
rustybara::pages::SplitAxis::Horizontal,)?;// → new pipelinelet stitched = pipeline.stitch_pages(spread_width_pts)?;// → new pipeline// Page inspectionlet boxes = PageBoxes::read(&doc, page_id)?;
boxes.trim_or_media()// TrimBox if present, else MediaBox
boxes.bleed_rect(9.0)// Expand trim by bleed amount// XMP provenance
let hash = xmp::hash_file(path)?;// sha256:<hex>let block = pipeline.read_xmp_block();// Option<RbaraXmpBlock>// Object tree (paths, images, text — full geometry + color)let tree = objects::tree::build_object_tree(doc, page_id)?;let plate_objs = objects::separation::filter_by_ink(&tree,&InkSelector::CmykChannel(CmykChannel::Cyan),);// Text outline extraction (requires "outline" feature)#[cfg(feature = "outline")]{use rustybara::outline::{outline_page_text, writer::glyphs_to_content_stream};let glyphs = outline_page_text(doc, page_id)?;let pdf_ops = glyphs_to_content_stream(&glyphs);// → PDF path operators}// Color space conversion (requires "color" feature)#[cfg(feature = "color")]{use rustybara::color::{ColorTransform,RenderingIntent, profiles};let transform = ColorTransform::new(&profiles::COATED_FOGRA_39,&profiles::COATED_GRACOL_2006,RenderingIntent::RelativeColorimetric,)?;
pipeline.convert_color_space(&transform)?;// Convert entire document}

Feature Flags

FlagWhat it enablesDefault
rasterpdfium-render, image, webp — page rasterization
outlinettf-parser — text outline / glyph-path extraction
colorrustybara-icc / lcms2 — ICC color management
wasmWebAssembly build gate
gpuReserved for future GPU renderer

Renderer Trait

Rendering is behind a trait for future GPU backend support:

pubtraitPageRenderer{fnrender(&self,page:&PdfPage,config:&RenderConfig)
-> Result<DynamicImage>;}pubstructCpuRenderer;// pdfium-render — ships today// pub struct GpuRenderer; // vello/wgpu — future work

Dependencies

CrateRole
lopdf 0.40PDF object graph manipulation
pdfium-render 0.9PDF rasterization via PDFium
image 0.25Bitmap encoding (JPEG, PNG, WebP, TIFF)
rayon 1.11Parallel page rendering
ttf-parser 0.25TrueType glyph outline extraction (outline feature)
uuid 1UUID v4 generation for XMP provenance
sha2 0.11SHA-256 source file hashing for XMP provenance
rustybara-icc 0.1ICC color management (optional, color feature)
lcms2 6.1Little CMS color engine (via rustybara-icc, color feature)

Runtime Requirement — PDFium

The render_page and save_page_image functions require the PDFium shared library at runtime. Place the appropriate binary alongside your executable:

PlatformFile
Windowspdfium.dll
macOSlibpdfium.dylib
Linuxlibpdfium.so

Pre-built binaries: pdfium-binaries

Note: End-users of the rbara binary do not need to do this manually — the pre-built installers bundle the matching pdfium for each platform. This requirement applies only when consuming rustybara as a library in your own Rust project.

Operations that do not rasterize (trim, resize, save_pdf, page_count, PageBoxes::read, build_object_tree, embed_metadata) work without PDFium.


rbara — CLI & TUI Binary

rbara is the interactive front-end for rustybara. It provides both a flag-based CLI for scripting and a TUI for guided workflows.

Keyboard Reference (TUI)

KeyAction
tTrim print marks
rResize to bleed
bAdd TrimBox
sSet MediaBox
gRotate pages
xExport to image
eExtract pages
pSplit pages
hStitch pages
mRemap colors
cConvert color space
kFlatten spot colors
lOutline text
/Output path
oToggle overwrite mode
fChange files
qQuit
EnterRun selected action
?Keyboard reference overlay

UX Model

The TUI follows an app-style keyboard model — arrow keys, Enter, Esc — designed for designers who have never used a terminal before. Vim-style bindings may be layered on as aliases in a future version.

File-first workflow: launch → select file or directory → commands become available. Directories auto-glob *.pdf files.


rbv — PDF Page Viewer

rbv is a prepress-focused PDF viewer built on Skia (OpenGL) + winit. It is designed for quick go/no-go QC decisions — bleed check, color space, spot ink declaration — not sub-pixel vector fidelity. Pages are rasterized by pdfium and displayed as a bitmap; the object tree layer adds wireframe, hit-testing, and color diagnostics on top.

rbv <file> [page] [--dpi <dpi>]

The initial preview renders at 72 DPI for fast startup, then a full-resolution render (at the specified DPI, default 300) replaces it in the background.

Keyboard Shortcuts

KeyAction
WToggle wireframe mode
OToggle prepress box overlays (bleed/trim/crop)
Ctrl + = / Ctrl + +Zoom in
Ctrl + -Zoom out
Ctrl + 0Reset zoom and pan
Ctrl + ScrollZoom toward cursor
Left dragPan
Left clickSelect object + sample color
H / / K / Previous page
L / / J / Next page
NgJump to page N (e.g. 5g)
Ctrl+Shift+DToggle debug overlay
Ctrl+Shift+EExport wireframe diagnostic PDF
EscExit

Wireframe Mode

W replaces the raster image with a vector outline view derived from the page's ObjectTree. Every path, image, and text block is drawn as a thin black stroke in page-space coordinates. The selected object receives a 2px blue highlight. Glyph outlines (extracted via outline_page_text) are drawn on top when available. Ctrl+Shift+E exports the wireframe geometry to a diagnostic PDF for cross-referencing with qpdf --qdf.

Color Diagnostics

Left-click any area to sample:

  • Pixel RGBA — what the monitor is displaying (sampled from the rasterized bitmap)
  • PDF color — the declared fill/stroke color of the hit object from the content stream (DeviceGray / DeviceRGB / DeviceCMYK / Separation)
  • ICC CMYK — the pixel RGB converted to CMYK via Little CMS 2 (destination: US Web Coated SWOP)

A crosshair marker is stored in PDF coordinates and projected to screen each frame, so it stays locked to the correct page position as you zoom and pan.

File Watching

rbv monitors the opened file via notify. When the file changes on disk (e.g. after an InDesign export), it automatically re-opens the document, rebuilds the object tree, and re-renders — supporting a save-and-preview loop without restarting.

IPC

rbara-gui can send commands to a running rbv instance (e.g. switch to a different file after processing). rbv accepts these via a local IPC channel when launched with --listen.


Known Limitations

LimitationNotes
sRGB rasterization onlyCMYK→sRGB via PDFium. ICC color transforms available via color feature for stream-level operations.
JPEG quality not configurableFixed encoder quality. --quality flag planned.
Spot color approximationPDFium renders spot inks as CMYK approximations.
No Form XObject ColorSpace pruningInherited limitation from content stream filtering.
rbv requires display serverNo headless preview. Graceful error on missing GPU.
rbv zoom qualityRaster-only rendering degrades past ~150–200% zoom. LOD tiling planned.
CFF / Type1 glyph outlinesttf-parser requires sfnt container; raw CFF fonts use a OTTO header shim with ongoing refinement.
Very large PDFs (~200 MB+)Hard-blocked on add in rbara-gui. See below.

Large file handling

rustybara opens PDFs eagerly: lopdf parses the entire object graph into memory on load, and the PDFium render path round-trips through a full document serialization. For very large files (roughly 200 MB and up, e.g. imposed print runs of hundreds of pages) this parse can take tens of seconds and consume multiple gigabytes of RAM — long enough to make the desktop app appear frozen.

We explored splitting large files into page-range chunks (processing each independently) and re-merging the results into a single output. It worked mechanically but didn't hold up as a real solution: chunking still pays the full parse cost, the merge re-materializes the whole document in memory, and neither approaches the performance of mature tools like Acrobat or PitStop, which use lazy/random-access parsing. That experiment has been removed.

For now, rbara-guihard-blocks files above a configurable size limit (default 200 MB, set in Settings → Behavior; 0 disables the limit at your own risk) and surfaces a clear warning rather than freezing. The underlying library operations remain available for callers who can afford the memory/time.

A proper fix — lazy/streaming parse and metadata extraction that never loads the whole document — is planned for a future release (see Roadmap).


Roadmap

  • ICC color management (color module via lcms2) — v0.1.2
  • CMYK→CMYK color remapping in content streams — v0.1.2
  • Cross-platform installers (Windows / macOS / Linux / Docker) with bundled pdfium — v0.1.3
  • GitHub Actions release pipeline (one tag → all installers + GHCR image) — v0.1.3
  • rbv GPU-accelerated page viewer (wgpu + winit) — v0.1.4
  • rbara-gui native desktop GUI (Tauri v2) — v0.1.4
  • Split Pages — divide spreads into individual panels at a configurable width — v0.1.5
  • Stitch Pages — combine panels back into spreads at a configurable spread width — v0.1.5
  • Extract Pages — extract arbitrary page ranges into a new PDF — v0.1.5
  • Flatten Spot Colors — flatten spot color inks to CMYK process — v0.1.5
  • Command bar (: mode) with chord shortcuts and live preview — v0.1.5
  • Page object tree with spatial hit-testing — v0.1.6
  • Wireframe mode in rbv (Skia/OpenGL renderer) — v0.1.6
  • Color diagnostics panel with ICC pixel sampling — v0.1.6
  • Outline Text — vectorize embedded TrueType glyphs to PDF path operators — v0.1.6
  • Plate separation filtering (filter_by_ink, InkSelector) — v0.1.6
  • Wireframe diagnostic PDF export — v0.1.6
  • File watching / live reload in rbv — v0.1.6
  • XMP provenance metadata embedding and reading (rbara: namespace) — v0.1.7
  • Tile rendering system in rbv for large pages — v0.1.7
  • Resizable panels and activity log in rbara-gui — v0.1.7
  • Rotate PDF (/Rotate page action) — v0.1.9
  • Set Media Box action — v0.1.9
  • Configurable JPEG/WebP export quality — v0.1.9
  • System / network print for fast proofs — v0.1.9
  • Fix: macOS rbv dock-icon / defunct process on exit (clean event_loop.exit() + child reaping) — v0.1.9
  • Fix: Windows rbv console window on launch (windows_subsystem) — v0.1.9
  • RGB→CMYK conversion (vector graphics + embedded images)
  • Spot color detection service
  • LOD-aware zoom tiling in rbv
  • PDF/X validation and preflight reports
  • Configurable JPEG quality (--quality flag)
  • Lazy / streaming PDF parsing for large files (remove the hard size block)

Contributing

cargo test --workspace
  • MSRV is Rust 1.85 (edition 2024). Do not raise this floor without discussion.
  • Targets:x86_64, aarch64, wasm32-unknown-unknown (via rustybara-wasm)
  • The TrimBox is always the source-of-truth reference box. It is never modified by any operation.
  • Public API additions require documentation and at least one integration test.
  • The app-style keyboard model is the UX baseline for rbara. Modal bindings are opt-in aliases only.

Cutting a release

Releases are fully automated by .github/workflows/release.yml. To cut a new version:

  1. Bump version in rbara/Cargo.toml (and rustybara/Cargo.toml if the lib changed).
  2. Commit and push.
  3. Tag and push the tag:
    git tag v0.1.7
    git push --tags
  4. The workflow will build the Windows installer, the Linux tarball, both macOS tarballs (Apple silicon + Intel), and the Docker image, then create a GitHub Release with all artifacts and a SHA256SUMS.txt attached.

Hyphenated compatibility-iteration tags such as v0.2.0-1 create a prerelease containing only the rbara CLI/TUI installers and Docker image. The GUI and ICC packages are left at their existing versions. Tags without a hyphen continue to produce the full release suite.

The pdfium chromium build is pinned via PDFIUM_CHROMIUM env var in the workflow (currently 7776). Bump it there to refresh pdfium across all artifacts in lockstep.


Playground

Try rustybara-wasm live in the browser at rustybara.com/playground. Upload a PDF or use a sample file — trim, resize, and remap CMYK values entirely client-side via WebAssembly. No account, no upload, no server.


License

The LGPL license on the library allows downstream tools to link against rustybara without copyleft obligations on their own code, while the binaries remain fully copyleft.

Copyright (c) 2026 Addy Alvarado

capybara chillin

About

Rust library, interactive CLI, and desktop GUI for prepress PDF work — trim printer marks, manage bleed, rasterize pages, and more. A free, open-source alternative to proprietary prepress tools.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

Rustybara logo

Rustybara

Prepress-focused PDF manipulation toolkit for graphic designers and print operators.

Crates.ioDownloadsDocumentationLicense


Rustybara dashboard

Rustybara is the convergence of three standalone prepress CLI tools into a unified Rust library and interactive toolset, built on the same primitives those tools proved in production:

Origin ToolPrimitive
pdf-mark-removalContent stream filtering, CTM math
resize_to_bleed_or_trim_pdfPage box geometry (MediaBox, TrimBox, BleedBox)
pdf-2-imagePDF rasterization and image encoding

It ships as a library crate (rustybara), a CLI/TUI binary (rbara), and a GPU-accelerated PDF page viewer (rbv).


Workspace

CrateDescriptionLicense
rustybaraCore PDF manipulation libraryLGPLv3
rustybara-iccICC color management — 22 bundled profilesLGPLv3
rustybara-wasmWebAssembly bindings — browser, Node.js, edgeLGPLv3
rbaraTerminal UI (Ratatui TUI)GPLv3
rbara-guiNative desktop GUI (Tauri v2)GPLv3
rbvPrepress PDF viewer (Skia + OpenGL + winit)GPLv3

Features

Featurerustybararustybara-iccrustybara-wasm
Page trim & resize
CMYK remap
Split / stitch pages
Extract page ranges
Flatten spot colors
Rasterization (pdfium)
XMP metadata embed & read
Page object tree + hit-testing
Plate separation filtering
Outline text (glyph → paths)
ICC color transforms
WebAssembly / browser
Node.js / edge runtime
  • Pipeline API — Chain operations fluently: open → trim → resize → remap → save.
  • Batch processing — Process entire directories of PDFs from CLI or TUI.
  • Interactive TUI — App-style terminal interface for designers who prefer guided workflows over raw CLI flags. Configurable output directory.
  • Prepress vocabulary — Every API surface speaks in boxes, bleeds, and DPI — not generic PDF primitives.

Installation

Pre-built installers for rbara (the CLI/TUI binary) are published with each release. Each installer bundles its own pdfium runtime — no system pdfium needed.

Windows

Download rbara-setup-<version>-x64.exe from the Releases page and run it. This is a per-user Inno Setup installer (no admin required) that installs to %LOCALAPPDATA%\Programs\rbara\, registers an opt-in PATH entry, and adds an Add/Remove Programs entry. SmartScreen may warn the first time — the binary is currently unsigned.

macOS

# Apple silicon
tar -xzf rbara-<version>-macos-arm64.tar.gz &&cd rbara-<version>-macos-arm64
./install.sh # installs to ~/.local# Intel
tar -xzf rbara-<version>-macos-x86_64.tar.gz &&cd rbara-<version>-macos-x86_64
./install.sh

The bundle is unsigned; install.sh strips the com.apple.quarantine attribute automatically. To uninstall: ./uninstall.sh.

Linux (glibc x86_64)

tar -xzf rbara-<version>-linux-x64.tar.gz &&cd rbara-<version>-linux-x64
./install.sh # ~/.local
sudo PREFIX=/usr/local ./install.sh # system-wide

Tested on Ubuntu 22.04+, Debian 12+, Fedora 38+, RHEL 9+, Arch, openSUSE Tumbleweed. Musl distros (Alpine) need a source build. To uninstall: ./uninstall.sh.

Docker

docker pull ghcr.io/addy-a/rbara:latest
# CLI usage — bind-mount your working directory
docker run --rm -v "$PWD:/work" ghcr.io/addy-a/rbara:latest \
trim /work/in.pdf -o /work/out.pdf

The image is ~175 MB (debian:bookworm-slim base) and runs as a non-root user.

Building from source

See the Contributing section. The maintainer-side installer scripts live in installer/ (one subdir per platform, each with its own README).


Quick Start

As a library

Add to your Cargo.toml:

[dependencies]
rustybara = "0.1"
use rustybara::PdfPipeline;fnmain() -> rustybara::Result<()>{// Trim marks, resize to 9pt bleed, savePdfPipeline::open("input.pdf")?
.trim()?
.resize(9.0)?
.split_pages(5.83*72.0)? // split spreads into 5.83" panels.save_pdf("output.pdf")?;Ok(())}

Rasterize a page

use rustybara::{PdfPipeline, encode::OutputFormat, raster::RenderConfig};fnmain() -> rustybara::Result<()>{let pipeline = PdfPipeline::open("input.pdf")?;let config = RenderConfig::prepress();// 300 DPI
pipeline.save_page_image(0,"page_1.jpg",&OutputFormat::Jpg,&config)?;Ok(())}

Embed XMP provenance metadata

use rustybara::{PdfPipeline, xmp};fnmain() -> rustybara::Result<()>{let source_hash = xmp::hash_file(std::path::Path::new("input.pdf"))?;let timestamp = "2026-05-28T12:00:00Z".to_string();PdfPipeline::open("input.pdf")?
.trim()?
.resize(9.0)?
.embed_metadata(&source_hash,&timestamp,&[("trim",""),("resize","bleed_pts=9")])?
.save_pdf("output.pdf")?;Ok(())}

Inspect the page object tree

use rustybara::{PdfPipeline, objects::tree::build_object_tree};fnmain() -> rustybara::Result<()>{let pipeline = PdfPipeline::open("input.pdf")?;let page_id = pipeline.doc().get_pages()[&1];let tree = build_object_tree(pipeline.doc(), page_id)?;for obj in&tree.objects{println!("{:?} bbox={:?}", obj.kind, obj.bbox);}Ok(())}

CLI

# Trim print marks
rbara trim input.pdf
# Resize to 1/8-inch bleed (--bleed remains available for point-based scripts)
rbara resize --bleed-inches 0.125 input.pdf
# Add a TrimBox, set page size, or rotate pages
rbara add-trim-box --bleed-inches 0.125 input.pdf
rbara set-media-box --width-inches 8.5 --height-inches 11 input.pdf
rbara rotate --degrees 90 input.pdf
# Export pages as 300 DPI PNGs at quality 90
rbara image --format png --dpi 300 --quality 90 input.pdf
# Extract, split, or stitch pages
rbara extract-pages --pages "1,3-5" input.pdf
rbara split-pages --panel-width 5.83 input.pdf
rbara split-pages --panel-widths 3.625,3.6875,3.6875 --axis horizontal input.pdf
rbara stitch-pages --spread-width 8.5 input.pdf
# Remap a CMYK color (rich black → 60/40/20/100)
rbara remap-color --from 1.0 1.0 1.0 1.0 --to 0.6 0.4 0.2 1.0 input.pdf
# Convert or flatten colors, and outline text
rbara convert-color-space --from-profile AdobeRGB1998 --to-profile USWebCoatedSWOP input.pdf
rbara flatten-spots input.pdf
rbara outline-text input.pdf
# Inspect page boxes, document color usage, and Rustybara provenance
rbara info input.pdf

Every PDF-writing command accepts multiple input files, --output <DIR>, and --overwrite. Without --overwrite, outputs receive an operation suffix such as _processed, _extracted, _split, or _stitch. Image export never overwrites a PDF source and also supports --annotations and --forms.

split-pages --panel-widths accepts an ordered, comma-separated plan containing at least two positive sizes in inches. The sizes must total the source page's TrimBox extent (within half a PDF point). --axis horizontal emits panels left to right; --axis vertical emits them bottom to top. The existing singular --panel-width behavior remains unchanged and defaults to the horizontal axis. PDF outputs include a Rustybara XMP provenance block.

TUI

Launch rbara with no arguments to enter the interactive terminal interface:

rbara

Arrow keys navigate, Enter selects, and Esc goes back. The menu scrolls on smaller terminals; press ? for the full keyboard reference.


rustybara-wasm

WebAssembly bindings for rustybara. Run PDF manipulation in any JavaScript or TypeScript environment — browser, Node.js, Deno, or Cloudflare Workers — with no native dependencies.

Exposes the pure-Rust pipeline subset:

  • trim() — strip content outside TrimBox
  • resize(bleed_pts) — expand page boxes by a bleed margin
  • split_pages_explicit(panel_widths_pts, axis) — split panels by exact widths
  • remap_color(from, to, tolerance) — substitute CMYK values in content streams
  • to_pdf_bytes() — serialize result as bytes for download or further processing

Rasterization (pdfium), object tree rendering, and ICC color transforms (lcms2) require the native crate and are not available in the wasm build. XMP provenance metadata is supported by the WASM package.

Browser quickstart

importinit,{PipelineHandle}from'./pkg/rustybara_wasm.js'awaitinit('./pkg/rustybara_wasm_bg.wasm')constbytes=newUint8Array(awaitfetch('input.pdf').then((r)=>r.arrayBuffer()),)lethandle=newPipelineHandle(bytes)handle=handle.trim()handle=handle.resize(8.504)constresult=handle.to_pdf_bytes()

Build

cd rustybara-wasm
wasm-pack build --target web --out-dir pkg --release

npm

The Node.js package is built as rustybara-wasm, with generated TypeScript declarations and no native runtime dependency. After the first registry release:

npm install rustybara-wasm
constfs=require('node:fs')const{ PanelAxis, PipelineHandle }=require('rustybara-wasm')constinput=fs.readFileSync('input.pdf')constpdf=newPipelineHandle(input).split_pages_explicit(Float64Array.from([261,265.5,265.5]),PanelAxis.Vertical,)fs.writeFileSync('output.pdf',pdf.to_pdf_bytes())

See rustybara-wasm/README.md for the complete Node API and local packaging instructions. The browser build remains available via the rustybara playground.


Architecture

Module Map

rustybara/src/
lib.rs — Public re-exports
pipeline.rs — PdfPipeline: high-level chaining API
error.rs — Unified error type
xmp.rs — XMP metadata embedding, reading, and SHA-256 provenance hashing
geometry/
rect.rs — Rect (position + dimensions, PDF coordinate system)
matrix.rs — Matrix (2D affine CTM transformations)
pages/
boxes.rs — PageBoxes: TrimBox, MediaBox, BleedBox, CropBox reader
split.rs — Page extraction and splitting utilities
stitch.rs — Spread stitching utilities
layout.rs — Page layout helpers
stream/
filter.rs — ContentFilter: CTM-walking content stream filter
color_ops.rs — ColorRemap: CMYK→CMYK value substitution in content streams
objects/
tree.rs — build_object_tree: full page object list (paths, images, text)
with color, CTM, overprint state, and subpath geometry
hittest.rs — Spatial hit-testing against the ObjectTree
separation.rs — filter_by_ink: plate isolation by CMYK channel or spot name
outline/ — (feature-gated: "outline")
font.rs — Extract raw font bytes from PDF resource dictionaries
encoding.rs — Resolve character codes to GlyphId
paths.rs — outline_page_text: walk content stream → per-glyph path geometry
writer.rs — glyphs_to_content_stream: serialize glyphs back to PDF operators
raster/
render.rs — PageRenderer trait, CpuRenderer (pdfium-render)
config.rs — RenderConfig (DPI, annotation toggles)
encode/
save.rs — OutputFormat enum, image encoding (JPG/PNG/WebP/TIFF)
color/ — (feature-gated: "color")
icc.rs — Re-exports from rustybara-icc crate
transform.rs — Re-exports from rustybara-icc crate
rustybara-icc/src/ (separate crate, optionally used via "color" feature)
lib.rs — ICC color management engine
color_space.rs — ColorSpaceKind enum (CMYK, RGB, Gray, Lab)
error.rs — IccError type for color operations
intent.rs — RenderingIntent enum for ICC transforms
pixel_format.rs — PixelFormat enum (RGB8, CMYK8, etc.)
transform.rs — ColorTransform: pixel-level ICC profile transforms
pdf.rs — PdfColorConverter: document-level color space conversion
profiles/ — Bundled ICC profiles (FOGRA39, GRACoL2006, etc.)

Public API

rustybara is a high-level, prepress-scoped crate. The public API speaks in prepress vocabulary:

// Prepress operationsPdfPipeline::open(path)?
.trim()? // Remove content outside TrimBox.resize(bleed_pts)? // Expand page boxes by bleed margin.remap_color(from, to, tolerance)? // Substitute CMYK values.add_trim_box(bleed_pts)? // Inset MediaBox to set a TrimBox.embed_metadata(hash, ts, ops)? // Embed rbara: XMP provenance block.save_pdf(path)?;// Write the result// Rasterization
pipeline.render_page(0,&config)?;// → DynamicImage
pipeline.save_page_image(0, path,&format,&config)?;// → file// Page operationslet new_pipeline = pipeline.extract_pages(&[0,2,4])?;// → new pipelinelet spreads = pipeline.split_pages(panel_width_pts)?;// → new pipelinelet panels = pipeline.split_pages_explicit(&[261.0,265.5,265.5],
rustybara::pages::SplitAxis::Horizontal,)?;// → new pipelinelet stitched = pipeline.stitch_pages(spread_width_pts)?;// → new pipeline// Page inspectionlet boxes = PageBoxes::read(&doc, page_id)?;
boxes.trim_or_media()// TrimBox if present, else MediaBox
boxes.bleed_rect(9.0)// Expand trim by bleed amount// XMP provenance
let hash = xmp::hash_file(path)?;// sha256:<hex>let block = pipeline.read_xmp_block();// Option<RbaraXmpBlock>// Object tree (paths, images, text — full geometry + color)let tree = objects::tree::build_object_tree(doc, page_id)?;let plate_objs = objects::separation::filter_by_ink(&tree,&InkSelector::CmykChannel(CmykChannel::Cyan),);// Text outline extraction (requires "outline" feature)#[cfg(feature = "outline")]{use rustybara::outline::{outline_page_text, writer::glyphs_to_content_stream};let glyphs = outline_page_text(doc, page_id)?;let pdf_ops = glyphs_to_content_stream(&glyphs);// → PDF path operators}// Color space conversion (requires "color" feature)#[cfg(feature = "color")]{use rustybara::color::{ColorTransform,RenderingIntent, profiles};let transform = ColorTransform::new(&profiles::COATED_FOGRA_39,&profiles::COATED_GRACOL_2006,RenderingIntent::RelativeColorimetric,)?;
pipeline.convert_color_space(&transform)?;// Convert entire document}

Feature Flags

FlagWhat it enablesDefault
rasterpdfium-render, image, webp — page rasterization
outlinettf-parser — text outline / glyph-path extraction
colorrustybara-icc / lcms2 — ICC color management
wasmWebAssembly build gate
gpuReserved for future GPU renderer

Renderer Trait

Rendering is behind a trait for future GPU backend support:

pubtraitPageRenderer{fnrender(&self,page:&PdfPage,config:&RenderConfig)
-> Result<DynamicImage>;}pubstructCpuRenderer;// pdfium-render — ships today// pub struct GpuRenderer; // vello/wgpu — future work

Dependencies

CrateRole
lopdf 0.40PDF object graph manipulation
pdfium-render 0.9PDF rasterization via PDFium
image 0.25Bitmap encoding (JPEG, PNG, WebP, TIFF)
rayon 1.11Parallel page rendering
ttf-parser 0.25TrueType glyph outline extraction (outline feature)
uuid 1UUID v4 generation for XMP provenance
sha2 0.11SHA-256 source file hashing for XMP provenance
rustybara-icc 0.1ICC color management (optional, color feature)
lcms2 6.1Little CMS color engine (via rustybara-icc, color feature)

Runtime Requirement — PDFium

The render_page and save_page_image functions require the PDFium shared library at runtime. Place the appropriate binary alongside your executable:

PlatformFile
Windowspdfium.dll
macOSlibpdfium.dylib
Linuxlibpdfium.so

Pre-built binaries: pdfium-binaries

Note: End-users of the rbara binary do not need to do this manually — the pre-built installers bundle the matching pdfium for each platform. This requirement applies only when consuming rustybara as a library in your own Rust project.

Operations that do not rasterize (trim, resize, save_pdf, page_count, PageBoxes::read, build_object_tree, embed_metadata) work without PDFium.


rbara — CLI & TUI Binary

rbara is the interactive front-end for rustybara. It provides both a flag-based CLI for scripting and a TUI for guided workflows.

Keyboard Reference (TUI)

KeyAction
tTrim print marks
rResize to bleed
bAdd TrimBox
sSet MediaBox
gRotate pages
xExport to image
eExtract pages
pSplit pages
hStitch pages
mRemap colors
cConvert color space
kFlatten spot colors
lOutline text
/Output path
oToggle overwrite mode
fChange files
qQuit
EnterRun selected action
?Keyboard reference overlay

UX Model

The TUI follows an app-style keyboard model — arrow keys, Enter, Esc — designed for designers who have never used a terminal before. Vim-style bindings may be layered on as aliases in a future version.

File-first workflow: launch → select file or directory → commands become available. Directories auto-glob *.pdf files.


rbv — PDF Page Viewer

rbv is a prepress-focused PDF viewer built on Skia (OpenGL) + winit. It is designed for quick go/no-go QC decisions — bleed check, color space, spot ink declaration — not sub-pixel vector fidelity. Pages are rasterized by pdfium and displayed as a bitmap; the object tree layer adds wireframe, hit-testing, and color diagnostics on top.

rbv <file> [page] [--dpi <dpi>]

The initial preview renders at 72 DPI for fast startup, then a full-resolution render (at the specified DPI, default 300) replaces it in the background.

Keyboard Shortcuts

KeyAction
WToggle wireframe mode
OToggle prepress box overlays (bleed/trim/crop)
Ctrl + = / Ctrl + +Zoom in
Ctrl + -Zoom out
Ctrl + 0Reset zoom and pan
Ctrl + ScrollZoom toward cursor
Left dragPan
Left clickSelect object + sample color
H / / K / Previous page
L / / J / Next page
NgJump to page N (e.g. 5g)
Ctrl+Shift+DToggle debug overlay
Ctrl+Shift+EExport wireframe diagnostic PDF
EscExit

Wireframe Mode

W replaces the raster image with a vector outline view derived from the page's ObjectTree. Every path, image, and text block is drawn as a thin black stroke in page-space coordinates. The selected object receives a 2px blue highlight. Glyph outlines (extracted via outline_page_text) are drawn on top when available. Ctrl+Shift+E exports the wireframe geometry to a diagnostic PDF for cross-referencing with qpdf --qdf.

Color Diagnostics

Left-click any area to sample:

  • Pixel RGBA — what the monitor is displaying (sampled from the rasterized bitmap)
  • PDF color — the declared fill/stroke color of the hit object from the content stream (DeviceGray / DeviceRGB / DeviceCMYK / Separation)
  • ICC CMYK — the pixel RGB converted to CMYK via Little CMS 2 (destination: US Web Coated SWOP)

A crosshair marker is stored in PDF coordinates and projected to screen each frame, so it stays locked to the correct page position as you zoom and pan.

File Watching

rbv monitors the opened file via notify. When the file changes on disk (e.g. after an InDesign export), it automatically re-opens the document, rebuilds the object tree, and re-renders — supporting a save-and-preview loop without restarting.

IPC

rbara-gui can send commands to a running rbv instance (e.g. switch to a different file after processing). rbv accepts these via a local IPC channel when launched with --listen.


Known Limitations

LimitationNotes
sRGB rasterization onlyCMYK→sRGB via PDFium. ICC color transforms available via color feature for stream-level operations.
JPEG quality not configurableFixed encoder quality. --quality flag planned.
Spot color approximationPDFium renders spot inks as CMYK approximations.
No Form XObject ColorSpace pruningInherited limitation from content stream filtering.
rbv requires display serverNo headless preview. Graceful error on missing GPU.
rbv zoom qualityRaster-only rendering degrades past ~150–200% zoom. LOD tiling planned.
CFF / Type1 glyph outlinesttf-parser requires sfnt container; raw CFF fonts use a OTTO header shim with ongoing refinement.
Very large PDFs (~200 MB+)Hard-blocked on add in rbara-gui. See below.

Large file handling

rustybara opens PDFs eagerly: lopdf parses the entire object graph into memory on load, and the PDFium render path round-trips through a full document serialization. For very large files (roughly 200 MB and up, e.g. imposed print runs of hundreds of pages) this parse can take tens of seconds and consume multiple gigabytes of RAM — long enough to make the desktop app appear frozen.

We explored splitting large files into page-range chunks (processing each independently) and re-merging the results into a single output. It worked mechanically but didn't hold up as a real solution: chunking still pays the full parse cost, the merge re-materializes the whole document in memory, and neither approaches the performance of mature tools like Acrobat or PitStop, which use lazy/random-access parsing. That experiment has been removed.

For now, rbara-guihard-blocks files above a configurable size limit (default 200 MB, set in Settings → Behavior; 0 disables the limit at your own risk) and surfaces a clear warning rather than freezing. The underlying library operations remain available for callers who can afford the memory/time.

A proper fix — lazy/streaming parse and metadata extraction that never loads the whole document — is planned for a future release (see Roadmap).


Roadmap

  • ICC color management (color module via lcms2) — v0.1.2
  • CMYK→CMYK color remapping in content streams — v0.1.2
  • Cross-platform installers (Windows / macOS / Linux / Docker) with bundled pdfium — v0.1.3
  • GitHub Actions release pipeline (one tag → all installers + GHCR image) — v0.1.3
  • rbv GPU-accelerated page viewer (wgpu + winit) — v0.1.4
  • rbara-gui native desktop GUI (Tauri v2) — v0.1.4
  • Split Pages — divide spreads into individual panels at a configurable width — v0.1.5
  • Stitch Pages — combine panels back into spreads at a configurable spread width — v0.1.5
  • Extract Pages — extract arbitrary page ranges into a new PDF — v0.1.5
  • Flatten Spot Colors — flatten spot color inks to CMYK process — v0.1.5
  • Command bar (: mode) with chord shortcuts and live preview — v0.1.5
  • Page object tree with spatial hit-testing — v0.1.6
  • Wireframe mode in rbv (Skia/OpenGL renderer) — v0.1.6
  • Color diagnostics panel with ICC pixel sampling — v0.1.6
  • Outline Text — vectorize embedded TrueType glyphs to PDF path operators — v0.1.6
  • Plate separation filtering (filter_by_ink, InkSelector) — v0.1.6
  • Wireframe diagnostic PDF export — v0.1.6
  • File watching / live reload in rbv — v0.1.6
  • XMP provenance metadata embedding and reading (rbara: namespace) — v0.1.7
  • Tile rendering system in rbv for large pages — v0.1.7
  • Resizable panels and activity log in rbara-gui — v0.1.7
  • Rotate PDF (/Rotate page action) — v0.1.9
  • Set Media Box action — v0.1.9
  • Configurable JPEG/WebP export quality — v0.1.9
  • System / network print for fast proofs — v0.1.9
  • Fix: macOS rbv dock-icon / defunct process on exit (clean event_loop.exit() + child reaping) — v0.1.9
  • Fix: Windows rbv console window on launch (windows_subsystem) — v0.1.9
  • RGB→CMYK conversion (vector graphics + embedded images)
  • Spot color detection service
  • LOD-aware zoom tiling in rbv
  • PDF/X validation and preflight reports
  • Configurable JPEG quality (--quality flag)
  • Lazy / streaming PDF parsing for large files (remove the hard size block)

Contributing

cargo test --workspace
  • MSRV is Rust 1.85 (edition 2024). Do not raise this floor without discussion.
  • Targets:x86_64, aarch64, wasm32-unknown-unknown (via rustybara-wasm)
  • The TrimBox is always the source-of-truth reference box. It is never modified by any operation.
  • Public API additions require documentation and at least one integration test.
  • The app-style keyboard model is the UX baseline for rbara. Modal bindings are opt-in aliases only.

Cutting a release

Releases are fully automated by .github/workflows/release.yml. To cut a new version:

  1. Bump version in rbara/Cargo.toml (and rustybara/Cargo.toml if the lib changed).
  2. Commit and push.
  3. Tag and push the tag:
    git tag v0.1.7
    git push --tags
  4. The workflow will build the Windows installer, the Linux tarball, both macOS tarballs (Apple silicon + Intel), and the Docker image, then create a GitHub Release with all artifacts and a SHA256SUMS.txt attached.

Hyphenated compatibility-iteration tags such as v0.2.0-1 create a prerelease containing only the rbara CLI/TUI installers and Docker image. The GUI and ICC packages are left at their existing versions. Tags without a hyphen continue to produce the full release suite.

The pdfium chromium build is pinned via PDFIUM_CHROMIUM env var in the workflow (currently 7776). Bump it there to refresh pdfium across all artifacts in lockstep.


Playground

Try rustybara-wasm live in the browser at rustybara.com/playground. Upload a PDF or use a sample file — trim, resize, and remap CMYK values entirely client-side via WebAssembly. No account, no upload, no server.


License

The LGPL license on the library allows downstream tools to link against rustybara without copyleft obligations on their own code, while the binaries remain fully copyleft.

Copyright (c) 2026 Addy Alvarado

capybara chillin

About

Rust library, interactive CLI, and desktop GUI for prepress PDF work — trim printer marks, manage bleed, rasterize pages, and more. A free, open-source alternative to proprietary prepress tools.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Repository files navigation

Rustybara logo

Rustybara

Prepress-focused PDF manipulation toolkit for graphic designers and print operators.

Crates.ioDownloadsDocumentationLicense


Rustybara dashboard

Rustybara is the convergence of three standalone prepress CLI tools into a unified Rust library and interactive toolset, built on the same primitives those tools proved in production:

Origin ToolPrimitive
pdf-mark-removalContent stream filtering, CTM math
resize_to_bleed_or_trim_pdfPage box geometry (MediaBox, TrimBox, BleedBox)
pdf-2-imagePDF rasterization and image encoding

It ships as a library crate (rustybara), a CLI/TUI binary (rbara), and a GPU-accelerated PDF page viewer (rbv).


Workspace

CrateDescriptionLicense
rustybaraCore PDF manipulation libraryLGPLv3
rustybara-iccICC color management — 22 bundled profilesLGPLv3
rustybara-wasmWebAssembly bindings — browser, Node.js, edgeLGPLv3
rbaraTerminal UI (Ratatui TUI)GPLv3
rbara-guiNative desktop GUI (Tauri v2)GPLv3
rbvPrepress PDF viewer (Skia + OpenGL + winit)GPLv3

Features

Featurerustybararustybara-iccrustybara-wasm
Page trim & resize
CMYK remap
Split / stitch pages
Extract page ranges
Flatten spot colors
Rasterization (pdfium)
XMP metadata embed & read
Page object tree + hit-testing
Plate separation filtering
Outline text (glyph → paths)
ICC color transforms
WebAssembly / browser
Node.js / edge runtime
  • Pipeline API — Chain operations fluently: open → trim → resize → remap → save.
  • Batch processing — Process entire directories of PDFs from CLI or TUI.
  • Interactive TUI — App-style terminal interface for designers who prefer guided workflows over raw CLI flags. Configurable output directory.
  • Prepress vocabulary — Every API surface speaks in boxes, bleeds, and DPI — not generic PDF primitives.

Installation

Pre-built installers for rbara (the CLI/TUI binary) are published with each release. Each installer bundles its own pdfium runtime — no system pdfium needed.

Windows

Download rbara-setup-<version>-x64.exe from the Releases page and run it. This is a per-user Inno Setup installer (no admin required) that installs to %LOCALAPPDATA%\Programs\rbara\, registers an opt-in PATH entry, and adds an Add/Remove Programs entry. SmartScreen may warn the first time — the binary is currently unsigned.

macOS

# Apple silicon
tar -xzf rbara-<version>-macos-arm64.tar.gz &&cd rbara-<version>-macos-arm64
./install.sh # installs to ~/.local# Intel
tar -xzf rbara-<version>-macos-x86_64.tar.gz &&cd rbara-<version>-macos-x86_64
./install.sh

The bundle is unsigned; install.sh strips the com.apple.quarantine attribute automatically. To uninstall: ./uninstall.sh.

Linux (glibc x86_64)

tar -xzf rbara-<version>-linux-x64.tar.gz &&cd rbara-<version>-linux-x64
./install.sh # ~/.local
sudo PREFIX=/usr/local ./install.sh # system-wide

Tested on Ubuntu 22.04+, Debian 12+, Fedora 38+, RHEL 9+, Arch, openSUSE Tumbleweed. Musl distros (Alpine) need a source build. To uninstall: ./uninstall.sh.

Docker

docker pull ghcr.io/addy-a/rbara:latest
# CLI usage — bind-mount your working directory
docker run --rm -v "$PWD:/work" ghcr.io/addy-a/rbara:latest \
trim /work/in.pdf -o /work/out.pdf

The image is ~175 MB (debian:bookworm-slim base) and runs as a non-root user.

Building from source

See the Contributing section. The maintainer-side installer scripts live in installer/ (one subdir per platform, each with its own README).


Quick Start

As a library

Add to your Cargo.toml:

[dependencies]
rustybara = "0.1"
use rustybara::PdfPipeline;fnmain() -> rustybara::Result<()>{// Trim marks, resize to 9pt bleed, savePdfPipeline::open("input.pdf")?
.trim()?
.resize(9.0)?
.split_pages(5.83*72.0)? // split spreads into 5.83" panels.save_pdf("output.pdf")?;Ok(())}

Rasterize a page

use rustybara::{PdfPipeline, encode::OutputFormat, raster::RenderConfig};fnmain() -> rustybara::Result<()>{let pipeline = PdfPipeline::open("input.pdf")?;let config = RenderConfig::prepress();// 300 DPI
pipeline.save_page_image(0,"page_1.jpg",&OutputFormat::Jpg,&config)?;Ok(())}

Embed XMP provenance metadata

use rustybara::{PdfPipeline, xmp};fnmain() -> rustybara::Result<()>{let source_hash = xmp::hash_file(std::path::Path::new("input.pdf"))?;let timestamp = "2026-05-28T12:00:00Z".to_string();PdfPipeline::open("input.pdf")?
.trim()?
.resize(9.0)?
.embed_metadata(&source_hash,&timestamp,&[("trim",""),("resize","bleed_pts=9")])?
.save_pdf("output.pdf")?;Ok(())}

Inspect the page object tree

use rustybara::{PdfPipeline, objects::tree::build_object_tree};fnmain() -> rustybara::Result<()>{let pipeline = PdfPipeline::open("input.pdf")?;let page_id = pipeline.doc().get_pages()[&1];let tree = build_object_tree(pipeline.doc(), page_id)?;for obj in&tree.objects{println!("{:?} bbox={:?}", obj.kind, obj.bbox);}Ok(())}

CLI

# Trim print marks
rbara trim input.pdf
# Resize to 1/8-inch bleed (--bleed remains available for point-based scripts)
rbara resize --bleed-inches 0.125 input.pdf
# Add a TrimBox, set page size, or rotate pages
rbara add-trim-box --bleed-inches 0.125 input.pdf
rbara set-media-box --width-inches 8.5 --height-inches 11 input.pdf
rbara rotate --degrees 90 input.pdf
# Export pages as 300 DPI PNGs at quality 90
rbara image --format png --dpi 300 --quality 90 input.pdf
# Extract, split, or stitch pages
rbara extract-pages --pages "1,3-5" input.pdf
rbara split-pages --panel-width 5.83 input.pdf
rbara split-pages --panel-widths 3.625,3.6875,3.6875 --axis horizontal input.pdf
rbara stitch-pages --spread-width 8.5 input.pdf
# Remap a CMYK color (rich black → 60/40/20/100)
rbara remap-color --from 1.0 1.0 1.0 1.0 --to 0.6 0.4 0.2 1.0 input.pdf
# Convert or flatten colors, and outline text
rbara convert-color-space --from-profile AdobeRGB1998 --to-profile USWebCoatedSWOP input.pdf
rbara flatten-spots input.pdf
rbara outline-text input.pdf
# Inspect page boxes, document color usage, and Rustybara provenance
rbara info input.pdf

Every PDF-writing command accepts multiple input files, --output <DIR>, and --overwrite. Without --overwrite, outputs receive an operation suffix such as _processed, _extracted, _split, or _stitch. Image export never overwrites a PDF source and also supports --annotations and --forms.

split-pages --panel-widths accepts an ordered, comma-separated plan containing at least two positive sizes in inches. The sizes must total the source page's TrimBox extent (within half a PDF point). --axis horizontal emits panels left to right; --axis vertical emits them bottom to top. The existing singular --panel-width behavior remains unchanged and defaults to the horizontal axis. PDF outputs include a Rustybara XMP provenance block.

TUI

Launch rbara with no arguments to enter the interactive terminal interface:

rbara

Arrow keys navigate, Enter selects, and Esc goes back. The menu scrolls on smaller terminals; press ? for the full keyboard reference.


rustybara-wasm

WebAssembly bindings for rustybara. Run PDF manipulation in any JavaScript or TypeScript environment — browser, Node.js, Deno, or Cloudflare Workers — with no native dependencies.

Exposes the pure-Rust pipeline subset:

  • trim() — strip content outside TrimBox
  • resize(bleed_pts) — expand page boxes by a bleed margin
  • split_pages_explicit(panel_widths_pts, axis) — split panels by exact widths
  • remap_color(from, to, tolerance) — substitute CMYK values in content streams
  • to_pdf_bytes() — serialize result as bytes for download or further processing

Rasterization (pdfium), object tree rendering, and ICC color transforms (lcms2) require the native crate and are not available in the wasm build. XMP provenance metadata is supported by the WASM package.

Browser quickstart

importinit,{PipelineHandle}from'./pkg/rustybara_wasm.js'awaitinit('./pkg/rustybara_wasm_bg.wasm')constbytes=newUint8Array(awaitfetch('input.pdf').then((r)=>r.arrayBuffer()),)lethandle=newPipelineHandle(bytes)handle=handle.trim()handle=handle.resize(8.504)constresult=handle.to_pdf_bytes()

Build

cd rustybara-wasm
wasm-pack build --target web --out-dir pkg --release

npm

The Node.js package is built as rustybara-wasm, with generated TypeScript declarations and no native runtime dependency. After the first registry release:

npm install rustybara-wasm
constfs=require('node:fs')const{ PanelAxis, PipelineHandle }=require('rustybara-wasm')constinput=fs.readFileSync('input.pdf')constpdf=newPipelineHandle(input).split_pages_explicit(Float64Array.from([261,265.5,265.5]),PanelAxis.Vertical,)fs.writeFileSync('output.pdf',pdf.to_pdf_bytes())

See rustybara-wasm/README.md for the complete Node API and local packaging instructions. The browser build remains available via the rustybara playground.


Architecture

Module Map

rustybara/src/
lib.rs — Public re-exports
pipeline.rs — PdfPipeline: high-level chaining API
error.rs — Unified error type
xmp.rs — XMP metadata embedding, reading, and SHA-256 provenance hashing
geometry/
rect.rs — Rect (position + dimensions, PDF coordinate system)
matrix.rs — Matrix (2D affine CTM transformations)
pages/
boxes.rs — PageBoxes: TrimBox, MediaBox, BleedBox, CropBox reader
split.rs — Page extraction and splitting utilities
stitch.rs — Spread stitching utilities
layout.rs — Page layout helpers
stream/
filter.rs — ContentFilter: CTM-walking content stream filter
color_ops.rs — ColorRemap: CMYK→CMYK value substitution in content streams
objects/
tree.rs — build_object_tree: full page object list (paths, images, text)
with color, CTM, overprint state, and subpath geometry
hittest.rs — Spatial hit-testing against the ObjectTree
separation.rs — filter_by_ink: plate isolation by CMYK channel or spot name
outline/ — (feature-gated: "outline")
font.rs — Extract raw font bytes from PDF resource dictionaries
encoding.rs — Resolve character codes to GlyphId
paths.rs — outline_page_text: walk content stream → per-glyph path geometry
writer.rs — glyphs_to_content_stream: serialize glyphs back to PDF operators
raster/
render.rs — PageRenderer trait, CpuRenderer (pdfium-render)
config.rs — RenderConfig (DPI, annotation toggles)
encode/
save.rs — OutputFormat enum, image encoding (JPG/PNG/WebP/TIFF)
color/ — (feature-gated: "color")
icc.rs — Re-exports from rustybara-icc crate
transform.rs — Re-exports from rustybara-icc crate
rustybara-icc/src/ (separate crate, optionally used via "color" feature)
lib.rs — ICC color management engine
color_space.rs — ColorSpaceKind enum (CMYK, RGB, Gray, Lab)
error.rs — IccError type for color operations
intent.rs — RenderingIntent enum for ICC transforms
pixel_format.rs — PixelFormat enum (RGB8, CMYK8, etc.)
transform.rs — ColorTransform: pixel-level ICC profile transforms
pdf.rs — PdfColorConverter: document-level color space conversion
profiles/ — Bundled ICC profiles (FOGRA39, GRACoL2006, etc.)

Public API

rustybara is a high-level, prepress-scoped crate. The public API speaks in prepress vocabulary:

// Prepress operationsPdfPipeline::open(path)?
.trim()? // Remove content outside TrimBox.resize(bleed_pts)? // Expand page boxes by bleed margin.remap_color(from, to, tolerance)? // Substitute CMYK values.add_trim_box(bleed_pts)? // Inset MediaBox to set a TrimBox.embed_metadata(hash, ts, ops)? // Embed rbara: XMP provenance block.save_pdf(path)?;// Write the result// Rasterization
pipeline.render_page(0,&config)?;// → DynamicImage
pipeline.save_page_image(0, path,&format,&config)?;// → file// Page operationslet new_pipeline = pipeline.extract_pages(&[0,2,4])?;// → new pipelinelet spreads = pipeline.split_pages(panel_width_pts)?;// → new pipelinelet panels = pipeline.split_pages_explicit(&[261.0,265.5,265.5],
rustybara::pages::SplitAxis::Horizontal,)?;// → new pipelinelet stitched = pipeline.stitch_pages(spread_width_pts)?;// → new pipeline// Page inspectionlet boxes = PageBoxes::read(&doc, page_id)?;
boxes.trim_or_media()// TrimBox if present, else MediaBox
boxes.bleed_rect(9.0)// Expand trim by bleed amount// XMP provenance
let hash = xmp::hash_file(path)?;// sha256:<hex>let block = pipeline.read_xmp_block();// Option<RbaraXmpBlock>// Object tree (paths, images, text — full geometry + color)let tree = objects::tree::build_object_tree(doc, page_id)?;let plate_objs = objects::separation::filter_by_ink(&tree,&InkSelector::CmykChannel(CmykChannel::Cyan),);// Text outline extraction (requires "outline" feature)#[cfg(feature = "outline")]{use rustybara::outline::{outline_page_text, writer::glyphs_to_content_stream};let glyphs = outline_page_text(doc, page_id)?;let pdf_ops = glyphs_to_content_stream(&glyphs);// → PDF path operators}// Color space conversion (requires "color" feature)#[cfg(feature = "color")]{use rustybara::color::{ColorTransform,RenderingIntent, profiles};let transform = ColorTransform::new(&profiles::COATED_FOGRA_39,&profiles::COATED_GRACOL_2006,RenderingIntent::RelativeColorimetric,)?;
pipeline.convert_color_space(&transform)?;// Convert entire document}

Feature Flags

FlagWhat it enablesDefault
rasterpdfium-render, image, webp — page rasterization
outlinettf-parser — text outline / glyph-path extraction
colorrustybara-icc / lcms2 — ICC color management
wasmWebAssembly build gate
gpuReserved for future GPU renderer

Renderer Trait

Rendering is behind a trait for future GPU backend support:

pubtraitPageRenderer{fnrender(&self,page:&PdfPage,config:&RenderConfig)
-> Result<DynamicImage>;}pubstructCpuRenderer;// pdfium-render — ships today// pub struct GpuRenderer; // vello/wgpu — future work

Dependencies

CrateRole
lopdf 0.40PDF object graph manipulation
pdfium-render 0.9PDF rasterization via PDFium
image 0.25Bitmap encoding (JPEG, PNG, WebP, TIFF)
rayon 1.11Parallel page rendering
ttf-parser 0.25TrueType glyph outline extraction (outline feature)
uuid 1UUID v4 generation for XMP provenance
sha2 0.11SHA-256 source file hashing for XMP provenance
rustybara-icc 0.1ICC color management (optional, color feature)
lcms2 6.1Little CMS color engine (via rustybara-icc, color feature)

Runtime Requirement — PDFium

The render_page and save_page_image functions require the PDFium shared library at runtime. Place the appropriate binary alongside your executable:

PlatformFile
Windowspdfium.dll
macOSlibpdfium.dylib
Linuxlibpdfium.so

Pre-built binaries: pdfium-binaries

Note: End-users of the rbara binary do not need to do this manually — the pre-built installers bundle the matching pdfium for each platform. This requirement applies only when consuming rustybara as a library in your own Rust project.

Operations that do not rasterize (trim, resize, save_pdf, page_count, PageBoxes::read, build_object_tree, embed_metadata) work without PDFium.


rbara — CLI & TUI Binary

rbara is the interactive front-end for rustybara. It provides both a flag-based CLI for scripting and a TUI for guided workflows.

Keyboard Reference (TUI)

KeyAction
tTrim print marks
rResize to bleed
bAdd TrimBox
sSet MediaBox
gRotate pages
xExport to image
eExtract pages
pSplit pages
hStitch pages
mRemap colors
cConvert color space
kFlatten spot colors
lOutline text
/Output path
oToggle overwrite mode
fChange files
qQuit
EnterRun selected action
?Keyboard reference overlay

UX Model

The TUI follows an app-style keyboard model — arrow keys, Enter, Esc — designed for designers who have never used a terminal before. Vim-style bindings may be layered on as aliases in a future version.

File-first workflow: launch → select file or directory → commands become available. Directories auto-glob *.pdf files.


rbv — PDF Page Viewer

rbv is a prepress-focused PDF viewer built on Skia (OpenGL) + winit. It is designed for quick go/no-go QC decisions — bleed check, color space, spot ink declaration — not sub-pixel vector fidelity. Pages are rasterized by pdfium and displayed as a bitmap; the object tree layer adds wireframe, hit-testing, and color diagnostics on top.

rbv <file> [page] [--dpi <dpi>]

The initial preview renders at 72 DPI for fast startup, then a full-resolution render (at the specified DPI, default 300) replaces it in the background.

Keyboard Shortcuts

KeyAction
WToggle wireframe mode
OToggle prepress box overlays (bleed/trim/crop)
Ctrl + = / Ctrl + +Zoom in
Ctrl + -Zoom out
Ctrl + 0Reset zoom and pan
Ctrl + ScrollZoom toward cursor
Left dragPan
Left clickSelect object + sample color
H / / K / Previous page
L / / J / Next page
NgJump to page N (e.g. 5g)
Ctrl+Shift+DToggle debug overlay
Ctrl+Shift+EExport wireframe diagnostic PDF
EscExit

Wireframe Mode

W replaces the raster image with a vector outline view derived from the page's ObjectTree. Every path, image, and text block is drawn as a thin black stroke in page-space coordinates. The selected object receives a 2px blue highlight. Glyph outlines (extracted via outline_page_text) are drawn on top when available. Ctrl+Shift+E exports the wireframe geometry to a diagnostic PDF for cross-referencing with qpdf --qdf.

Color Diagnostics

Left-click any area to sample:

  • Pixel RGBA — what the monitor is displaying (sampled from the rasterized bitmap)
  • PDF color — the declared fill/stroke color of the hit object from the content stream (DeviceGray / DeviceRGB / DeviceCMYK / Separation)
  • ICC CMYK — the pixel RGB converted to CMYK via Little CMS 2 (destination: US Web Coated SWOP)

A crosshair marker is stored in PDF coordinates and projected to screen each frame, so it stays locked to the correct page position as you zoom and pan.

File Watching

rbv monitors the opened file via notify. When the file changes on disk (e.g. after an InDesign export), it automatically re-opens the document, rebuilds the object tree, and re-renders — supporting a save-and-preview loop without restarting.

IPC

rbara-gui can send commands to a running rbv instance (e.g. switch to a different file after processing). rbv accepts these via a local IPC channel when launched with --listen.


Known Limitations

LimitationNotes
sRGB rasterization onlyCMYK→sRGB via PDFium. ICC color transforms available via color feature for stream-level operations.
JPEG quality not configurableFixed encoder quality. --quality flag planned.
Spot color approximationPDFium renders spot inks as CMYK approximations.
No Form XObject ColorSpace pruningInherited limitation from content stream filtering.
rbv requires display serverNo headless preview. Graceful error on missing GPU.
rbv zoom qualityRaster-only rendering degrades past ~150–200% zoom. LOD tiling planned.
CFF / Type1 glyph outlinesttf-parser requires sfnt container; raw CFF fonts use a OTTO header shim with ongoing refinement.
Very large PDFs (~200 MB+)Hard-blocked on add in rbara-gui. See below.

Large file handling

rustybara opens PDFs eagerly: lopdf parses the entire object graph into memory on load, and the PDFium render path round-trips through a full document serialization. For very large files (roughly 200 MB and up, e.g. imposed print runs of hundreds of pages) this parse can take tens of seconds and consume multiple gigabytes of RAM — long enough to make the desktop app appear frozen.

We explored splitting large files into page-range chunks (processing each independently) and re-merging the results into a single output. It worked mechanically but didn't hold up as a real solution: chunking still pays the full parse cost, the merge re-materializes the whole document in memory, and neither approaches the performance of mature tools like Acrobat or PitStop, which use lazy/random-access parsing. That experiment has been removed.

For now, rbara-guihard-blocks files above a configurable size limit (default 200 MB, set in Settings → Behavior; 0 disables the limit at your own risk) and surfaces a clear warning rather than freezing. The underlying library operations remain available for callers who can afford the memory/time.

A proper fix — lazy/streaming parse and metadata extraction that never loads the whole document — is planned for a future release (see Roadmap).


Roadmap

  • ICC color management (color module via lcms2) — v0.1.2
  • CMYK→CMYK color remapping in content streams — v0.1.2
  • Cross-platform installers (Windows / macOS / Linux / Docker) with bundled pdfium — v0.1.3
  • GitHub Actions release pipeline (one tag → all installers + GHCR image) — v0.1.3
  • rbv GPU-accelerated page viewer (wgpu + winit) — v0.1.4
  • rbara-gui native desktop GUI (Tauri v2) — v0.1.4
  • Split Pages — divide spreads into individual panels at a configurable width — v0.1.5
  • Stitch Pages — combine panels back into spreads at a configurable spread width — v0.1.5
  • Extract Pages — extract arbitrary page ranges into a new PDF — v0.1.5
  • Flatten Spot Colors — flatten spot color inks to CMYK process — v0.1.5
  • Command bar (: mode) with chord shortcuts and live preview — v0.1.5
  • Page object tree with spatial hit-testing — v0.1.6
  • Wireframe mode in rbv (Skia/OpenGL renderer) — v0.1.6
  • Color diagnostics panel with ICC pixel sampling — v0.1.6
  • Outline Text — vectorize embedded TrueType glyphs to PDF path operators — v0.1.6
  • Plate separation filtering (filter_by_ink, InkSelector) — v0.1.6
  • Wireframe diagnostic PDF export — v0.1.6
  • File watching / live reload in rbv — v0.1.6
  • XMP provenance metadata embedding and reading (rbara: namespace) — v0.1.7
  • Tile rendering system in rbv for large pages — v0.1.7
  • Resizable panels and activity log in rbara-gui — v0.1.7
  • Rotate PDF (/Rotate page action) — v0.1.9
  • Set Media Box action — v0.1.9
  • Configurable JPEG/WebP export quality — v0.1.9
  • System / network print for fast proofs — v0.1.9
  • Fix: macOS rbv dock-icon / defunct process on exit (clean event_loop.exit() + child reaping) — v0.1.9
  • Fix: Windows rbv console window on launch (windows_subsystem) — v0.1.9
  • RGB→CMYK conversion (vector graphics + embedded images)
  • Spot color detection service
  • LOD-aware zoom tiling in rbv
  • PDF/X validation and preflight reports
  • Configurable JPEG quality (--quality flag)
  • Lazy / streaming PDF parsing for large files (remove the hard size block)

Contributing

cargo test --workspace
  • MSRV is Rust 1.85 (edition 2024). Do not raise this floor without discussion.
  • Targets:x86_64, aarch64, wasm32-unknown-unknown (via rustybara-wasm)
  • The TrimBox is always the source-of-truth reference box. It is never modified by any operation.
  • Public API additions require documentation and at least one integration test.
  • The app-style keyboard model is the UX baseline for rbara. Modal bindings are opt-in aliases only.

Cutting a release

Releases are fully automated by .github/workflows/release.yml. To cut a new version:

  1. Bump version in rbara/Cargo.toml (and rustybara/Cargo.toml if the lib changed).
  2. Commit and push.
  3. Tag and push the tag:
    git tag v0.1.7
    git push --tags
  4. The workflow will build the Windows installer, the Linux tarball, both macOS tarballs (Apple silicon + Intel), and the Docker image, then create a GitHub Release with all artifacts and a SHA256SUMS.txt attached.

Hyphenated compatibility-iteration tags such as v0.2.0-1 create a prerelease containing only the rbara CLI/TUI installers and Docker image. The GUI and ICC packages are left at their existing versions. Tags without a hyphen continue to produce the full release suite.

The pdfium chromium build is pinned via PDFIUM_CHROMIUM env var in the workflow (currently 7776). Bump it there to refresh pdfium across all artifacts in lockstep.


Playground

Try rustybara-wasm live in the browser at rustybara.com/playground. Upload a PDF or use a sample file — trim, resize, and remap CMYK values entirely client-side via WebAssembly. No account, no upload, no server.


License

The LGPL license on the library allows downstream tools to link against rustybara without copyleft obligations on their own code, while the binaries remain fully copyleft.

Copyright (c) 2026 Addy Alvarado

capybara chillin

About

Rust library, interactive CLI, and desktop GUI for prepress PDF work — trim printer marks, manage bleed, rasterize pages, and more. A free, open-source alternative to proprietary prepress tools.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

Rustybara logo

Rustybara

Prepress-focused PDF manipulation toolkit for graphic designers and print operators.

Crates.ioDownloadsDocumentationLicense


Rustybara dashboard

Rustybara is the convergence of three standalone prepress CLI tools into a unified Rust library and interactive toolset, built on the same primitives those tools proved in production:

Origin ToolPrimitive
pdf-mark-removalContent stream filtering, CTM math
resize_to_bleed_or_trim_pdfPage box geometry (MediaBox, TrimBox, BleedBox)
pdf-2-imagePDF rasterization and image encoding

It ships as a library crate (rustybara), a CLI/TUI binary (rbara), and a GPU-accelerated PDF page viewer (rbv).


Workspace

CrateDescriptionLicense
rustybaraCore PDF manipulation libraryLGPLv3
rustybara-iccICC color management — 22 bundled profilesLGPLv3
rustybara-wasmWebAssembly bindings — browser, Node.js, edgeLGPLv3
rbaraTerminal UI (Ratatui TUI)GPLv3
rbara-guiNative desktop GUI (Tauri v2)GPLv3
rbvPrepress PDF viewer (Skia + OpenGL + winit)GPLv3

Features

Featurerustybararustybara-iccrustybara-wasm
Page trim & resize
CMYK remap
Split / stitch pages
Extract page ranges
Flatten spot colors
Rasterization (pdfium)
XMP metadata embed & read
Page object tree + hit-testing
Plate separation filtering
Outline text (glyph → paths)
ICC color transforms
WebAssembly / browser
Node.js / edge runtime
  • Pipeline API — Chain operations fluently: open → trim → resize → remap → save.
  • Batch processing — Process entire directories of PDFs from CLI or TUI.
  • Interactive TUI — App-style terminal interface for designers who prefer guided workflows over raw CLI flags. Configurable output directory.
  • Prepress vocabulary — Every API surface speaks in boxes, bleeds, and DPI — not generic PDF primitives.

Installation

Pre-built installers for rbara (the CLI/TUI binary) are published with each release. Each installer bundles its own pdfium runtime — no system pdfium needed.

Windows

Download rbara-setup-<version>-x64.exe from the Releases page and run it. This is a per-user Inno Setup installer (no admin required) that installs to %LOCALAPPDATA%\Programs\rbara\, registers an opt-in PATH entry, and adds an Add/Remove Programs entry. SmartScreen may warn the first time — the binary is currently unsigned.

macOS

# Apple silicon
tar -xzf rbara-<version>-macos-arm64.tar.gz &&cd rbara-<version>-macos-arm64
./install.sh # installs to ~/.local# Intel
tar -xzf rbara-<version>-macos-x86_64.tar.gz &&cd rbara-<version>-macos-x86_64
./install.sh

The bundle is unsigned; install.sh strips the com.apple.quarantine attribute automatically. To uninstall: ./uninstall.sh.

Linux (glibc x86_64)

tar -xzf rbara-<version>-linux-x64.tar.gz &&cd rbara-<version>-linux-x64
./install.sh # ~/.local
sudo PREFIX=/usr/local ./install.sh # system-wide

Tested on Ubuntu 22.04+, Debian 12+, Fedora 38+, RHEL 9+, Arch, openSUSE Tumbleweed. Musl distros (Alpine) need a source build. To uninstall: ./uninstall.sh.

Docker

docker pull ghcr.io/addy-a/rbara:latest
# CLI usage — bind-mount your working directory
docker run --rm -v "$PWD:/work" ghcr.io/addy-a/rbara:latest \
trim /work/in.pdf -o /work/out.pdf

The image is ~175 MB (debian:bookworm-slim base) and runs as a non-root user.

Building from source

See the Contributing section. The maintainer-side installer scripts live in installer/ (one subdir per platform, each with its own README).


Quick Start

As a library

Add to your Cargo.toml:

[dependencies]
rustybara = "0.1"
use rustybara::PdfPipeline;fnmain() -> rustybara::Result<()>{// Trim marks, resize to 9pt bleed, savePdfPipeline::open("input.pdf")?
.trim()?
.resize(9.0)?
.split_pages(5.83*72.0)? // split spreads into 5.83" panels.save_pdf("output.pdf")?;Ok(())}

Rasterize a page

use rustybara::{PdfPipeline, encode::OutputFormat, raster::RenderConfig};fnmain() -> rustybara::Result<()>{let pipeline = PdfPipeline::open("input.pdf")?;let config = RenderConfig::prepress();// 300 DPI
pipeline.save_page_image(0,"page_1.jpg",&OutputFormat::Jpg,&config)?;Ok(())}

Embed XMP provenance metadata

use rustybara::{PdfPipeline, xmp};fnmain() -> rustybara::Result<()>{let source_hash = xmp::hash_file(std::path::Path::new("input.pdf"))?;let timestamp = "2026-05-28T12:00:00Z".to_string();PdfPipeline::open("input.pdf")?
.trim()?
.resize(9.0)?
.embed_metadata(&source_hash,&timestamp,&[("trim",""),("resize","bleed_pts=9")])?
.save_pdf("output.pdf")?;Ok(())}

Inspect the page object tree

use rustybara::{PdfPipeline, objects::tree::build_object_tree};fnmain() -> rustybara::Result<()>{let pipeline = PdfPipeline::open("input.pdf")?;let page_id = pipeline.doc().get_pages()[&1];let tree = build_object_tree(pipeline.doc(), page_id)?;for obj in&tree.objects{println!("{:?} bbox={:?}", obj.kind, obj.bbox);}Ok(())}

CLI

# Trim print marks
rbara trim input.pdf
# Resize to 1/8-inch bleed (--bleed remains available for point-based scripts)
rbara resize --bleed-inches 0.125 input.pdf
# Add a TrimBox, set page size, or rotate pages
rbara add-trim-box --bleed-inches 0.125 input.pdf
rbara set-media-box --width-inches 8.5 --height-inches 11 input.pdf
rbara rotate --degrees 90 input.pdf
# Export pages as 300 DPI PNGs at quality 90
rbara image --format png --dpi 300 --quality 90 input.pdf
# Extract, split, or stitch pages
rbara extract-pages --pages "1,3-5" input.pdf
rbara split-pages --panel-width 5.83 input.pdf
rbara split-pages --panel-widths 3.625,3.6875,3.6875 --axis horizontal input.pdf
rbara stitch-pages --spread-width 8.5 input.pdf
# Remap a CMYK color (rich black → 60/40/20/100)
rbara remap-color --from 1.0 1.0 1.0 1.0 --to 0.6 0.4 0.2 1.0 input.pdf
# Convert or flatten colors, and outline text
rbara convert-color-space --from-profile AdobeRGB1998 --to-profile USWebCoatedSWOP input.pdf
rbara flatten-spots input.pdf
rbara outline-text input.pdf
# Inspect page boxes, document color usage, and Rustybara provenance
rbara info input.pdf

Every PDF-writing command accepts multiple input files, --output <DIR>, and --overwrite. Without --overwrite, outputs receive an operation suffix such as _processed, _extracted, _split, or _stitch. Image export never overwrites a PDF source and also supports --annotations and --forms.

split-pages --panel-widths accepts an ordered, comma-separated plan containing at least two positive sizes in inches. The sizes must total the source page's TrimBox extent (within half a PDF point). --axis horizontal emits panels left to right; --axis vertical emits them bottom to top. The existing singular --panel-width behavior remains unchanged and defaults to the horizontal axis. PDF outputs include a Rustybara XMP provenance block.

TUI

Launch rbara with no arguments to enter the interactive terminal interface:

rbara

Arrow keys navigate, Enter selects, and Esc goes back. The menu scrolls on smaller terminals; press ? for the full keyboard reference.


rustybara-wasm

WebAssembly bindings for rustybara. Run PDF manipulation in any JavaScript or TypeScript environment — browser, Node.js, Deno, or Cloudflare Workers — with no native dependencies.

Exposes the pure-Rust pipeline subset:

  • trim() — strip content outside TrimBox
  • resize(bleed_pts) — expand page boxes by a bleed margin
  • split_pages_explicit(panel_widths_pts, axis) — split panels by exact widths
  • remap_color(from, to, tolerance) — substitute CMYK values in content streams
  • to_pdf_bytes() — serialize result as bytes for download or further processing

Rasterization (pdfium), object tree rendering, and ICC color transforms (lcms2) require the native crate and are not available in the wasm build. XMP provenance metadata is supported by the WASM package.

Browser quickstart

importinit,{PipelineHandle}from'./pkg/rustybara_wasm.js'awaitinit('./pkg/rustybara_wasm_bg.wasm')constbytes=newUint8Array(awaitfetch('input.pdf').then((r)=>r.arrayBuffer()),)lethandle=newPipelineHandle(bytes)handle=handle.trim()handle=handle.resize(8.504)constresult=handle.to_pdf_bytes()

Build

cd rustybara-wasm
wasm-pack build --target web --out-dir pkg --release

npm

The Node.js package is built as rustybara-wasm, with generated TypeScript declarations and no native runtime dependency. After the first registry release:

npm install rustybara-wasm
constfs=require('node:fs')const{ PanelAxis, PipelineHandle }=require('rustybara-wasm')constinput=fs.readFileSync('input.pdf')constpdf=newPipelineHandle(input).split_pages_explicit(Float64Array.from([261,265.5,265.5]),PanelAxis.Vertical,)fs.writeFileSync('output.pdf',pdf.to_pdf_bytes())

See rustybara-wasm/README.md for the complete Node API and local packaging instructions. The browser build remains available via the rustybara playground.


Architecture

Module Map

rustybara/src/
lib.rs — Public re-exports
pipeline.rs — PdfPipeline: high-level chaining API
error.rs — Unified error type
xmp.rs — XMP metadata embedding, reading, and SHA-256 provenance hashing
geometry/
rect.rs — Rect (position + dimensions, PDF coordinate system)
matrix.rs — Matrix (2D affine CTM transformations)
pages/
boxes.rs — PageBoxes: TrimBox, MediaBox, BleedBox, CropBox reader
split.rs — Page extraction and splitting utilities
stitch.rs — Spread stitching utilities
layout.rs — Page layout helpers
stream/
filter.rs — ContentFilter: CTM-walking content stream filter
color_ops.rs — ColorRemap: CMYK→CMYK value substitution in content streams
objects/
tree.rs — build_object_tree: full page object list (paths, images, text)
with color, CTM, overprint state, and subpath geometry
hittest.rs — Spatial hit-testing against the ObjectTree
separation.rs — filter_by_ink: plate isolation by CMYK channel or spot name
outline/ — (feature-gated: "outline")
font.rs — Extract raw font bytes from PDF resource dictionaries
encoding.rs — Resolve character codes to GlyphId
paths.rs — outline_page_text: walk content stream → per-glyph path geometry
writer.rs — glyphs_to_content_stream: serialize glyphs back to PDF operators
raster/
render.rs — PageRenderer trait, CpuRenderer (pdfium-render)
config.rs — RenderConfig (DPI, annotation toggles)
encode/
save.rs — OutputFormat enum, image encoding (JPG/PNG/WebP/TIFF)
color/ — (feature-gated: "color")
icc.rs — Re-exports from rustybara-icc crate
transform.rs — Re-exports from rustybara-icc crate
rustybara-icc/src/ (separate crate, optionally used via "color" feature)
lib.rs — ICC color management engine
color_space.rs — ColorSpaceKind enum (CMYK, RGB, Gray, Lab)
error.rs — IccError type for color operations
intent.rs — RenderingIntent enum for ICC transforms
pixel_format.rs — PixelFormat enum (RGB8, CMYK8, etc.)
transform.rs — ColorTransform: pixel-level ICC profile transforms
pdf.rs — PdfColorConverter: document-level color space conversion
profiles/ — Bundled ICC profiles (FOGRA39, GRACoL2006, etc.)

Public API

rustybara is a high-level, prepress-scoped crate. The public API speaks in prepress vocabulary:

// Prepress operationsPdfPipeline::open(path)?
.trim()? // Remove content outside TrimBox.resize(bleed_pts)? // Expand page boxes by bleed margin.remap_color(from, to, tolerance)? // Substitute CMYK values.add_trim_box(bleed_pts)? // Inset MediaBox to set a TrimBox.embed_metadata(hash, ts, ops)? // Embed rbara: XMP provenance block.save_pdf(path)?;// Write the result// Rasterization
pipeline.render_page(0,&config)?;// → DynamicImage
pipeline.save_page_image(0, path,&format,&config)?;// → file// Page operationslet new_pipeline = pipeline.extract_pages(&[0,2,4])?;// → new pipelinelet spreads = pipeline.split_pages(panel_width_pts)?;// → new pipelinelet panels = pipeline.split_pages_explicit(&[261.0,265.5,265.5],
rustybara::pages::SplitAxis::Horizontal,)?;// → new pipelinelet stitched = pipeline.stitch_pages(spread_width_pts)?;// → new pipeline// Page inspectionlet boxes = PageBoxes::read(&doc, page_id)?;
boxes.trim_or_media()// TrimBox if present, else MediaBox
boxes.bleed_rect(9.0)// Expand trim by bleed amount// XMP provenance
let hash = xmp::hash_file(path)?;// sha256:<hex>let block = pipeline.read_xmp_block();// Option<RbaraXmpBlock>// Object tree (paths, images, text — full geometry + color)let tree = objects::tree::build_object_tree(doc, page_id)?;let plate_objs = objects::separation::filter_by_ink(&tree,&InkSelector::CmykChannel(CmykChannel::Cyan),);// Text outline extraction (requires "outline" feature)#[cfg(feature = "outline")]{use rustybara::outline::{outline_page_text, writer::glyphs_to_content_stream};let glyphs = outline_page_text(doc, page_id)?;let pdf_ops = glyphs_to_content_stream(&glyphs);// → PDF path operators}// Color space conversion (requires "color" feature)#[cfg(feature = "color")]{use rustybara::color::{ColorTransform,RenderingIntent, profiles};let transform = ColorTransform::new(&profiles::COATED_FOGRA_39,&profiles::COATED_GRACOL_2006,RenderingIntent::RelativeColorimetric,)?;
pipeline.convert_color_space(&transform)?;// Convert entire document}

Feature Flags

FlagWhat it enablesDefault
rasterpdfium-render, image, webp — page rasterization
outlinettf-parser — text outline / glyph-path extraction
colorrustybara-icc / lcms2 — ICC color management
wasmWebAssembly build gate
gpuReserved for future GPU renderer

Renderer Trait

Rendering is behind a trait for future GPU backend support:

pubtraitPageRenderer{fnrender(&self,page:&PdfPage,config:&RenderConfig)
-> Result<DynamicImage>;}pubstructCpuRenderer;// pdfium-render — ships today// pub struct GpuRenderer; // vello/wgpu — future work

Dependencies

CrateRole
lopdf 0.40PDF object graph manipulation
pdfium-render 0.9PDF rasterization via PDFium
image 0.25Bitmap encoding (JPEG, PNG, WebP, TIFF)
rayon 1.11Parallel page rendering
ttf-parser 0.25TrueType glyph outline extraction (outline feature)
uuid 1UUID v4 generation for XMP provenance
sha2 0.11SHA-256 source file hashing for XMP provenance
rustybara-icc 0.1ICC color management (optional, color feature)
lcms2 6.1Little CMS color engine (via rustybara-icc, color feature)

Runtime Requirement — PDFium

The render_page and save_page_image functions require the PDFium shared library at runtime. Place the appropriate binary alongside your executable:

PlatformFile
Windowspdfium.dll
macOSlibpdfium.dylib
Linuxlibpdfium.so

Pre-built binaries: pdfium-binaries

Note: End-users of the rbara binary do not need to do this manually — the pre-built installers bundle the matching pdfium for each platform. This requirement applies only when consuming rustybara as a library in your own Rust project.

Operations that do not rasterize (trim, resize, save_pdf, page_count, PageBoxes::read, build_object_tree, embed_metadata) work without PDFium.


rbara — CLI & TUI Binary

rbara is the interactive front-end for rustybara. It provides both a flag-based CLI for scripting and a TUI for guided workflows.

Keyboard Reference (TUI)

KeyAction
tTrim print marks
rResize to bleed
bAdd TrimBox
sSet MediaBox
gRotate pages
xExport to image
eExtract pages
pSplit pages
hStitch pages
mRemap colors
cConvert color space
kFlatten spot colors
lOutline text
/Output path
oToggle overwrite mode
fChange files
qQuit
EnterRun selected action
?Keyboard reference overlay

UX Model

The TUI follows an app-style keyboard model — arrow keys, Enter, Esc — designed for designers who have never used a terminal before. Vim-style bindings may be layered on as aliases in a future version.

File-first workflow: launch → select file or directory → commands become available. Directories auto-glob *.pdf files.


rbv — PDF Page Viewer

rbv is a prepress-focused PDF viewer built on Skia (OpenGL) + winit. It is designed for quick go/no-go QC decisions — bleed check, color space, spot ink declaration — not sub-pixel vector fidelity. Pages are rasterized by pdfium and displayed as a bitmap; the object tree layer adds wireframe, hit-testing, and color diagnostics on top.

rbv <file> [page] [--dpi <dpi>]

The initial preview renders at 72 DPI for fast startup, then a full-resolution render (at the specified DPI, default 300) replaces it in the background.

Keyboard Shortcuts

KeyAction
WToggle wireframe mode
OToggle prepress box overlays (bleed/trim/crop)
Ctrl + = / Ctrl + +Zoom in
Ctrl + -Zoom out
Ctrl + 0Reset zoom and pan
Ctrl + ScrollZoom toward cursor
Left dragPan
Left clickSelect object + sample color
H / / K / Previous page
L / / J / Next page
NgJump to page N (e.g. 5g)
Ctrl+Shift+DToggle debug overlay
Ctrl+Shift+EExport wireframe diagnostic PDF
EscExit

Wireframe Mode

W replaces the raster image with a vector outline view derived from the page's ObjectTree. Every path, image, and text block is drawn as a thin black stroke in page-space coordinates. The selected object receives a 2px blue highlight. Glyph outlines (extracted via outline_page_text) are drawn on top when available. Ctrl+Shift+E exports the wireframe geometry to a diagnostic PDF for cross-referencing with qpdf --qdf.

Color Diagnostics

Left-click any area to sample:

  • Pixel RGBA — what the monitor is displaying (sampled from the rasterized bitmap)
  • PDF color — the declared fill/stroke color of the hit object from the content stream (DeviceGray / DeviceRGB / DeviceCMYK / Separation)
  • ICC CMYK — the pixel RGB converted to CMYK via Little CMS 2 (destination: US Web Coated SWOP)

A crosshair marker is stored in PDF coordinates and projected to screen each frame, so it stays locked to the correct page position as you zoom and pan.

File Watching

rbv monitors the opened file via notify. When the file changes on disk (e.g. after an InDesign export), it automatically re-opens the document, rebuilds the object tree, and re-renders — supporting a save-and-preview loop without restarting.

IPC

rbara-gui can send commands to a running rbv instance (e.g. switch to a different file after processing). rbv accepts these via a local IPC channel when launched with --listen.


Known Limitations

LimitationNotes
sRGB rasterization onlyCMYK→sRGB via PDFium. ICC color transforms available via color feature for stream-level operations.
JPEG quality not configurableFixed encoder quality. --quality flag planned.
Spot color approximationPDFium renders spot inks as CMYK approximations.
No Form XObject ColorSpace pruningInherited limitation from content stream filtering.
rbv requires display serverNo headless preview. Graceful error on missing GPU.
rbv zoom qualityRaster-only rendering degrades past ~150–200% zoom. LOD tiling planned.
CFF / Type1 glyph outlinesttf-parser requires sfnt container; raw CFF fonts use a OTTO header shim with ongoing refinement.
Very large PDFs (~200 MB+)Hard-blocked on add in rbara-gui. See below.

Large file handling

rustybara opens PDFs eagerly: lopdf parses the entire object graph into memory on load, and the PDFium render path round-trips through a full document serialization. For very large files (roughly 200 MB and up, e.g. imposed print runs of hundreds of pages) this parse can take tens of seconds and consume multiple gigabytes of RAM — long enough to make the desktop app appear frozen.

We explored splitting large files into page-range chunks (processing each independently) and re-merging the results into a single output. It worked mechanically but didn't hold up as a real solution: chunking still pays the full parse cost, the merge re-materializes the whole document in memory, and neither approaches the performance of mature tools like Acrobat or PitStop, which use lazy/random-access parsing. That experiment has been removed.

For now, rbara-guihard-blocks files above a configurable size limit (default 200 MB, set in Settings → Behavior; 0 disables the limit at your own risk) and surfaces a clear warning rather than freezing. The underlying library operations remain available for callers who can afford the memory/time.

A proper fix — lazy/streaming parse and metadata extraction that never loads the whole document — is planned for a future release (see Roadmap).


Roadmap

  • ICC color management (color module via lcms2) — v0.1.2
  • CMYK→CMYK color remapping in content streams — v0.1.2
  • Cross-platform installers (Windows / macOS / Linux / Docker) with bundled pdfium — v0.1.3
  • GitHub Actions release pipeline (one tag → all installers + GHCR image) — v0.1.3
  • rbv GPU-accelerated page viewer (wgpu + winit) — v0.1.4
  • rbara-gui native desktop GUI (Tauri v2) — v0.1.4
  • Split Pages — divide spreads into individual panels at a configurable width — v0.1.5
  • Stitch Pages — combine panels back into spreads at a configurable spread width — v0.1.5
  • Extract Pages — extract arbitrary page ranges into a new PDF — v0.1.5
  • Flatten Spot Colors — flatten spot color inks to CMYK process — v0.1.5
  • Command bar (: mode) with chord shortcuts and live preview — v0.1.5
  • Page object tree with spatial hit-testing — v0.1.6
  • Wireframe mode in rbv (Skia/OpenGL renderer) — v0.1.6
  • Color diagnostics panel with ICC pixel sampling — v0.1.6
  • Outline Text — vectorize embedded TrueType glyphs to PDF path operators — v0.1.6
  • Plate separation filtering (filter_by_ink, InkSelector) — v0.1.6
  • Wireframe diagnostic PDF export — v0.1.6
  • File watching / live reload in rbv — v0.1.6
  • XMP provenance metadata embedding and reading (rbara: namespace) — v0.1.7
  • Tile rendering system in rbv for large pages — v0.1.7
  • Resizable panels and activity log in rbara-gui — v0.1.7
  • Rotate PDF (/Rotate page action) — v0.1.9
  • Set Media Box action — v0.1.9
  • Configurable JPEG/WebP export quality — v0.1.9
  • System / network print for fast proofs — v0.1.9
  • Fix: macOS rbv dock-icon / defunct process on exit (clean event_loop.exit() + child reaping) — v0.1.9
  • Fix: Windows rbv console window on launch (windows_subsystem) — v0.1.9
  • RGB→CMYK conversion (vector graphics + embedded images)
  • Spot color detection service
  • LOD-aware zoom tiling in rbv
  • PDF/X validation and preflight reports
  • Configurable JPEG quality (--quality flag)
  • Lazy / streaming PDF parsing for large files (remove the hard size block)

Contributing

cargo test --workspace
  • MSRV is Rust 1.85 (edition 2024). Do not raise this floor without discussion.
  • Targets:x86_64, aarch64, wasm32-unknown-unknown (via rustybara-wasm)
  • The TrimBox is always the source-of-truth reference box. It is never modified by any operation.
  • Public API additions require documentation and at least one integration test.
  • The app-style keyboard model is the UX baseline for rbara. Modal bindings are opt-in aliases only.

Cutting a release

Releases are fully automated by .github/workflows/release.yml. To cut a new version:

  1. Bump version in rbara/Cargo.toml (and rustybara/Cargo.toml if the lib changed).
  2. Commit and push.
  3. Tag and push the tag:
    git tag v0.1.7
    git push --tags
  4. The workflow will build the Windows installer, the Linux tarball, both macOS tarballs (Apple silicon + Intel), and the Docker image, then create a GitHub Release with all artifacts and a SHA256SUMS.txt attached.

Hyphenated compatibility-iteration tags such as v0.2.0-1 create a prerelease containing only the rbara CLI/TUI installers and Docker image. The GUI and ICC packages are left at their existing versions. Tags without a hyphen continue to produce the full release suite.

The pdfium chromium build is pinned via PDFIUM_CHROMIUM env var in the workflow (currently 7776). Bump it there to refresh pdfium across all artifacts in lockstep.


Playground

Try rustybara-wasm live in the browser at rustybara.com/playground. Upload a PDF or use a sample file — trim, resize, and remap CMYK values entirely client-side via WebAssembly. No account, no upload, no server.


License

The LGPL license on the library allows downstream tools to link against rustybara without copyleft obligations on their own code, while the binaries remain fully copyleft.

Copyright (c) 2026 Addy Alvarado

capybara chillin

About

Rust library, interactive CLI, and desktop GUI for prepress PDF work — trim printer marks, manage bleed, rasterize pages, and more. A free, open-source alternative to proprietary prepress tools.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

Rustybara logo

Rustybara

Prepress-focused PDF manipulation toolkit for graphic designers and print operators.

Crates.ioDownloadsDocumentationLicense


Rustybara dashboard

Rustybara is the convergence of three standalone prepress CLI tools into a unified Rust library and interactive toolset, built on the same primitives those tools proved in production:

Origin ToolPrimitive
pdf-mark-removalContent stream filtering, CTM math
resize_to_bleed_or_trim_pdfPage box geometry (MediaBox, TrimBox, BleedBox)
pdf-2-imagePDF rasterization and image encoding

It ships as a library crate (rustybara), a CLI/TUI binary (rbara), and a GPU-accelerated PDF page viewer (rbv).


Workspace

CrateDescriptionLicense
rustybaraCore PDF manipulation libraryLGPLv3
rustybara-iccICC color management — 22 bundled profilesLGPLv3
rustybara-wasmWebAssembly bindings — browser, Node.js, edgeLGPLv3
rbaraTerminal UI (Ratatui TUI)GPLv3
rbara-guiNative desktop GUI (Tauri v2)GPLv3
rbvPrepress PDF viewer (Skia + OpenGL + winit)GPLv3

Features

Featurerustybararustybara-iccrustybara-wasm
Page trim & resize
CMYK remap
Split / stitch pages
Extract page ranges
Flatten spot colors
Rasterization (pdfium)
XMP metadata embed & read
Page object tree + hit-testing
Plate separation filtering
Outline text (glyph → paths)
ICC color transforms
WebAssembly / browser
Node.js / edge runtime
  • Pipeline API — Chain operations fluently: open → trim → resize → remap → save.
  • Batch processing — Process entire directories of PDFs from CLI or TUI.
  • Interactive TUI — App-style terminal interface for designers who prefer guided workflows over raw CLI flags. Configurable output directory.
  • Prepress vocabulary — Every API surface speaks in boxes, bleeds, and DPI — not generic PDF primitives.

Installation

Pre-built installers for rbara (the CLI/TUI binary) are published with each release. Each installer bundles its own pdfium runtime — no system pdfium needed.

Windows

Download rbara-setup-<version>-x64.exe from the Releases page and run it. This is a per-user Inno Setup installer (no admin required) that installs to %LOCALAPPDATA%\Programs\rbara\, registers an opt-in PATH entry, and adds an Add/Remove Programs entry. SmartScreen may warn the first time — the binary is currently unsigned.

macOS

# Apple silicon
tar -xzf rbara-<version>-macos-arm64.tar.gz &&cd rbara-<version>-macos-arm64
./install.sh # installs to ~/.local# Intel
tar -xzf rbara-<version>-macos-x86_64.tar.gz &&cd rbara-<version>-macos-x86_64
./install.sh

The bundle is unsigned; install.sh strips the com.apple.quarantine attribute automatically. To uninstall: ./uninstall.sh.

Linux (glibc x86_64)

tar -xzf rbara-<version>-linux-x64.tar.gz &&cd rbara-<version>-linux-x64
./install.sh # ~/.local
sudo PREFIX=/usr/local ./install.sh # system-wide

Tested on Ubuntu 22.04+, Debian 12+, Fedora 38+, RHEL 9+, Arch, openSUSE Tumbleweed. Musl distros (Alpine) need a source build. To uninstall: ./uninstall.sh.

Docker

docker pull ghcr.io/addy-a/rbara:latest
# CLI usage — bind-mount your working directory
docker run --rm -v "$PWD:/work" ghcr.io/addy-a/rbara:latest \
trim /work/in.pdf -o /work/out.pdf

The image is ~175 MB (debian:bookworm-slim base) and runs as a non-root user.

Building from source

See the Contributing section. The maintainer-side installer scripts live in installer/ (one subdir per platform, each with its own README).


Quick Start

As a library

Add to your Cargo.toml:

[dependencies]
rustybara = "0.1"
use rustybara::PdfPipeline;fnmain() -> rustybara::Result<()>{// Trim marks, resize to 9pt bleed, savePdfPipeline::open("input.pdf")?
.trim()?
.resize(9.0)?
.split_pages(5.83*72.0)? // split spreads into 5.83" panels.save_pdf("output.pdf")?;Ok(())}

Rasterize a page

use rustybara::{PdfPipeline, encode::OutputFormat, raster::RenderConfig};fnmain() -> rustybara::Result<()>{let pipeline = PdfPipeline::open("input.pdf")?;let config = RenderConfig::prepress();// 300 DPI
pipeline.save_page_image(0,"page_1.jpg",&OutputFormat::Jpg,&config)?;Ok(())}

Embed XMP provenance metadata

use rustybara::{PdfPipeline, xmp};fnmain() -> rustybara::Result<()>{let source_hash = xmp::hash_file(std::path::Path::new("input.pdf"))?;let timestamp = "2026-05-28T12:00:00Z".to_string();PdfPipeline::open("input.pdf")?
.trim()?
.resize(9.0)?
.embed_metadata(&source_hash,&timestamp,&[("trim",""),("resize","bleed_pts=9")])?
.save_pdf("output.pdf")?;Ok(())}

Inspect the page object tree

use rustybara::{PdfPipeline, objects::tree::build_object_tree};fnmain() -> rustybara::Result<()>{let pipeline = PdfPipeline::open("input.pdf")?;let page_id = pipeline.doc().get_pages()[&1];let tree = build_object_tree(pipeline.doc(), page_id)?;for obj in&tree.objects{println!("{:?} bbox={:?}", obj.kind, obj.bbox);}Ok(())}

CLI

# Trim print marks
rbara trim input.pdf
# Resize to 1/8-inch bleed (--bleed remains available for point-based scripts)
rbara resize --bleed-inches 0.125 input.pdf
# Add a TrimBox, set page size, or rotate pages
rbara add-trim-box --bleed-inches 0.125 input.pdf
rbara set-media-box --width-inches 8.5 --height-inches 11 input.pdf
rbara rotate --degrees 90 input.pdf
# Export pages as 300 DPI PNGs at quality 90
rbara image --format png --dpi 300 --quality 90 input.pdf
# Extract, split, or stitch pages
rbara extract-pages --pages "1,3-5" input.pdf
rbara split-pages --panel-width 5.83 input.pdf
rbara split-pages --panel-widths 3.625,3.6875,3.6875 --axis horizontal input.pdf
rbara stitch-pages --spread-width 8.5 input.pdf
# Remap a CMYK color (rich black → 60/40/20/100)
rbara remap-color --from 1.0 1.0 1.0 1.0 --to 0.6 0.4 0.2 1.0 input.pdf
# Convert or flatten colors, and outline text
rbara convert-color-space --from-profile AdobeRGB1998 --to-profile USWebCoatedSWOP input.pdf
rbara flatten-spots input.pdf
rbara outline-text input.pdf
# Inspect page boxes, document color usage, and Rustybara provenance
rbara info input.pdf

Every PDF-writing command accepts multiple input files, --output <DIR>, and --overwrite. Without --overwrite, outputs receive an operation suffix such as _processed, _extracted, _split, or _stitch. Image export never overwrites a PDF source and also supports --annotations and --forms.

split-pages --panel-widths accepts an ordered, comma-separated plan containing at least two positive sizes in inches. The sizes must total the source page's TrimBox extent (within half a PDF point). --axis horizontal emits panels left to right; --axis vertical emits them bottom to top. The existing singular --panel-width behavior remains unchanged and defaults to the horizontal axis. PDF outputs include a Rustybara XMP provenance block.

TUI

Launch rbara with no arguments to enter the interactive terminal interface:

rbara

Arrow keys navigate, Enter selects, and Esc goes back. The menu scrolls on smaller terminals; press ? for the full keyboard reference.


rustybara-wasm

WebAssembly bindings for rustybara. Run PDF manipulation in any JavaScript or TypeScript environment — browser, Node.js, Deno, or Cloudflare Workers — with no native dependencies.

Exposes the pure-Rust pipeline subset:

  • trim() — strip content outside TrimBox
  • resize(bleed_pts) — expand page boxes by a bleed margin
  • split_pages_explicit(panel_widths_pts, axis) — split panels by exact widths
  • remap_color(from, to, tolerance) — substitute CMYK values in content streams
  • to_pdf_bytes() — serialize result as bytes for download or further processing

Rasterization (pdfium), object tree rendering, and ICC color transforms (lcms2) require the native crate and are not available in the wasm build. XMP provenance metadata is supported by the WASM package.

Browser quickstart

importinit,{PipelineHandle}from'./pkg/rustybara_wasm.js'awaitinit('./pkg/rustybara_wasm_bg.wasm')constbytes=newUint8Array(awaitfetch('input.pdf').then((r)=>r.arrayBuffer()),)lethandle=newPipelineHandle(bytes)handle=handle.trim()handle=handle.resize(8.504)constresult=handle.to_pdf_bytes()

Build

cd rustybara-wasm
wasm-pack build --target web --out-dir pkg --release

npm

The Node.js package is built as rustybara-wasm, with generated TypeScript declarations and no native runtime dependency. After the first registry release:

npm install rustybara-wasm
constfs=require('node:fs')const{ PanelAxis, PipelineHandle }=require('rustybara-wasm')constinput=fs.readFileSync('input.pdf')constpdf=newPipelineHandle(input).split_pages_explicit(Float64Array.from([261,265.5,265.5]),PanelAxis.Vertical,)fs.writeFileSync('output.pdf',pdf.to_pdf_bytes())

See rustybara-wasm/README.md for the complete Node API and local packaging instructions. The browser build remains available via the rustybara playground.


Architecture

Module Map

rustybara/src/
lib.rs — Public re-exports
pipeline.rs — PdfPipeline: high-level chaining API
error.rs — Unified error type
xmp.rs — XMP metadata embedding, reading, and SHA-256 provenance hashing
geometry/
rect.rs — Rect (position + dimensions, PDF coordinate system)
matrix.rs — Matrix (2D affine CTM transformations)
pages/
boxes.rs — PageBoxes: TrimBox, MediaBox, BleedBox, CropBox reader
split.rs — Page extraction and splitting utilities
stitch.rs — Spread stitching utilities
layout.rs — Page layout helpers
stream/
filter.rs — ContentFilter: CTM-walking content stream filter
color_ops.rs — ColorRemap: CMYK→CMYK value substitution in content streams
objects/
tree.rs — build_object_tree: full page object list (paths, images, text)
with color, CTM, overprint state, and subpath geometry
hittest.rs — Spatial hit-testing against the ObjectTree
separation.rs — filter_by_ink: plate isolation by CMYK channel or spot name
outline/ — (feature-gated: "outline")
font.rs — Extract raw font bytes from PDF resource dictionaries
encoding.rs — Resolve character codes to GlyphId
paths.rs — outline_page_text: walk content stream → per-glyph path geometry
writer.rs — glyphs_to_content_stream: serialize glyphs back to PDF operators
raster/
render.rs — PageRenderer trait, CpuRenderer (pdfium-render)
config.rs — RenderConfig (DPI, annotation toggles)
encode/
save.rs — OutputFormat enum, image encoding (JPG/PNG/WebP/TIFF)
color/ — (feature-gated: "color")
icc.rs — Re-exports from rustybara-icc crate
transform.rs — Re-exports from rustybara-icc crate
rustybara-icc/src/ (separate crate, optionally used via "color" feature)
lib.rs — ICC color management engine
color_space.rs — ColorSpaceKind enum (CMYK, RGB, Gray, Lab)
error.rs — IccError type for color operations
intent.rs — RenderingIntent enum for ICC transforms
pixel_format.rs — PixelFormat enum (RGB8, CMYK8, etc.)
transform.rs — ColorTransform: pixel-level ICC profile transforms
pdf.rs — PdfColorConverter: document-level color space conversion
profiles/ — Bundled ICC profiles (FOGRA39, GRACoL2006, etc.)

Public API

rustybara is a high-level, prepress-scoped crate. The public API speaks in prepress vocabulary:

// Prepress operationsPdfPipeline::open(path)?
.trim()? // Remove content outside TrimBox.resize(bleed_pts)? // Expand page boxes by bleed margin.remap_color(from, to, tolerance)? // Substitute CMYK values.add_trim_box(bleed_pts)? // Inset MediaBox to set a TrimBox.embed_metadata(hash, ts, ops)? // Embed rbara: XMP provenance block.save_pdf(path)?;// Write the result// Rasterization
pipeline.render_page(0,&config)?;// → DynamicImage
pipeline.save_page_image(0, path,&format,&config)?;// → file// Page operationslet new_pipeline = pipeline.extract_pages(&[0,2,4])?;// → new pipelinelet spreads = pipeline.split_pages(panel_width_pts)?;// → new pipelinelet panels = pipeline.split_pages_explicit(&[261.0,265.5,265.5],
rustybara::pages::SplitAxis::Horizontal,)?;// → new pipelinelet stitched = pipeline.stitch_pages(spread_width_pts)?;// → new pipeline// Page inspectionlet boxes = PageBoxes::read(&doc, page_id)?;
boxes.trim_or_media()// TrimBox if present, else MediaBox
boxes.bleed_rect(9.0)// Expand trim by bleed amount// XMP provenance
let hash = xmp::hash_file(path)?;// sha256:<hex>let block = pipeline.read_xmp_block();// Option<RbaraXmpBlock>// Object tree (paths, images, text — full geometry + color)let tree = objects::tree::build_object_tree(doc, page_id)?;let plate_objs = objects::separation::filter_by_ink(&tree,&InkSelector::CmykChannel(CmykChannel::Cyan),);// Text outline extraction (requires "outline" feature)#[cfg(feature = "outline")]{use rustybara::outline::{outline_page_text, writer::glyphs_to_content_stream};let glyphs = outline_page_text(doc, page_id)?;let pdf_ops = glyphs_to_content_stream(&glyphs);// → PDF path operators}// Color space conversion (requires "color" feature)#[cfg(feature = "color")]{use rustybara::color::{ColorTransform,RenderingIntent, profiles};let transform = ColorTransform::new(&profiles::COATED_FOGRA_39,&profiles::COATED_GRACOL_2006,RenderingIntent::RelativeColorimetric,)?;
pipeline.convert_color_space(&transform)?;// Convert entire document}

Feature Flags

FlagWhat it enablesDefault
rasterpdfium-render, image, webp — page rasterization
outlinettf-parser — text outline / glyph-path extraction
colorrustybara-icc / lcms2 — ICC color management
wasmWebAssembly build gate
gpuReserved for future GPU renderer

Renderer Trait

Rendering is behind a trait for future GPU backend support:

pubtraitPageRenderer{fnrender(&self,page:&PdfPage,config:&RenderConfig)
-> Result<DynamicImage>;}pubstructCpuRenderer;// pdfium-render — ships today// pub struct GpuRenderer; // vello/wgpu — future work

Dependencies

CrateRole
lopdf 0.40PDF object graph manipulation
pdfium-render 0.9PDF rasterization via PDFium
image 0.25Bitmap encoding (JPEG, PNG, WebP, TIFF)
rayon 1.11Parallel page rendering
ttf-parser 0.25TrueType glyph outline extraction (outline feature)
uuid 1UUID v4 generation for XMP provenance
sha2 0.11SHA-256 source file hashing for XMP provenance
rustybara-icc 0.1ICC color management (optional, color feature)
lcms2 6.1Little CMS color engine (via rustybara-icc, color feature)

Runtime Requirement — PDFium

The render_page and save_page_image functions require the PDFium shared library at runtime. Place the appropriate binary alongside your executable:

PlatformFile
Windowspdfium.dll
macOSlibpdfium.dylib
Linuxlibpdfium.so

Pre-built binaries: pdfium-binaries

Note: End-users of the rbara binary do not need to do this manually — the pre-built installers bundle the matching pdfium for each platform. This requirement applies only when consuming rustybara as a library in your own Rust project.

Operations that do not rasterize (trim, resize, save_pdf, page_count, PageBoxes::read, build_object_tree, embed_metadata) work without PDFium.


rbara — CLI & TUI Binary

rbara is the interactive front-end for rustybara. It provides both a flag-based CLI for scripting and a TUI for guided workflows.

Keyboard Reference (TUI)

KeyAction
tTrim print marks
rResize to bleed
bAdd TrimBox
sSet MediaBox
gRotate pages
xExport to image
eExtract pages
pSplit pages
hStitch pages
mRemap colors
cConvert color space
kFlatten spot colors
lOutline text
/Output path
oToggle overwrite mode
fChange files
qQuit
EnterRun selected action
?Keyboard reference overlay

UX Model

The TUI follows an app-style keyboard model — arrow keys, Enter, Esc — designed for designers who have never used a terminal before. Vim-style bindings may be layered on as aliases in a future version.

File-first workflow: launch → select file or directory → commands become available. Directories auto-glob *.pdf files.


rbv — PDF Page Viewer

rbv is a prepress-focused PDF viewer built on Skia (OpenGL) + winit. It is designed for quick go/no-go QC decisions — bleed check, color space, spot ink declaration — not sub-pixel vector fidelity. Pages are rasterized by pdfium and displayed as a bitmap; the object tree layer adds wireframe, hit-testing, and color diagnostics on top.

rbv <file> [page] [--dpi <dpi>]

The initial preview renders at 72 DPI for fast startup, then a full-resolution render (at the specified DPI, default 300) replaces it in the background.

Keyboard Shortcuts

KeyAction
WToggle wireframe mode
OToggle prepress box overlays (bleed/trim/crop)
Ctrl + = / Ctrl + +Zoom in
Ctrl + -Zoom out
Ctrl + 0Reset zoom and pan
Ctrl + ScrollZoom toward cursor
Left dragPan
Left clickSelect object + sample color
H / / K / Previous page
L / / J / Next page
NgJump to page N (e.g. 5g)
Ctrl+Shift+DToggle debug overlay
Ctrl+Shift+EExport wireframe diagnostic PDF
EscExit

Wireframe Mode

W replaces the raster image with a vector outline view derived from the page's ObjectTree. Every path, image, and text block is drawn as a thin black stroke in page-space coordinates. The selected object receives a 2px blue highlight. Glyph outlines (extracted via outline_page_text) are drawn on top when available. Ctrl+Shift+E exports the wireframe geometry to a diagnostic PDF for cross-referencing with qpdf --qdf.

Color Diagnostics

Left-click any area to sample:

  • Pixel RGBA — what the monitor is displaying (sampled from the rasterized bitmap)
  • PDF color — the declared fill/stroke color of the hit object from the content stream (DeviceGray / DeviceRGB / DeviceCMYK / Separation)
  • ICC CMYK — the pixel RGB converted to CMYK via Little CMS 2 (destination: US Web Coated SWOP)

A crosshair marker is stored in PDF coordinates and projected to screen each frame, so it stays locked to the correct page position as you zoom and pan.

File Watching

rbv monitors the opened file via notify. When the file changes on disk (e.g. after an InDesign export), it automatically re-opens the document, rebuilds the object tree, and re-renders — supporting a save-and-preview loop without restarting.

IPC

rbara-gui can send commands to a running rbv instance (e.g. switch to a different file after processing). rbv accepts these via a local IPC channel when launched with --listen.


Known Limitations

LimitationNotes
sRGB rasterization onlyCMYK→sRGB via PDFium. ICC color transforms available via color feature for stream-level operations.
JPEG quality not configurableFixed encoder quality. --quality flag planned.
Spot color approximationPDFium renders spot inks as CMYK approximations.
No Form XObject ColorSpace pruningInherited limitation from content stream filtering.
rbv requires display serverNo headless preview. Graceful error on missing GPU.
rbv zoom qualityRaster-only rendering degrades past ~150–200% zoom. LOD tiling planned.
CFF / Type1 glyph outlinesttf-parser requires sfnt container; raw CFF fonts use a OTTO header shim with ongoing refinement.
Very large PDFs (~200 MB+)Hard-blocked on add in rbara-gui. See below.

Large file handling

rustybara opens PDFs eagerly: lopdf parses the entire object graph into memory on load, and the PDFium render path round-trips through a full document serialization. For very large files (roughly 200 MB and up, e.g. imposed print runs of hundreds of pages) this parse can take tens of seconds and consume multiple gigabytes of RAM — long enough to make the desktop app appear frozen.

We explored splitting large files into page-range chunks (processing each independently) and re-merging the results into a single output. It worked mechanically but didn't hold up as a real solution: chunking still pays the full parse cost, the merge re-materializes the whole document in memory, and neither approaches the performance of mature tools like Acrobat or PitStop, which use lazy/random-access parsing. That experiment has been removed.

For now, rbara-guihard-blocks files above a configurable size limit (default 200 MB, set in Settings → Behavior; 0 disables the limit at your own risk) and surfaces a clear warning rather than freezing. The underlying library operations remain available for callers who can afford the memory/time.

A proper fix — lazy/streaming parse and metadata extraction that never loads the whole document — is planned for a future release (see Roadmap).


Roadmap

  • ICC color management (color module via lcms2) — v0.1.2
  • CMYK→CMYK color remapping in content streams — v0.1.2
  • Cross-platform installers (Windows / macOS / Linux / Docker) with bundled pdfium — v0.1.3
  • GitHub Actions release pipeline (one tag → all installers + GHCR image) — v0.1.3
  • rbv GPU-accelerated page viewer (wgpu + winit) — v0.1.4
  • rbara-gui native desktop GUI (Tauri v2) — v0.1.4
  • Split Pages — divide spreads into individual panels at a configurable width — v0.1.5
  • Stitch Pages — combine panels back into spreads at a configurable spread width — v0.1.5
  • Extract Pages — extract arbitrary page ranges into a new PDF — v0.1.5
  • Flatten Spot Colors — flatten spot color inks to CMYK process — v0.1.5
  • Command bar (: mode) with chord shortcuts and live preview — v0.1.5
  • Page object tree with spatial hit-testing — v0.1.6
  • Wireframe mode in rbv (Skia/OpenGL renderer) — v0.1.6
  • Color diagnostics panel with ICC pixel sampling — v0.1.6
  • Outline Text — vectorize embedded TrueType glyphs to PDF path operators — v0.1.6
  • Plate separation filtering (filter_by_ink, InkSelector) — v0.1.6
  • Wireframe diagnostic PDF export — v0.1.6
  • File watching / live reload in rbv — v0.1.6
  • XMP provenance metadata embedding and reading (rbara: namespace) — v0.1.7
  • Tile rendering system in rbv for large pages — v0.1.7
  • Resizable panels and activity log in rbara-gui — v0.1.7
  • Rotate PDF (/Rotate page action) — v0.1.9
  • Set Media Box action — v0.1.9
  • Configurable JPEG/WebP export quality — v0.1.9
  • System / network print for fast proofs — v0.1.9
  • Fix: macOS rbv dock-icon / defunct process on exit (clean event_loop.exit() + child reaping) — v0.1.9
  • Fix: Windows rbv console window on launch (windows_subsystem) — v0.1.9
  • RGB→CMYK conversion (vector graphics + embedded images)
  • Spot color detection service
  • LOD-aware zoom tiling in rbv
  • PDF/X validation and preflight reports
  • Configurable JPEG quality (--quality flag)
  • Lazy / streaming PDF parsing for large files (remove the hard size block)

Contributing

cargo test --workspace
  • MSRV is Rust 1.85 (edition 2024). Do not raise this floor without discussion.
  • Targets:x86_64, aarch64, wasm32-unknown-unknown (via rustybara-wasm)
  • The TrimBox is always the source-of-truth reference box. It is never modified by any operation.
  • Public API additions require documentation and at least one integration test.
  • The app-style keyboard model is the UX baseline for rbara. Modal bindings are opt-in aliases only.

Cutting a release

Releases are fully automated by .github/workflows/release.yml. To cut a new version:

  1. Bump version in rbara/Cargo.toml (and rustybara/Cargo.toml if the lib changed).
  2. Commit and push.
  3. Tag and push the tag:
    git tag v0.1.7
    git push --tags
  4. The workflow will build the Windows installer, the Linux tarball, both macOS tarballs (Apple silicon + Intel), and the Docker image, then create a GitHub Release with all artifacts and a SHA256SUMS.txt attached.

Hyphenated compatibility-iteration tags such as v0.2.0-1 create a prerelease containing only the rbara CLI/TUI installers and Docker image. The GUI and ICC packages are left at their existing versions. Tags without a hyphen continue to produce the full release suite.

The pdfium chromium build is pinned via PDFIUM_CHROMIUM env var in the workflow (currently 7776). Bump it there to refresh pdfium across all artifacts in lockstep.


Playground

Try rustybara-wasm live in the browser at rustybara.com/playground. Upload a PDF or use a sample file — trim, resize, and remap CMYK values entirely client-side via WebAssembly. No account, no upload, no server.


License

The LGPL license on the library allows downstream tools to link against rustybara without copyleft obligations on their own code, while the binaries remain fully copyleft.

Copyright (c) 2026 Addy Alvarado

capybara chillin

About

Rust library, interactive CLI, and desktop GUI for prepress PDF work — trim printer marks, manage bleed, rasterize pages, and more. A free, open-source alternative to proprietary prepress tools.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Repository files navigation

Rustybara logo

Rustybara

Prepress-focused PDF manipulation toolkit for graphic designers and print operators.

Crates.ioDownloadsDocumentationLicense


Rustybara dashboard

Rustybara is the convergence of three standalone prepress CLI tools into a unified Rust library and interactive toolset, built on the same primitives those tools proved in production:

Origin ToolPrimitive
pdf-mark-removalContent stream filtering, CTM math
resize_to_bleed_or_trim_pdfPage box geometry (MediaBox, TrimBox, BleedBox)
pdf-2-imagePDF rasterization and image encoding

It ships as a library crate (rustybara), a CLI/TUI binary (rbara), and a GPU-accelerated PDF page viewer (rbv).


Workspace

CrateDescriptionLicense
rustybaraCore PDF manipulation libraryLGPLv3
rustybara-iccICC color management — 22 bundled profilesLGPLv3
rustybara-wasmWebAssembly bindings — browser, Node.js, edgeLGPLv3
rbaraTerminal UI (Ratatui TUI)GPLv3
rbara-guiNative desktop GUI (Tauri v2)GPLv3
rbvPrepress PDF viewer (Skia + OpenGL + winit)GPLv3

Features

Featurerustybararustybara-iccrustybara-wasm
Page trim & resize
CMYK remap
Split / stitch pages
Extract page ranges
Flatten spot colors
Rasterization (pdfium)
XMP metadata embed & read
Page object tree + hit-testing
Plate separation filtering
Outline text (glyph → paths)
ICC color transforms
WebAssembly / browser
Node.js / edge runtime
  • Pipeline API — Chain operations fluently: open → trim → resize → remap → save.
  • Batch processing — Process entire directories of PDFs from CLI or TUI.
  • Interactive TUI — App-style terminal interface for designers who prefer guided workflows over raw CLI flags. Configurable output directory.
  • Prepress vocabulary — Every API surface speaks in boxes, bleeds, and DPI — not generic PDF primitives.

Installation

Pre-built installers for rbara (the CLI/TUI binary) are published with each release. Each installer bundles its own pdfium runtime — no system pdfium needed.

Windows

Download rbara-setup-<version>-x64.exe from the Releases page and run it. This is a per-user Inno Setup installer (no admin required) that installs to %LOCALAPPDATA%\Programs\rbara\, registers an opt-in PATH entry, and adds an Add/Remove Programs entry. SmartScreen may warn the first time — the binary is currently unsigned.

macOS

# Apple silicon
tar -xzf rbara-<version>-macos-arm64.tar.gz &&cd rbara-<version>-macos-arm64
./install.sh # installs to ~/.local# Intel
tar -xzf rbara-<version>-macos-x86_64.tar.gz &&cd rbara-<version>-macos-x86_64
./install.sh

The bundle is unsigned; install.sh strips the com.apple.quarantine attribute automatically. To uninstall: ./uninstall.sh.

Linux (glibc x86_64)

tar -xzf rbara-<version>-linux-x64.tar.gz &&cd rbara-<version>-linux-x64
./install.sh # ~/.local
sudo PREFIX=/usr/local ./install.sh # system-wide

Tested on Ubuntu 22.04+, Debian 12+, Fedora 38+, RHEL 9+, Arch, openSUSE Tumbleweed. Musl distros (Alpine) need a source build. To uninstall: ./uninstall.sh.

Docker

docker pull ghcr.io/addy-a/rbara:latest
# CLI usage — bind-mount your working directory
docker run --rm -v "$PWD:/work" ghcr.io/addy-a/rbara:latest \
trim /work/in.pdf -o /work/out.pdf

The image is ~175 MB (debian:bookworm-slim base) and runs as a non-root user.

Building from source

See the Contributing section. The maintainer-side installer scripts live in installer/ (one subdir per platform, each with its own README).


Quick Start

As a library

Add to your Cargo.toml:

[dependencies]
rustybara = "0.1"
use rustybara::PdfPipeline;fnmain() -> rustybara::Result<()>{// Trim marks, resize to 9pt bleed, savePdfPipeline::open("input.pdf")?
.trim()?
.resize(9.0)?
.split_pages(5.83*72.0)? // split spreads into 5.83" panels.save_pdf("output.pdf")?;Ok(())}

Rasterize a page

use rustybara::{PdfPipeline, encode::OutputFormat, raster::RenderConfig};fnmain() -> rustybara::Result<()>{let pipeline = PdfPipeline::open("input.pdf")?;let config = RenderConfig::prepress();// 300 DPI
pipeline.save_page_image(0,"page_1.jpg",&OutputFormat::Jpg,&config)?;Ok(())}

Embed XMP provenance metadata

use rustybara::{PdfPipeline, xmp};fnmain() -> rustybara::Result<()>{let source_hash = xmp::hash_file(std::path::Path::new("input.pdf"))?;let timestamp = "2026-05-28T12:00:00Z".to_string();PdfPipeline::open("input.pdf")?
.trim()?
.resize(9.0)?
.embed_metadata(&source_hash,&timestamp,&[("trim",""),("resize","bleed_pts=9")])?
.save_pdf("output.pdf")?;Ok(())}

Inspect the page object tree

use rustybara::{PdfPipeline, objects::tree::build_object_tree};fnmain() -> rustybara::Result<()>{let pipeline = PdfPipeline::open("input.pdf")?;let page_id = pipeline.doc().get_pages()[&1];let tree = build_object_tree(pipeline.doc(), page_id)?;for obj in&tree.objects{println!("{:?} bbox={:?}", obj.kind, obj.bbox);}Ok(())}

CLI

# Trim print marks
rbara trim input.pdf
# Resize to 1/8-inch bleed (--bleed remains available for point-based scripts)
rbara resize --bleed-inches 0.125 input.pdf
# Add a TrimBox, set page size, or rotate pages
rbara add-trim-box --bleed-inches 0.125 input.pdf
rbara set-media-box --width-inches 8.5 --height-inches 11 input.pdf
rbara rotate --degrees 90 input.pdf
# Export pages as 300 DPI PNGs at quality 90
rbara image --format png --dpi 300 --quality 90 input.pdf
# Extract, split, or stitch pages
rbara extract-pages --pages "1,3-5" input.pdf
rbara split-pages --panel-width 5.83 input.pdf
rbara split-pages --panel-widths 3.625,3.6875,3.6875 --axis horizontal input.pdf
rbara stitch-pages --spread-width 8.5 input.pdf
# Remap a CMYK color (rich black → 60/40/20/100)
rbara remap-color --from 1.0 1.0 1.0 1.0 --to 0.6 0.4 0.2 1.0 input.pdf
# Convert or flatten colors, and outline text
rbara convert-color-space --from-profile AdobeRGB1998 --to-profile USWebCoatedSWOP input.pdf
rbara flatten-spots input.pdf
rbara outline-text input.pdf
# Inspect page boxes, document color usage, and Rustybara provenance
rbara info input.pdf

Every PDF-writing command accepts multiple input files, --output <DIR>, and --overwrite. Without --overwrite, outputs receive an operation suffix such as _processed, _extracted, _split, or _stitch. Image export never overwrites a PDF source and also supports --annotations and --forms.

split-pages --panel-widths accepts an ordered, comma-separated plan containing at least two positive sizes in inches. The sizes must total the source page's TrimBox extent (within half a PDF point). --axis horizontal emits panels left to right; --axis vertical emits them bottom to top. The existing singular --panel-width behavior remains unchanged and defaults to the horizontal axis. PDF outputs include a Rustybara XMP provenance block.

TUI

Launch rbara with no arguments to enter the interactive terminal interface:

rbara

Arrow keys navigate, Enter selects, and Esc goes back. The menu scrolls on smaller terminals; press ? for the full keyboard reference.


rustybara-wasm

WebAssembly bindings for rustybara. Run PDF manipulation in any JavaScript or TypeScript environment — browser, Node.js, Deno, or Cloudflare Workers — with no native dependencies.

Exposes the pure-Rust pipeline subset:

  • trim() — strip content outside TrimBox
  • resize(bleed_pts) — expand page boxes by a bleed margin
  • split_pages_explicit(panel_widths_pts, axis) — split panels by exact widths
  • remap_color(from, to, tolerance) — substitute CMYK values in content streams
  • to_pdf_bytes() — serialize result as bytes for download or further processing

Rasterization (pdfium), object tree rendering, and ICC color transforms (lcms2) require the native crate and are not available in the wasm build. XMP provenance metadata is supported by the WASM package.

Browser quickstart

importinit,{PipelineHandle}from'./pkg/rustybara_wasm.js'awaitinit('./pkg/rustybara_wasm_bg.wasm')constbytes=newUint8Array(awaitfetch('input.pdf').then((r)=>r.arrayBuffer()),)lethandle=newPipelineHandle(bytes)handle=handle.trim()handle=handle.resize(8.504)constresult=handle.to_pdf_bytes()

Build

cd rustybara-wasm
wasm-pack build --target web --out-dir pkg --release

npm

The Node.js package is built as rustybara-wasm, with generated TypeScript declarations and no native runtime dependency. After the first registry release:

npm install rustybara-wasm
constfs=require('node:fs')const{ PanelAxis, PipelineHandle }=require('rustybara-wasm')constinput=fs.readFileSync('input.pdf')constpdf=newPipelineHandle(input).split_pages_explicit(Float64Array.from([261,265.5,265.5]),PanelAxis.Vertical,)fs.writeFileSync('output.pdf',pdf.to_pdf_bytes())

See rustybara-wasm/README.md for the complete Node API and local packaging instructions. The browser build remains available via the rustybara playground.


Architecture

Module Map

rustybara/src/
lib.rs — Public re-exports
pipeline.rs — PdfPipeline: high-level chaining API
error.rs — Unified error type
xmp.rs — XMP metadata embedding, reading, and SHA-256 provenance hashing
geometry/
rect.rs — Rect (position + dimensions, PDF coordinate system)
matrix.rs — Matrix (2D affine CTM transformations)
pages/
boxes.rs — PageBoxes: TrimBox, MediaBox, BleedBox, CropBox reader
split.rs — Page extraction and splitting utilities
stitch.rs — Spread stitching utilities
layout.rs — Page layout helpers
stream/
filter.rs — ContentFilter: CTM-walking content stream filter
color_ops.rs — ColorRemap: CMYK→CMYK value substitution in content streams
objects/
tree.rs — build_object_tree: full page object list (paths, images, text)
with color, CTM, overprint state, and subpath geometry
hittest.rs — Spatial hit-testing against the ObjectTree
separation.rs — filter_by_ink: plate isolation by CMYK channel or spot name
outline/ — (feature-gated: "outline")
font.rs — Extract raw font bytes from PDF resource dictionaries
encoding.rs — Resolve character codes to GlyphId
paths.rs — outline_page_text: walk content stream → per-glyph path geometry
writer.rs — glyphs_to_content_stream: serialize glyphs back to PDF operators
raster/
render.rs — PageRenderer trait, CpuRenderer (pdfium-render)
config.rs — RenderConfig (DPI, annotation toggles)
encode/
save.rs — OutputFormat enum, image encoding (JPG/PNG/WebP/TIFF)
color/ — (feature-gated: "color")
icc.rs — Re-exports from rustybara-icc crate
transform.rs — Re-exports from rustybara-icc crate
rustybara-icc/src/ (separate crate, optionally used via "color" feature)
lib.rs — ICC color management engine
color_space.rs — ColorSpaceKind enum (CMYK, RGB, Gray, Lab)
error.rs — IccError type for color operations
intent.rs — RenderingIntent enum for ICC transforms
pixel_format.rs — PixelFormat enum (RGB8, CMYK8, etc.)
transform.rs — ColorTransform: pixel-level ICC profile transforms
pdf.rs — PdfColorConverter: document-level color space conversion
profiles/ — Bundled ICC profiles (FOGRA39, GRACoL2006, etc.)

Public API

rustybara is a high-level, prepress-scoped crate. The public API speaks in prepress vocabulary:

// Prepress operationsPdfPipeline::open(path)?
.trim()? // Remove content outside TrimBox.resize(bleed_pts)? // Expand page boxes by bleed margin.remap_color(from, to, tolerance)? // Substitute CMYK values.add_trim_box(bleed_pts)? // Inset MediaBox to set a TrimBox.embed_metadata(hash, ts, ops)? // Embed rbara: XMP provenance block.save_pdf(path)?;// Write the result// Rasterization
pipeline.render_page(0,&config)?;// → DynamicImage
pipeline.save_page_image(0, path,&format,&config)?;// → file// Page operationslet new_pipeline = pipeline.extract_pages(&[0,2,4])?;// → new pipelinelet spreads = pipeline.split_pages(panel_width_pts)?;// → new pipelinelet panels = pipeline.split_pages_explicit(&[261.0,265.5,265.5],
rustybara::pages::SplitAxis::Horizontal,)?;// → new pipelinelet stitched = pipeline.stitch_pages(spread_width_pts)?;// → new pipeline// Page inspectionlet boxes = PageBoxes::read(&doc, page_id)?;
boxes.trim_or_media()// TrimBox if present, else MediaBox
boxes.bleed_rect(9.0)// Expand trim by bleed amount// XMP provenance
let hash = xmp::hash_file(path)?;// sha256:<hex>let block = pipeline.read_xmp_block();// Option<RbaraXmpBlock>// Object tree (paths, images, text — full geometry + color)let tree = objects::tree::build_object_tree(doc, page_id)?;let plate_objs = objects::separation::filter_by_ink(&tree,&InkSelector::CmykChannel(CmykChannel::Cyan),);// Text outline extraction (requires "outline" feature)#[cfg(feature = "outline")]{use rustybara::outline::{outline_page_text, writer::glyphs_to_content_stream};let glyphs = outline_page_text(doc, page_id)?;let pdf_ops = glyphs_to_content_stream(&glyphs);// → PDF path operators}// Color space conversion (requires "color" feature)#[cfg(feature = "color")]{use rustybara::color::{ColorTransform,RenderingIntent, profiles};let transform = ColorTransform::new(&profiles::COATED_FOGRA_39,&profiles::COATED_GRACOL_2006,RenderingIntent::RelativeColorimetric,)?;
pipeline.convert_color_space(&transform)?;// Convert entire document}

Feature Flags

FlagWhat it enablesDefault
rasterpdfium-render, image, webp — page rasterization
outlinettf-parser — text outline / glyph-path extraction
colorrustybara-icc / lcms2 — ICC color management
wasmWebAssembly build gate
gpuReserved for future GPU renderer

Renderer Trait

Rendering is behind a trait for future GPU backend support:

pubtraitPageRenderer{fnrender(&self,page:&PdfPage,config:&RenderConfig)
-> Result<DynamicImage>;}pubstructCpuRenderer;// pdfium-render — ships today// pub struct GpuRenderer; // vello/wgpu — future work

Dependencies

CrateRole
lopdf 0.40PDF object graph manipulation
pdfium-render 0.9PDF rasterization via PDFium
image 0.25Bitmap encoding (JPEG, PNG, WebP, TIFF)
rayon 1.11Parallel page rendering
ttf-parser 0.25TrueType glyph outline extraction (outline feature)
uuid 1UUID v4 generation for XMP provenance
sha2 0.11SHA-256 source file hashing for XMP provenance
rustybara-icc 0.1ICC color management (optional, color feature)
lcms2 6.1Little CMS color engine (via rustybara-icc, color feature)

Runtime Requirement — PDFium

The render_page and save_page_image functions require the PDFium shared library at runtime. Place the appropriate binary alongside your executable:

PlatformFile
Windowspdfium.dll
macOSlibpdfium.dylib
Linuxlibpdfium.so

Pre-built binaries: pdfium-binaries

Note: End-users of the rbara binary do not need to do this manually — the pre-built installers bundle the matching pdfium for each platform. This requirement applies only when consuming rustybara as a library in your own Rust project.

Operations that do not rasterize (trim, resize, save_pdf, page_count, PageBoxes::read, build_object_tree, embed_metadata) work without PDFium.


rbara — CLI & TUI Binary

rbara is the interactive front-end for rustybara. It provides both a flag-based CLI for scripting and a TUI for guided workflows.

Keyboard Reference (TUI)

KeyAction
tTrim print marks
rResize to bleed
bAdd TrimBox
sSet MediaBox
gRotate pages
xExport to image
eExtract pages
pSplit pages
hStitch pages
mRemap colors
cConvert color space
kFlatten spot colors
lOutline text
/Output path
oToggle overwrite mode
fChange files
qQuit
EnterRun selected action
?Keyboard reference overlay

UX Model

The TUI follows an app-style keyboard model — arrow keys, Enter, Esc — designed for designers who have never used a terminal before. Vim-style bindings may be layered on as aliases in a future version.

File-first workflow: launch → select file or directory → commands become available. Directories auto-glob *.pdf files.


rbv — PDF Page Viewer

rbv is a prepress-focused PDF viewer built on Skia (OpenGL) + winit. It is designed for quick go/no-go QC decisions — bleed check, color space, spot ink declaration — not sub-pixel vector fidelity. Pages are rasterized by pdfium and displayed as a bitmap; the object tree layer adds wireframe, hit-testing, and color diagnostics on top.

rbv <file> [page] [--dpi <dpi>]

The initial preview renders at 72 DPI for fast startup, then a full-resolution render (at the specified DPI, default 300) replaces it in the background.

Keyboard Shortcuts

KeyAction
WToggle wireframe mode
OToggle prepress box overlays (bleed/trim/crop)
Ctrl + = / Ctrl + +Zoom in
Ctrl + -Zoom out
Ctrl + 0Reset zoom and pan
Ctrl + ScrollZoom toward cursor
Left dragPan
Left clickSelect object + sample color
H / / K / Previous page
L / / J / Next page
NgJump to page N (e.g. 5g)
Ctrl+Shift+DToggle debug overlay
Ctrl+Shift+EExport wireframe diagnostic PDF
EscExit

Wireframe Mode

W replaces the raster image with a vector outline view derived from the page's ObjectTree. Every path, image, and text block is drawn as a thin black stroke in page-space coordinates. The selected object receives a 2px blue highlight. Glyph outlines (extracted via outline_page_text) are drawn on top when available. Ctrl+Shift+E exports the wireframe geometry to a diagnostic PDF for cross-referencing with qpdf --qdf.

Color Diagnostics

Left-click any area to sample:

  • Pixel RGBA — what the monitor is displaying (sampled from the rasterized bitmap)
  • PDF color — the declared fill/stroke color of the hit object from the content stream (DeviceGray / DeviceRGB / DeviceCMYK / Separation)
  • ICC CMYK — the pixel RGB converted to CMYK via Little CMS 2 (destination: US Web Coated SWOP)

A crosshair marker is stored in PDF coordinates and projected to screen each frame, so it stays locked to the correct page position as you zoom and pan.

File Watching

rbv monitors the opened file via notify. When the file changes on disk (e.g. after an InDesign export), it automatically re-opens the document, rebuilds the object tree, and re-renders — supporting a save-and-preview loop without restarting.

IPC

rbara-gui can send commands to a running rbv instance (e.g. switch to a different file after processing). rbv accepts these via a local IPC channel when launched with --listen.


Known Limitations

LimitationNotes
sRGB rasterization onlyCMYK→sRGB via PDFium. ICC color transforms available via color feature for stream-level operations.
JPEG quality not configurableFixed encoder quality. --quality flag planned.
Spot color approximationPDFium renders spot inks as CMYK approximations.
No Form XObject ColorSpace pruningInherited limitation from content stream filtering.
rbv requires display serverNo headless preview. Graceful error on missing GPU.
rbv zoom qualityRaster-only rendering degrades past ~150–200% zoom. LOD tiling planned.
CFF / Type1 glyph outlinesttf-parser requires sfnt container; raw CFF fonts use a OTTO header shim with ongoing refinement.
Very large PDFs (~200 MB+)Hard-blocked on add in rbara-gui. See below.

Large file handling

rustybara opens PDFs eagerly: lopdf parses the entire object graph into memory on load, and the PDFium render path round-trips through a full document serialization. For very large files (roughly 200 MB and up, e.g. imposed print runs of hundreds of pages) this parse can take tens of seconds and consume multiple gigabytes of RAM — long enough to make the desktop app appear frozen.

We explored splitting large files into page-range chunks (processing each independently) and re-merging the results into a single output. It worked mechanically but didn't hold up as a real solution: chunking still pays the full parse cost, the merge re-materializes the whole document in memory, and neither approaches the performance of mature tools like Acrobat or PitStop, which use lazy/random-access parsing. That experiment has been removed.

For now, rbara-guihard-blocks files above a configurable size limit (default 200 MB, set in Settings → Behavior; 0 disables the limit at your own risk) and surfaces a clear warning rather than freezing. The underlying library operations remain available for callers who can afford the memory/time.

A proper fix — lazy/streaming parse and metadata extraction that never loads the whole document — is planned for a future release (see Roadmap).


Roadmap

  • ICC color management (color module via lcms2) — v0.1.2
  • CMYK→CMYK color remapping in content streams — v0.1.2
  • Cross-platform installers (Windows / macOS / Linux / Docker) with bundled pdfium — v0.1.3
  • GitHub Actions release pipeline (one tag → all installers + GHCR image) — v0.1.3
  • rbv GPU-accelerated page viewer (wgpu + winit) — v0.1.4
  • rbara-gui native desktop GUI (Tauri v2) — v0.1.4
  • Split Pages — divide spreads into individual panels at a configurable width — v0.1.5
  • Stitch Pages — combine panels back into spreads at a configurable spread width — v0.1.5
  • Extract Pages — extract arbitrary page ranges into a new PDF — v0.1.5
  • Flatten Spot Colors — flatten spot color inks to CMYK process — v0.1.5
  • Command bar (: mode) with chord shortcuts and live preview — v0.1.5
  • Page object tree with spatial hit-testing — v0.1.6
  • Wireframe mode in rbv (Skia/OpenGL renderer) — v0.1.6
  • Color diagnostics panel with ICC pixel sampling — v0.1.6
  • Outline Text — vectorize embedded TrueType glyphs to PDF path operators — v0.1.6
  • Plate separation filtering (filter_by_ink, InkSelector) — v0.1.6
  • Wireframe diagnostic PDF export — v0.1.6
  • File watching / live reload in rbv — v0.1.6
  • XMP provenance metadata embedding and reading (rbara: namespace) — v0.1.7
  • Tile rendering system in rbv for large pages — v0.1.7
  • Resizable panels and activity log in rbara-gui — v0.1.7
  • Rotate PDF (/Rotate page action) — v0.1.9
  • Set Media Box action — v0.1.9
  • Configurable JPEG/WebP export quality — v0.1.9
  • System / network print for fast proofs — v0.1.9
  • Fix: macOS rbv dock-icon / defunct process on exit (clean event_loop.exit() + child reaping) — v0.1.9
  • Fix: Windows rbv console window on launch (windows_subsystem) — v0.1.9
  • RGB→CMYK conversion (vector graphics + embedded images)
  • Spot color detection service
  • LOD-aware zoom tiling in rbv
  • PDF/X validation and preflight reports
  • Configurable JPEG quality (--quality flag)
  • Lazy / streaming PDF parsing for large files (remove the hard size block)

Contributing

cargo test --workspace
  • MSRV is Rust 1.85 (edition 2024). Do not raise this floor without discussion.
  • Targets:x86_64, aarch64, wasm32-unknown-unknown (via rustybara-wasm)
  • The TrimBox is always the source-of-truth reference box. It is never modified by any operation.
  • Public API additions require documentation and at least one integration test.
  • The app-style keyboard model is the UX baseline for rbara. Modal bindings are opt-in aliases only.

Cutting a release

Releases are fully automated by .github/workflows/release.yml. To cut a new version:

  1. Bump version in rbara/Cargo.toml (and rustybara/Cargo.toml if the lib changed).
  2. Commit and push.
  3. Tag and push the tag:
    git tag v0.1.7
    git push --tags
  4. The workflow will build the Windows installer, the Linux tarball, both macOS tarballs (Apple silicon + Intel), and the Docker image, then create a GitHub Release with all artifacts and a SHA256SUMS.txt attached.

Hyphenated compatibility-iteration tags such as v0.2.0-1 create a prerelease containing only the rbara CLI/TUI installers and Docker image. The GUI and ICC packages are left at their existing versions. Tags without a hyphen continue to produce the full release suite.

The pdfium chromium build is pinned via PDFIUM_CHROMIUM env var in the workflow (currently 7776). Bump it there to refresh pdfium across all artifacts in lockstep.


Playground

Try rustybara-wasm live in the browser at rustybara.com/playground. Upload a PDF or use a sample file — trim, resize, and remap CMYK values entirely client-side via WebAssembly. No account, no upload, no server.


License

The LGPL license on the library allows downstream tools to link against rustybara without copyleft obligations on their own code, while the binaries remain fully copyleft.

Copyright (c) 2026 Addy Alvarado

capybara chillin

About

Rust library, interactive CLI, and desktop GUI for prepress PDF work — trim printer marks, manage bleed, rasterize pages, and more. A free, open-source alternative to proprietary prepress tools.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages