Skip to main content

docproc

docproc logo

docproc
Turn messy documents into clean markdown for AI pipelines.

Document → Markdown → AI


docproc is a document-to-markdown extraction engine. It converts PDFs, DOCX, PPTX, and XLSX into clean structured markdown while preserving equations, figures, and embedded images. It is designed to power LLM pipelines, RAG systems, and document processing workflows.

Features

  • PDF → Markdown — Native text extraction plus vision-based handling of embedded images
  • DOCX → Markdown — Full document structure and formatting
  • PPTX → Markdown — Slides to structured content
  • XLSX → Markdown — Spreadsheets to readable tables
  • Equation preservation — LaTeX and math kept intact (with optional LLM refinement)
  • Figure extraction — Every image, diagram, and label described by a vision model
  • Clean structured output — Ready for LLMs, RAG, and downstream pipelines

Example

Before: A PDF with mixed text, equations, and diagrams.

After: A single .md file with extracted text, LaTeX math blocks, and every figure explained by the vision model—ready to embed, chunk, or feed into an LLM.

docproc --file paper.pdf -o paper.md

Installation

pip install git+https://github.com/rithulkamesh/docproc.git

Or with uv:

uv tool install git+https://github.com/rithulkamesh/docproc.git

From source:

git clone https://github.com/rithulkamesh/docproc.git && cd docproc
uv sync --python 3.12

Usage

One-time config (generates docproc.yaml from your .env):

docproc init-config --env .env

Extract a document to markdown:

docproc --file input.pdf -o output.md

Optional: --config path, -v for verbose output. Shell completions: docproc completions bash or docproc completions zsh.

Python library

Install the package, then use the Docproc facade with instance-scoped config (PEP 561 typing via py.typed):

from docproc import Docproc

Docproc.from_config_path("docproc.yaml").extract_to_file("input.pdf", "output.md")

# Or minimal OpenAI in code (uses OPENAI_API_KEY):
Docproc.with_openai().extract_to_file("input.pdf", "output.md")

# String output for RAG / LLM pipelines:
md = Docproc.from_env().extract("paper.pdf")

Lower-level API: extract_document_to_text, parse_config, docprocConfig. Runnable samples: examples/.

Why docproc?

Naive PDF parsers often drop equations, misread layouts, and leave images as black boxes. docproc uses native extractors where possible (PyMuPDF, python-docx, etc.) and runs a vision model on every embedded image—so diagrams, charts, and equations become text or LaTeX that your AI stack can actually use. Optional LLM refinement cleans markdown and normalizes math. The result is document content that fits cleanly into RAG pipelines and LLM context windows instead of noisy, incomplete text.

Architecture

docproc ships as a CLI and an importable Python library; there is no bundled server or database for extraction. The pipeline is:

  1. Load — Read the file (PDF/DOCX/PPTX/XLSX) and extract full text from the native layer.
  2. Vision — For PDFs, run a vision model on every embedded image; get descriptions, LaTeX, or structured captions.
  3. Refine (optional) — LLM pass to tidy markdown, normalize LaTeX, and strip boilerplate.
  4. Sanitize — Dedupe and clean; write a single .md file.

Configuration lives in docproc.yaml (or generated via docproc init-config --env .env). AI providers: OpenAI, Azure, Anthropic, Ollama, LiteLLM. See docs/ARCHITECTURE.md and docs/CONFIGURATION.md for details.

Demo (docproc // edu)

The demo/ is a full study workspace: upload docs, chat over them, generate notes and flashcards, create and take assessments. It’s a separate Go + React app that calls this CLI when a document is uploaded. See demo/README.md.

Docs

Doc Description
docs/README.md Index
docs/CONFIGURATION.md Config schema, providers, ingest, RAG
docs/ARCHITECTURE.md Pipeline, CLI, Python library
docs/AZURE_SETUP.md Azure OpenAI and Vision setup
docs/ASSESSMENTS_AI.md Assessments and grading in the demo

Environment: DOCPROC_CONFIG for config path (default: docproc.yaml). Provider keys: OPENAI_API_KEY, AZURE_OPENAI_*, ANTHROPIC_API_KEY, etc. See .env.example.

Contributing

Pull requests welcome. Run the tests before sending.

License

MIT. See LICENSE.md.

Metadata

Release files for docproc 2.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docproc 2.1.1
File Size Uploaded
docproc-2.1.1.tar.gz 35.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for docproc 2.1.1
File Interpreter ABI Platform
docproc-2.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 87.5 kB

Release files / docproc-2.1.1.tar.gz

Download URL docproc-2.1.1.tar.gz
Size 35.4 kB
Tags Source
SHA-256 checksum
How to use checksums
caddabdc322f86786ee85b8853d3572e719139fe126cfcea1c742415e6687f50
BLAKE2b-256 checksum
How to use checksums
31299940871f8477ec54fc06c19f4b03d67baac338df97d53dd61a252c62164d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 8, 2026.

Transparency log

Release files / docproc-2.1.1-py3-none-any.whl

Download URL docproc-2.1.1-py3-none-any.whl
Size 52.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c4e52e55a098e4a937ad4aadd6d2989ae2670f3604e5de3a94e15ac973446778
BLAKE2b-256 checksum
How to use checksums
e9bd7221eda66f8a1ee10f20714a70277dd66dc9643ce98bff01f1f531847068
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.1.1 This release

2 release files

2.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page