eDocAPI is a document processing library and lightweight API framework. Convert DOCX, HTML, Markdown, images and PDFs,
extract text, run OCR, compress and merge through a simple App API. Just you and your documents.
pip install edocapi
A focused document toolkit — convert, extract, OCR, compress, merge — and a lightweight App for building document APIs.
DOCX → PDF with ReportLab layout (preserves headings, tables, page breaks). HTML & Markdown → PDF. Images → PDF. Optional renderers are available for richer output.
Pull clean text from PDFs, DOCX, HTML, Markdown and more. Simple .extract_text() that just works.
OCR for scanned PDFs and images uses the external Tesseract program. Install edocapi[ml] and Tesseract; PDF page rendering may also require edocapi[pdf-images] and Poppler. The API OCR route is enabled with App(enable_ocr=True).
Compress PDFs and images, with an optional best-effort target size that depends on the input and output format. Merge multiple PDFs into one.
Build document APIs with a tiny App class. Interactive developer dashboard included out of the box.
File-signature and extension checks, path sanitization, size limits, collision-resistant temporary names, and automatic cleanup.
Most document libraries pull in heavy dependencies or force complex setups. eDocAPI brings document tools and a simple App together when you need an API — so you stay in control of your workflow.
Install only the optional features you need, with a focused core for document workflows.
ReportLab-based layout converts DOCX files without requiring WeasyPrint’s native libraries. Output preserves supported headings, tables, and page breaks.
File-signature checks, path sanitization, size limits, temporary-file isolation, and safe response headers help make document handling more predictable.
Created by Emmanuel Emmanuel Etim. Open source, MIT licensed, and designed to stay lightweight and honest.
from edocapi import Document
# From a file
doc = Document("report.docx")
pdf = doc.to_pdf()
text = doc.extract_text()
info = doc.info()
# From in-memory content
doc = Document.markdown("# Hello\n\nWorld")
pdf = doc.to_pdf()
# OCR (pip install edocapi[ml])
text = Document("scan.png").ocr(lang="eng")
# Merge & compress
merged = Document.merge(["a.pdf", "b.pdf"])
small = Document("large.pdf").compress(target_size=500_000)
What was actually shipped — from the first public versions to the current release.
Predictable failures, safer uploads, blocked resource fetches during rendering, rate limits, streaming cleanup, and CI across Python 3.10–3.13.
ASGI app, OCR, converters, security hardening, CLI, and interactive dashboard.
What each operation can do today.
| Format | to_pdf | extract_text | OCR | compress | merge | to_images |
|---|---|---|---|---|---|---|
| ✓ | ✓ | ✓* | ✓ | ✓ | ✓* | |
| DOCX | ✓ | ✓ | – | – | – | – |
| HTML | ✓ | ✓ | – | – | – | – |
| Markdown | ✓ | ✓ | – | – | – | – |
| TXT | ✓ | ✓ | – | – | – | – |
| JPEG / PNG / WebP | ✓ | ✓* | ✓* | ✓ | – | – |
OCR requires optional OCR engines: Tesseract with edocapi[ml] or PaddleOCR with edocapi[structured-ocr]. Tesseract OCR for scanned PDF pages may also need edocapi[pdf-images] and Poppler. PDF to_images() requires edocapi[pdf-images] and Poppler.
Library or API server — both are one install away.
$ pip install edocapi
Optional: edocapi[html] · edocapi[ml] · edocapi[server] · edocapi[all]
from edocapi import Document
doc = Document("report.docx")
pdf = doc.to_pdf()
text = doc.extract_text()
from edocapi import App, Document
app = App()
@app.post("/convert")
def convert(file):
return Document(file).to_pdf()
$ pip install edocapi[server]
$ uvicorn main:app --reload
Open http://127.0.0.1:8000 for the interactive developer dashboard.
edocapi --version
edocapi convert report.docx -o report.pdf
edocapi extract report.pdf
edocapi info image.png
edocapi ocr scan.png --lang eng
edocapi compress large.pdf --target 500KB
One package. Clean API. Real security. Built by a Nigerian developer who cares about simplicity.