返回资讯中心
外部精选
软件工程
#开发者实时流

PdfCraft: An open-source PDF reader and editor written from scratch in pure Rust

The PDF workbench; an open-source, clean-room reimplementation of Adobe Acrobat, rebuilt in pure Rust.

Hacker News 最新sexy_seedbox2026/10/15 · 2026/10/1530 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

The PDF workbench; an open-source, clean-room reimplementation of Adobe Acrobat, rebuilt in pure Rust.

Read, organize, combine, split and secure PDFs in a fast, native app, written in Rust from the ground up.

macOS · Windows · Linux · FreeBSD · the web

PdfCraft on getartcraft.com · ArtCraft · All Crafting Apps

The PdfCraft Showcase, a 13-page specimen PDF, open with the All tools panel and threaded comments.

ArtCraft is a community of artists from all walks of life. Digital, generative, music, games — if you make things, you're one of us. Come say hi on Discord.

Highlights · Read · Find · Organize · Combine & split · Protect · Forms & layers · Everywhere · Agents · How it's built · Get started · What's next · Downloads · Crafting Apps

PdfCraft is part of ArtCraft. Come say hello, get help and follow development:

The ArtCraft name and logos in docs/brand/ are trademarks of the ArtCraft Team and are not open source. They may be used only unmodified, and only as part of PdfCraft (see docs/brand/LICENSE-brand.txt). Forks and modified versions must remove them.

Faithful

Real-world typography: world scripts, vertical Japanese, colour emoji, gradients, soft masks and transparency. All of it renders the way the author intended.

Every save appends your changes and leaves the original bytes untouched. Writes are atomic, undo runs deep, and nothing is lost if you close by mistake.

No account, no telemetry, no cloud. It works offline and opens instantly. The engine, CLI and app are all open source.

PdfCraft renders PDFs with care for the details that make a page feel right: kerning and ligatures, right-to-left and complex scripts, vertical CJK, colour emoji, shadings, blend modes, soft masks and optional content.

Twelve writing systems on one page, plus vertical Japanese, at 125%.

Search the whole document as you type, step through matches with ⌘G, and select text that comes out in the right reading order. That holds for columns, right-to-left runs and CJK too.

Right-click a PDF tab to close it, reopen the last closed file-backed tab, or reveal its file. Closing still asks about unsaved changes. Reopening reads the saved file from disk; it does not restore discarded edits. Reveal selects the file in Explorer or Finder. On Linux and FreeBSD it requests org.freedesktop.FileManager1.ShowItems, falling back to opening the containing directory with xdg-open when that service is unavailable. Reopen and Reveal are unavailable on the web; Reveal is also unavailable for pathless documents.

Bookmarks, page thumbnails and the document's own page labels (i, ii, 1, 2…) keep you oriented in long documents. Search bookmark titles in the Bookmarks panel to find nested entries even when their parents are collapsed. Matches keep their ancestors for context; Clear restores the unfiltered tree without changing its expansion state.

Open Organize pages to see every page at once:

Organize pages with three pages selected and the page tools in the toolbar above.

Undo that goes the distance. Each change is one step in a history you can walk backwards and forwards. The Edit menu names the step ("Undo Rotate pages"), and undo still works after you save.

When open documents exceed the window width, scroll over the tab strip with the mouse wheel or trackpad, or use its horizontal scrollbar. Opening or switching to a document brings its tab into view.

Unsaved documents carry a dot on their tab, and closing or quitting asks before anything is lost. Changes are autosaved every minute. If PdfCraft ever quits unexpectedly, it offers to recover your work the next time it opens. Encrypted documents stay encrypted on disk.

Combine files merges any number of PDFs into one. Each file gets a bookmark, with its own bookmarks nested underneath.

Extract copies the pages you select into a new document. Split divides a document every n pages, or before the pages you choose.

Nothing quietly disappears along the way:

Every page of a combined document renders pixel-identical to its source.

pdfcraft-cli combine report.pdf appendix.pdf --out combined.pdf pdfcraft-cli extract report.pdf --pages 1,3,5-8 --out highlights.pdf pdfcraft-cli split report.pdf --every 10 --out-dir parts/

Open protected documents and respect their rules

PdfCraft implements the PDF standard security handler completely:

Documents restricted by their author show a clear notice, and PdfCraft honours their permissions. Enter the owner password and the restrictions lift. Edits to encrypted documents are saved encrypted, under the same keys.

Forms: every field with its current value, field highlighting, and checkboxes, radio buttons, lists and signatures drawn the way their author designed them. Layers: switch optional content on and off and the page re-renders instantly. Comments appear as threaded conversations, and attachments can be opened or saved.

Every tool, one keystroke away

Press ⌘K to search every tool and command, or browse the All tools catalogue. Tools that are still in development are marked with the milestone that will ship them.

Native on macOS, Windows, Linux and FreeBSD, and in the browser through WebAssembly, from the same Rust codebase. Windows builds come for x64, x86 and ARM64 (Windows on ARM, no emulation); every ARM64 change is tested on ARM64 hardware in CI.

Private by design. Documents never leave your machine. There's no account, no telemetry and no cloud processing.

Engine first. Parsing, rendering and editing live in reusable library crates. The interface is one swappable layer on top.

Scriptable. The pdfcraft-cli tool (see Built for agents, too) covers inspecting, rendering, extracting text, editing, combining, extracting pages and splitting. Robustness sweeps run on the same engine as the app.

pdfcraft-cli info form.pdf # structure as JSON pdfcraft-cli text paper.pdf --page 3 # reading-order text pdfcraft-cli edit in.pdf --rotate 1,2:90 --delete 5 --title "Q3" --out out.pdf

Built for agents, too

Every engine feature is reachable without the GUI, through one table of JSON-Schema-described tools: open, inspect, render pages to PNG, extract and find text, rotate, delete, move and insert pages, edit bookmarks and page labels, add, reply to, restyle and delete comments (highlight a phrase just by naming it), list and fill in form fields, protect with passwords, set metadata, undo and redo, save, combine, extract and split. Three front doors share it:

pdfcraft-cli run, for one-off calls and JSON scripts:

pdfcraft-cli tools # every tool and its JSON Schema pdfcraft-cli run text_find doc=1 query=invoice # key=value; values parse as JSON pdfcraft-cli run --script review.json # e.g. comment_add {"type": "highlight", "find": "total due"} pdfcraft-cli run --script steps.json --root ./work # several steps in one session pdfcraft-cli run --script steps.json --report # one JSON document: per step its number, tool, status, result or error

With --root, every file the script's steps read or write stays in that directory, including the PNG a step saves with "out" (the script itself is read from wherever you name it).

An MCP server, for AI agents such as Claude. It is opt-in: PdfCraft never starts it on its own, and it opens no network port. It runs only while an agent launches pdfcraft-cli mcp, talks over stdin/stdout, and stops when the agent disconnects. To enable it, add it to your agent's MCP configuration:

{ "mcpServers": { "pdfcraft": { "command": "pdfcraft-cli", "args": ["mcp", "--root", "/path/to/your/pdfs"] } } }

--compact shrinks the tool list the agent has to read: tools/list returns about ten core tools plus tool_search and tool_call, which find and run every other tool, so the list costs far fewer tokens. Every tool still works.

--root confines every file the agent can read or write to one directory. Builds that should not include the server at all can use cargo build -p pdfcraft-cli --no-default-features.

The Rust API (pdfcraft_automation::Automation::call), for embedding.

Edits stay in memory, undoable, until doc_save. Saving to the same file appends an incremental update, so the original bytes are preserved, and the write is atomic. Unsaved changes are never discarded silently.

Start the desktop app with pdfcraft --control ~/.pdfcraft-control.json and an agent can see and operate the real interface: the widget tree with labels and positions (from the accessibility tree), clicks, typing, keys, commands, view options and screenshots. This is also off by default. It listens only on loopback, and every connection must present the random token written to that file, which only you can read.

Keep the control file in a folder only you can write, not a shared one such as /tmp: another user could create the file there first and receive your commands. pdfcraft-cli ui refuses a control file that is a symbolic link, and on macOS, Linux and FreeBSD one that another user owns or can read or write. The app doesn't start if it can't write the file.

pdfcraft-cli ui --control ~/.pdfcraft-control.json inspect query=rotate # find widgets pdfcraft-cli ui --control ~/.pdfcraft-control.json click label="Organize pages" pdfcraft-cli ui --control ~/.pdfcraft-control.json key key=K modifiers='["command"]' pdfcraft-cli ui --control ~/.pdfcraft-control.json command id=comment.square # pick a tool, then draw: pdfcraft-cli ui --control ~/.pdfcraft-control.json drag from='[400,300]' to='[600,420]' pdfcraft-cli ui --control ~/.pdfcraft-control.json screenshot --out window.png pdfcraft-cli ui --control ~/.pdfcraft-control.json resize width=1200 height=800 pdfcraft-cli ui --control ~/.pdfcraft-control.json focus label="Read" pdfcraft-cli ui --control ~/.pdfcraft-control.json inspect focused=true pdfcraft-cli ui --control ~/.pdfcraft-control.json quit

ui.dock arranges the tools and inspector panels; canvas is the protected document view. Each per-panel request requires a panel ID and an operation: open, close, activate, float with rect: [x, y, width, height], or move with target and zone: center|left|right|top|bottom. For example, {"operation":"float","panel":"tools","rect":[100,100,320,440]} floats Tools. ui.dock.reset restores the default arrangement. The control channel accepts these methods directly; ui.command also accepts {"id":"ui.dock","params":{...}}. Saved preferences retain groups, active tabs, visibility and floating geometry. Invalid requests return an error without changing the document or layout.

resize requests a native inner-window size in logical points (each dimension must be between 320 and 8192); the window manager may constrain it. state reports the observed window.width, window.height and window.pixels_per_point. focus accepts exactly one widget id or unique enabled, focusable label; subsequent key requests traverse or activate the actual widgets. inspect includes focusability and accepts a focused filter. quit takes no parameters: clean documents exit normally, while unsaved edits or typing open the existing Save/Don't save/Cancel prompt and return quitting: false, needs_confirmation: true. It never silently discards work. Window resizing and application quit are native-only.

PdfCraft is a Cargo workspace of focused crates, layered so the core never depends on the UI:

Quality gates. Every change passes the same automated checks:

On top of those, two corpus sweeps run over real-world files:

The output is verified against independent implementations: hayro and qpdf on every CI run, and poppler over the corpus on demand (cargo xtask text-oracle).

PdfCraft is a clean-room implementation. Its behaviour comes from the ISO 32000 specification and black-box observation, never from anyone else's code. Every icon, font and image is openly licensed and listed in ATTRIBUTION.md.

git clone https://github.com/storytold/pdfcraft cd pdfcraft cargo xtask models # fetch the OCR models Scan & OCR needs (release builds include them) cargo run --release -p pdfcraft -- some.pdf # desktop app ca

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →