Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

PDFx

An all-in-one PDF toolkit in Rust: view, organize, edit, annotate, sign, convert, OCR, compress and secure PDFs — as a desktop app and a CLI.

See PLAN.md for the roadmap. Status: Phase 10 (polish, accessibility and distribution) complete. What it doesn't do yet is listed in docs/KNOWN_LIMITS.md.

Layout

Path What
crates/pdf-core Document model and every operation. No UI, no rendering.
crates/pdf-sign Digital signatures: PKCS#12 identities, PAdES signing, timestamps, verification.
crates/pdf-convert Layout analysis and conversions: text, Markdown, HTML, Word, tables, images; Office/web to PDF.
crates/pdf-ocr OCR: scan cleanup, Tesseract and built-in engines, searchable text layers.
crates/pdf-automate Pipelines and presets, batch processing, watch folders, Rhai scripts, local-model assistant.
crates/pdf-render Page rendering behind a Renderer trait (PDFium backend).
crates/pdf-cli The pdfx command-line tool.
app/ Tauri 2 desktop app (SvelteKit frontend in app/src, Rust in app/src-tauri).
scripts/ Dev tooling (PDFium download).
corpus/ Notes on the test corpus; real-world files go in corpus/local/ (ignored).

New features land in pdf-core first, are exposed through pdfx, then get UI.

Getting started

Requires Rust 1.90+, and Node 20+ for the app.

# 1. PDFium (needed for rendering; info and page operations work without it)
./scripts/fetch-pdfium.sh          # or: pwsh scripts/fetch-pdfium.ps1

# 2. CLI
cargo run -p pdfx -- info some.pdf
cargo run -p pdfx -- info some.pdf --json
cargo run -p pdfx -- render some.pdf -p 1-3 --dpi 150 -o out/
cargo run -p pdfx -- merge a.pdf b.pdf:1-3,r1 --bookmarks per-file -o merged.pdf
cargo run -p pdfx -- split book.pdf --bookmarks -o chapters/
cargo run -p pdfx -- rotate scan.pdf -p even -a 180 --in-place
cargo run -p pdfx -- highlight report.pdf --text "revenue" --comment "check" -o marked.pdf
cargo run -p pdfx -- bookmarks generate report.pdf --in-place
cargo run -p pdfx -- objects report.pdf --page 1          # text lines, images, paths with ids
cargo run -p pdfx -- replace report.pdf --find 2023 --replace 2024 --in-place
cargo run -p pdfx -- edit-text report.pdf --line "Draft" --text "Final" --in-place
cargo run -p pdfx -- watermark report.pdf --text CONFIDENTIAL --layer Watermark -o marked.pdf
cargo run -p pdfx -- page-numbers report.pdf --format "Page {page} of {pages}" --in-place
cargo run -p pdfx -- metadata set report.pdf --title "Annual report" --in-place
cargo run -p pdfx -- form fill w9.pdf --set name=Ada --set agree=yes -o filled.pdf
cargo run -p pdfx -- mail-merge letter.pdf --data people.csv --name "{n}-{Name}" -o out/
cargo run -p pdfx -- cert create --name "Ada Lovelace" --password pw -o ada.p12 --pem ada.pem
cargo run -p pdfx -- sign filled.pdf --cert ada.p12 --rect 72,650,200,40 --timestamp http://timestamp.digicert.com -o signed.pdf
cargo run -p pdfx -- verify signed.pdf --trust ada.pem
cargo run -p pdfx -- convert paper.pdf -o paper.docx      # also .md .html .txt .xlsx .csv .png .tif
cargo run -p pdfx -- convert notes.md photo.jpg deck.pptx https://example.com -o bundle.pdf
cargo run -p pdfx -- tables report.pdf -o tables.xlsx
cargo run -p pdfx -- images report.pdf -o images/                # embedded images, original format
cargo run -p pdfx -- ocr-status scan.pdf                      # which pages need OCR
cargo run -p pdfx -- ocr scan.pdf --lang eng -o searchable.pdf
cargo run -p pdfx -- clean-scan scan.pdf --bw --despeckle -o clean.pdf
cargo run -p pdfx -- run email scans/ -r -o small/          # built-in preset on a folder
cargo run -p pdfx -- batch -s "ocr" -s "compress images=screen" --name "{date}-{stem}" in/
cargo run -p pdfx -- run my-pipeline.toml in/ --jobs 4 --json
cargo run -p pdfx -- watch archive inbox/ --move-to Originals   # process files dropped in
cargo run -p pdfx -- pipeline steps                           # step types with TOML examples
cargo run -p pdfx -- ai ask report.pdf "What is the deadline?"  # needs a local model server
cargo run -p pdfx -- --help        # all commands

# 3. Tests (fast: the Tauri app is excluded from default members)
cargo test

# 4. Desktop app
cd app && npm install && npm run tauri dev

# 5. Installers (see docs/RELEASING.md)
cd app && npm run tauri build

In the app, Ctrl+K (⌘K on macOS) searches every command and recent file, F1 lists the keyboard shortcuts and Ctrl+, opens Settings (language, read-aloud voice, File Explorer actions, updates, problem reports). The interface is in English, German and Spanish; translations live in app/src/lib/locales/, and keys missing from a language fall back to English. Open documents and reading positions come back at the next start.

pdfx-app [--merge | --compress | --convert] files… opens files in the running window (File Explorer's right-click actions use these flags).

Office documents are converted with LibreOffice and web pages with Chrome, Edge or Chromium when installed (PDFX_SOFFICE / PDFX_BROWSER override the search).

OCR uses an installed Tesseract when there is one (PDFX_TESSERACT points at it), otherwise a built-in engine for English whose models are downloaded once (PDFX_OCR_MODELS sets where they live).

Pipelines saved in the app run with pdfx run "<name>" too: presets and the assistant settings live in %APPDATA%\pdfx (Windows), ~/Library/Application Support/pdfx (macOS) or ~/.config/pdfx (PDFX_CONFIG_DIR overrides it). The assistant talks to an OpenAI-compatible model server you run, by default Ollama on http://localhost:11434/v1 (PDFX_AI_ENDPOINT, PDFX_AI_MODEL).

PDFium is looked up in $PDFIUM_PATH, the app's bundled resources, next to the executable, in vendor/pdfium/, then on the system library path.

To profile large documents: cargo run --release -p pdf-render --example profile -- 5000 builds a 5000-page document and times opening, the per-edit summary, an edit with undo, rendering, search and saving.

New text is set in the standard PDF fonts when they can show it, and otherwise in an installed font (found with fontdb) embedded as a subset. pdfx fonts lists the families available; PDFX_NO_SYSTEM_FONTS=1 skips the system font scan.

Page selection syntax

Used by every command that takes pages:

Example Meaning
1-5,8,10-end ranges and single pages (end = last)
5-1 reversed
r1, r3-r1 counted from the end (r1 is the last page)
odd, even, all parity
1-20:even parity filter on a range

Checks

cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings
cargo deny check                    # license/advisory policy in deny.toml
cd app && npm run check && npm test # frontend types and unit tests

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages