Skip to main content

Dependency free extraction from documents.

Project description

udoc

Dependency free extraction from documents.

Extract text, tables, JSON, or rendered pages. CLI, Python Bindings, Pure Rust. No external parsers, libraries, or system packages are required. Provides hooks for OCR, layout detection, and entity extraction. Permissively licensed as dual MIT / Apache-2.0.

Supports PDF, DOC, DOCX, XLS, XLSX, PPT, PPTX, ODT, ODS, ODP, RTF, and Markdown.

The full hosted manual lives at https://newelh.github.io/udoc/.


Try it out using uv, no install required:

curl -sL https://arxiv.org/pdf/1706.03762 \
  | uvx udoc - | grep -A 18 '^Abstract'

Installation

# uv
uv add udoc

# pip
pip install udoc

# cargo (coming soon)

To build from source, see the compile guide.

Highlights

  • One Document model across formats. A content spine of Block and Inline nodes, plus optional presentation, relationships, and interactions overlays. Disable any overlay via Config.
  • Legacy binary Office. Native parsers for .doc, .xls, and .ppt. Per-format details in the format guides.
  • Streaming page-by-page. The Extractor defers per-page work. A 10 GB PDF does not have to fit in memory.
  • Typed diagnostics. Recoverable issues become structured warnings filterable by kind. Examples: font fallbacks, malformed xref, stream-length mismatches.
  • Hooks for OCR, layout, and annotation. JSONL protocol for Tesseract, cloud OCR APIs, DocLayout-YOLO, GLM-OCR, vision-language models, NER, or any subprocess that reads JSON line-by-line.
  • LLM tool use. Agent instructions — a paste-into-context page describing udoc's CLI to assistants.

Usage

CLI

udoc paper.pdf                     # text to stdout
udoc -j paper.pdf                  # full document as JSON
udoc -J paper.pdf                  # streaming JSONL (one record per page)
udoc -t spreadsheet.xlsx           # tables only as TSV
udoc -p 1-5,10 paper.pdf           # page range
udoc render paper.pdf -o ./pages   # rasterise PDF pages to PNG
cat paper.pdf | udoc -             # read from stdin

A few real-world piping recipes:

curl -sL https://arxiv.org/pdf/1706.03762 | udoc - | head -40
udoc paper.pdf | grep -i 'attention'
udoc -J docs/*.pdf | jq '.metadata.title'

Plain text on stdout. Structured output on flags. Stderr is silent unless you pass -v. The full flag list lives in the CLI reference.

Python

import udoc

# One-shot extraction. Format detected from magic bytes.
doc = udoc.extract("paper.pdf")
print(doc.metadata.title)
for block in doc.blocks():
    print(block.text)

# Stream page by page; large documents do not have to fit in memory.
with udoc.stream("large.pdf") as ext:
    for i in range(len(ext)):
        print(f"page {i}: {ext.page_text(i)[:80]}")

# In-memory bytes with options.
with open("encrypted.pdf", "rb") as f:
    doc = udoc.extract_bytes(f.read(), password="secret")

PDF table detection and reading order are heuristic. Born-digital documents with clean ruling and standard column flow extract cleanly out of the box; the PDF format guide covers the failure modes and when to attach a layout-detection or OCR hook.

The Guide walks through configuration, overlays, diagnostics, chunking, and batch processing. The Python Library reference lists every function, class, and exception.

Rust

let doc = udoc::extract("paper.pdf")?;
println!("{:?}", doc.metadata.title);
for block in &doc.content {
    println!("{}", block.text());
}

The Rust facade mirrors the Python shape. Document is udoc_core::document::Document; iteration is by direct field access (doc.content, doc.metadata, doc.images). The Rust Library reference covers the facade, the per-format backends, configuration presets, diagnostics, and the trait that backends implement.

Status

This is the initial alpha release of udoc. APIs and outputs are subject to change. Bugs, ergonomic suggestions, and format quirks are welcome on the issue tracker.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

udoc-0.1.0a1.tar.gz (5.3 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

udoc-0.1.0a1-cp310-abi3-win_amd64.whl (5.2 MB view details)

Uploaded CPython 3.10+Windows x86-64

udoc-0.1.0a1-cp310-abi3-manylinux_2_28_x86_64.whl (10.7 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ x86-64

udoc-0.1.0a1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (10.1 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

udoc-0.1.0a1-cp310-abi3-macosx_11_0_arm64.whl (10.2 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file udoc-0.1.0a1.tar.gz.

File metadata

  • Download URL: udoc-0.1.0a1.tar.gz
  • Upload date:
  • Size: 5.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for udoc-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 d316d686848dc0841fbde830b562d29d2cb95c2fe247007efa42ba9daf4ac9ca
MD5 36ae3353971ca432a07f1754ddaa2d97
BLAKE2b-256 787c7edf0fe7eba23855e40b1984246bca439a6a9ca45eb6edc8c2895a4342ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for udoc-0.1.0a1.tar.gz:

Publisher: release.yml on newelh/udoc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file udoc-0.1.0a1-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: udoc-0.1.0a1-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 5.2 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for udoc-0.1.0a1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 faba33bfe8479f0f661c8f0dc98ca7aee3b2971ea363b5658b13537662eca477
MD5 2d7b21d9bd8c55351955b978a9695d0d
BLAKE2b-256 458120faa1f420e7a3a587ff1001f9b756bab26a07fc053f6a36bb282031b2c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for udoc-0.1.0a1-cp310-abi3-win_amd64.whl:

Publisher: release.yml on newelh/udoc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file udoc-0.1.0a1-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for udoc-0.1.0a1-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 92e91f7752221ecc9ad7c7b766f73744521e7c45ace35f85f4a18c008a93ae95
MD5 90abb482a5e0ba366a7db819da9775da
BLAKE2b-256 c5ae883c74902752349d982179cdb2ad4f2283df60301b044ad7b91fb530a00c

See more details on using hashes here.

Provenance

The following attestation bundles were made for udoc-0.1.0a1-cp310-abi3-manylinux_2_28_x86_64.whl:

Publisher: release.yml on newelh/udoc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file udoc-0.1.0a1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for udoc-0.1.0a1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8440aae24b6a4caebc6e964fa356d5a1186358b0549b8677f2bb0361a615866b
MD5 7d08b1bfc52c9833f67ecb57ea251587
BLAKE2b-256 af38c7c21aee3c338111d7cb1886fc8365d0f8d1ae95a1a0d7140bcf01f60f5f

See more details on using hashes here.

Provenance

The following attestation bundles were made for udoc-0.1.0a1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on newelh/udoc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file udoc-0.1.0a1-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for udoc-0.1.0a1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ea50dd1cb2e4adbc06ad6d4bb85c7ece458d05aff69129955ebf11aa8fd5dde5
MD5 6586c16554096b533a73285de31caea9
BLAKE2b-256 0bc3b2e2e772303427dbae66428a7cd762355af01853b41bc711a22a5a9d2178

See more details on using hashes here.

Provenance

The following attestation bundles were made for udoc-0.1.0a1-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on newelh/udoc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page