Repolode
NanoNets

NanoNets/docstrange

Python library and web UI that converts PDFs, DOCX, PPTX, XLSX, images and URLs into Markdown, JSON, CSV or HTML, with OCR and structured field extraction.

Open-source alternative to:Amazon TextractAdobe Acrobat

Stars
1,579
Forks
138
Open issues
14
Last commit
12 months ago

What is it?

DocStrange is a Python library for turning documents such as PDFs, DOCX and PPTX files, spreadsheets, images and web pages into clean Markdown, structured JSON, CSV, or HTML. It applies OCR and layout detection so that scanned documents and phone photos can be converted, and tables are output in a form suited to LLM input and RAG pipelines.

Beyond plain conversion, it can extract specific fields such as invoice numbers or totals, or populate output that follows a custom JSON schema. Processing runs either through a free cloud API, with an authenticated tier of 10,000 documents per month, or locally on CPU or CUDA GPU for fully private use. A built-in drag-and-drop web interface is available after installing the web extra, and a command-line tool supports batch conversion.

The project is installed with pip and requires Python 3.8 or later. An optional MCP server for Claude Desktop is provided in the repository for local development.

Key features

  • 01Converts PDF, DOCX, PPTX, XLSX, images and URLs into Markdown, JSON, CSV and HTML.
  • 02Uses OCR and layout detection to read scans and phone photos.
  • 03Extracts specified fields or data that follows a custom JSON schema.
  • 04Runs in the cloud or fully locally on CPU or GPU.
  • 05Provides a local drag-and-drop web interface and a command-line tool.

Use cases

  • Preparing scanned contracts, reports or receipts as Markdown for RAG pipelines.
  • Extracting invoice numbers, totals and dates from batches of PDFs into JSON or CSV.
  • Running document conversion offline where data must stay on-premises.
  • Converting tables from Excel or PDF reports into CSV for analysis.

Quick start

  1. 1

    Install the library with pip

    pip install docstrange
  2. 2

    Convert a document to Markdown in Python (cloud mode by default)

    from docstrange import DocumentExtractor extractor = DocumentExtractor() result = extractor.extract("document.pdf") markdown = result.extract_markdown() print(markdown)
  3. 3

    Optionally install web UI dependencies and launch the local web interface

    pip install "docstrange[web]"

Things to know

  • Free cloud processing is limited to 10000 documents per month, and the default mode sends files to the cloud.
  • Fully private local processing requires a CUDA GPU; local GPU mode is not available without it.
  • Local mode needs to download models on first run.

Topics

FAQ

What is docstrange?
Python library and web UI that converts PDFs, DOCX, PPTX, XLSX, images and URLs into Markdown, JSON, CSV or HTML, with OCR and structured field extraction. DocStrange is a Python library for turning documents such as PDFs, DOCX and PPTX files, spreadsheets, images and web pages into clean Markdown, structured JSON, CSV, or HTML. It applies OCR and layout detection so that scanned documents and phone photos can be converted, and tables are output in a form suited to LLM input and RAG pipelines.
Is docstrange free to use? What license does it have?
docstrange is open source under the MIT license. Check the license terms before using it in commercial products.
Is docstrange still maintained?
No commits for 6+ months. The last commit to docstrange was on Oct 31, 2025.
What can I use docstrange for?
Preparing scanned contracts, reports or receipts as Markdown for RAG pipelines. Extracting invoice numbers, totals and dates from batches of PDFs into JSON or CSV. Running document conversion offline where data must stay on-premises. Converting tables from Excel or PDF reports into CSV for analysis.
How do I install docstrange?
Install the library with pip: pip install docstrange Convert a document to Markdown in Python (cloud mode by default): from docstrange import DocumentExtractor extractor = DocumentExtractor() result = extractor.extract("document.pdf") markdown = result.extract_markdown() print(markdown) Optionally install web UI dependencies and launch the local web interface: pip install "docstrange[web]"
Where can I get docstrange?
The source code and installation instructions are on GitHub: https://github.com/NanoNets/docstrange

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects