rdocx
rdocx gives Rust applications one Document for the complete Word workflow.
Create a business document, open and edit a customer template, retain producer
content you do not model, lay out the result, and deliver DOCX, PDF, page
images, HTML, or Markdown without starting Microsoft Word or LibreOffice.
This is an integrated native document stack, not only a DOCX writer. The same engine powers Rust, the command line, Python, and a locally built browser package. Project-owned layout and bundled fonts make deterministic output possible without an Office installation or conversion service.
Built for complete document workflows
| Workflow | Implemented result |
|---|---|
| DOCX | Create, open, edit, validate, and save complete packages, with encryption and signing through opt-in features |
| Rich authoring | Complete paragraph and run properties, multilingual and vertical typography, conditional and floating tables, section page semantics, settings, styles, numbering, fields, forms, equations, drawings, comments, and metadata |
| Preservation | Retain unknown safe producer XML byte for byte when it is not modelled |
| Native layout | Resolve Word flow content into positioned pages with bundled, system, embedded, or caller-provided fonts |
| Fixed output | PDF, PDF/A, PNG, JPEG, TIFF, and SVG |
| Flow output | HTML, HTML fragments, Markdown, MHTML, RTF, ODT, and EPUB |
| Automation | Rust facade, CLI, Python binding, and locally built browser binding |
Most applications need only rdocx. Specialist crates expose the OPC,
WordprocessingML, layout, HTML, and fixed-output layers for applications that
already own one of those boundaries.
Measured footprint and speed
Archive size is regenerated from tracked package contents. The performance rows are the enforced release-mode bounds plus one dated observation.
| Measurement | Value | Version | Platform | Build mode | Input | Command | Statistic | Measured on |
|---|---|---|---|---|---|---|---|---|
| Crates.io archive: rdocx | 1,267,319 compressed bytes, 7,351,519 member bytes, 36 members | 0.15.0 | macOS 26.6.2, Apple M5 Max, arm64 | cargo package --locked --no-verify |
Tracked rdocx package inventory |
python3 scripts/readme_doctests.py --record-measurements |
gzip archive bytes, tar member bytes, tar member count | 2026-10-04 |
| Large-document layout throughput | minimum 250 pages/s, observed 31,019.1 pages/s | rdocx 0.14.0 | macOS 26.6.2, Apple M5 Max, arm64 | release, one test thread | 1,000 one-page paragraphs with deterministic fonts | cargo test -p rdocx --test regression_test --release a_thousand_page_document_paginates_and_renders_within_the_declared_limits -- --ignored --exact --nocapture --test-threads=1 |
pages per wall-clock second | 2026-09-19 |
| Large-document layout peak allocation | maximum 64 MiB, observed 29.03 MiB | rdocx 0.14.0 | macOS 26.6.2, Apple M5 Max, arm64 | release, one test thread | 1,000 one-page paragraphs with deterministic fonts | cargo test -p rdocx --test regression_test --release a_thousand_page_document_paginates_and_renders_within_the_declared_limits -- --ignored --exact --nocapture --test-threads=1 |
peak live allocation | 2026-09-19 |
| Large-document PDF throughput | minimum 1,000 pages/s, observed 60,058.0 pages/s | rdocx 0.14.0 | macOS 26.6.2, Apple M5 Max, arm64 | release, one test thread | 1,000 deterministic layout pages | cargo test -p rdocx --test regression_test --release a_thousand_page_document_paginates_and_renders_within_the_declared_limits -- --ignored --exact --nocapture --test-threads=1 |
pages per wall-clock second | 2026-09-19 |
| Large-document PDF peak allocation | maximum 16 MiB, observed 1.73 MiB | rdocx 0.14.0 | macOS 26.6.2, Apple M5 Max, arm64 | release, one test thread | 1,000 deterministic layout pages | cargo test -p rdocx --test regression_test --release a_thousand_page_document_paginates_and_renders_within_the_declared_limits -- --ignored --exact --nocapture --test-threads=1 |
peak live allocation | 2026-09-19 |
Examples
Create a document
use ;
let mut document = new;
document.add_paragraph;
let mut summary = document.add_paragraph;
summary.add_run.bold;
summary.add_run;
let mut table = document.add_table;
assert!;
assert!;
document.save?;
# Ok::
Read and update a document
use Document;
use HashMap;
let mut document = open?;
for paragraph in document.paragraphs
let mut replacements = new;
replacements.insert;
document.replace_all;
document.save?;
# Ok::
Create and manage styles
use ;
let mut document = new;
document.add_style?;
document.add_paragraph.set_style;
assert_eq!;
assert!;
document.set_style?;
document.set_default_style?;
document.add_style?;
assert!;
document.save?;
# Ok::
save writes the package class that a .docx, .docm, .dotx, or .dotm
path names, so a .dotx template saved as .docx declares a document. A
package that carries a VBA project cannot change to a macro-free extension.
Render and export
use Document;
let document = open?;
document.save_pdf?;
let first_page_png = document.render_page_to_png_deterministic?;
let html = document.to_html;
let markdown = document.to_markdown;
assert!;
assert!;
assert!;
# Ok::
Installation
Most Rust applications need only the facade:
[]
= "0.15.0"
Bundled metric-compatible fonts are always available through deterministic rendering. The default feature also discovers system fonts. Disable default features when an application must use only the bundled set:
[]
= { = "0.15.0", = false }
Native encryption and signing APIs are opt-in:
[]
= { = "0.15.0", = ["agile-encryption", "digital-signatures"] }
The workspace requires Rust 1.93 or newer and uses edition 2024.
CLI
Install the CLI version from the same stable family:
Common commands:
Surfaces
| Surface | Boundary |
|---|---|
| rdocx | Native Rust facade for complete DOCX packages, authoring, conversion, and rendering |
| rdocx-oxml | Typed WordprocessingML for callers that already own the lower-level model |
| rdocx-layout | Word flow layout for callers that already own layout input |
| rdocx-html | HTML and Markdown export from parsed Word content |
| rdocx-cli | Shell automation for inspection, conversion, validation, rendering, replacement, and diffing |
| rdocx-py | Python editing, DOCX save, PDF output, and page images |
| rdocx-wasm | Browser and JavaScript round trips with PDF, HTML, and Markdown export |
The binding specification defines where Python, WebAssembly, and CLI intentionally expose less than native Rust.
Community Claude plugin
Contributor hadim maintains rdocx-skills, a Claude plugin with DOCX and PPTX skills built on the rdocx and rpptx CLIs and Python bindings. Its repository documents installation, pinned builds, acceptance tests, and current capability gaps.
Evidence-based alternatives
Comparison checked 2026-09-09. ND means the capability was not documented in
the official sources linked below. It does not mean the capability is
impossible. Native layout means a page-layout engine implemented by the
library, rather than conversion through Microsoft Office, a hosted service, or
another renderer.
| Project | DOCX open, create, edit | Preservation | Native layout and render | PDF and raster | HTML and Markdown | CLI | Python | Browser and WASM |
|---|---|---|---|---|---|---|---|---|
| rdocx | Open, create, edit, and save | Unknown safe producer XML is retained byte for byte when it is not modelled | Yes, Word flow layout with deterministic bundled fonts | PDF and page images | HTML and Markdown export | rdocx-cli |
rdocx-py, with a narrower facade |
Workspace rdocx-wasm facade, deliberately unpublished |
| python-docx | Create, open, change, and save | Existing content that its API cannot manipulate is left alone on load and save. No byte-exact guarantee is stated | ND | ND | ND | ND | Primary API | ND |
| docx-rs | Create and parse into the model used by its writer. Editing a parsed document is not separately documented | ND. The project states that its OOXML support is not exhaustive | ND | ND | ND | ND | ND | Document generation and DOCX-to-JSON parsing through WebAssembly |
| docx4j | Open, create, edit, and save | ND for unknown XML or byte-exact round trips | No project-owned page engine is documented. PDF paths use XSL-FO with Apache FOP, Microsoft Word through documents4j, or Microsoft Graph | PDF through the documented conversion paths. Raster output is ND | HTML export and first-party Markdown import and export | ND | ND | ND |
| Aspose.Words | Create, load, modify, and save DOCX | Feature-level preservation is documented during conversion. No byte-exact unknown-XML contract is stated | Yes, its own page-layout engine | PDF plus PNG, JPEG, BMP, and TIFF | HTML and Markdown | ND | Official Python via .NET API | ND |
Among these reviewed projects, rdocx alone documents the complete combination of a native Rust API, project-owned Word layout, fixed and flow outputs, a CLI, Python, and a browser surface. That statement is bounded to the official evidence set and review date. See the official python-docx document guide, docx-rs project, docx4j PDF paths, docx4j Markdown module, Aspose fixed-page documentation, Aspose format table, and Aspose load behavior.
Honest boundaries
rdocx preserves safe unmodeled XML, but it does not execute VBA, ActiveX, OLE, add-ins, or embedded applications. Binary DOC and Word 2003 XML are permanent non-goals. Exact authoring, reading, rendering, and preservation coverage lives in the modern DOCX capability matrix.
License
Licensed under either of:
- MIT license (LICENSE or https://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0)
at your option.