pdfsmith
PDF to Markdown conversion with multiple backend support
A unified interface to 19+ PDF parsing libraries including frontier LLMs. Pick the right tool for the job, or let pdfsmith choose for you.
Why pdfsmith?
- One API, many backends - Switch between parsers without changing your code
- Auto-selection - Automatically uses the best available parser
- Lightweight core - Install only the backends you need
- Battle-tested - Wrappers refined through extensive benchmarking
Installation
# Core package (no backends)
pip install pdfsmith
# With lightweight backends
pip install pdfsmith[light]
# Recommended stack (good balance of quality and speed)
pip install pdfsmith[recommended]
# All open-source backends
pip install pdfsmith[all]
# Frontier LLMs (GPT, Claude, Gemini)
pip install pdfsmith[frontier]
# Commercial cloud APIs
pip install pdfsmith[commercial]
# Specific backend
pip install pdfsmith[docling]
Quick Start
from pdfsmith import parse
# Auto-select best available backend
markdown = parse("document.pdf")
# Use a specific backend
markdown = parse("document.pdf", backend="docling")
# Check available backends
from pdfsmith import available_backends
for backend in available_backends():
print(f"{backend.name}: {backend.description}")
CLI Usage
# Parse PDF to stdout
pdfsmith parse document.pdf
# Parse to file
pdfsmith parse document.pdf -o output.md
# Use specific backend
pdfsmith parse document.pdf -b docling
# List available backends
pdfsmith backends
Available Backends
Open Source
| Backend | Weight | Best For |
|---|---|---|
docling |
heavy | Highest quality, complex documents |
marker |
heavy | Academic papers, LaTeX content |
pymupdf4llm |
medium | Good balance of speed and quality |
kreuzberg |
medium | Fast extraction with OCR |
unstructured |
medium | Versatile document processing |
pdfplumber |
light | Tables and structured data |
pymupdf |
light | Fast general-purpose extraction |
pypdf |
light | Lightweight, pure Python |
pdfminer |
light | Mature, handles encodings well |
pypdfium2 |
light | Chrome's PDF engine |
extractous |
medium | Rust-based extraction |
Commercial Cloud APIs
| Backend | Provider | Cost | Best For |
|---|---|---|---|
aws_textract |
AWS | $1.50/1k pages | High-accuracy OCR |
azure_document_intelligence |
Azure | $1.50/1k pages | Enterprise documents |
google_document_ai |
Google Cloud | $1.50/1k pages | Multi-language support |
databricks |
Databricks | ~$3/1k pages | SQL-based workflows |
llamaparse |
LlamaIndex | $0.003/page | Cost-effective API |
Frontier LLMs
| Backend | Model | Cost | Best For |
|---|---|---|---|
anthropic |
Claude Sonnet 4.5 | ~$0.04/page | High accuracy |
openai |
GPT-4o | ~$0.02/page | General purpose |
gemini |
Gemini 2.0 Flash | ~$0.001/page | Budget LLM option |
Note: Frontier LLM backends require API keys set via environment variables (ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_API_KEY).
Choosing a Backend
- Best quality:
anthropicoropenai- Frontier LLM accuracy (highest cost) - Best value:
llamaparse- Near-LLM quality at 10x lower cost - Structure preservation:
docling- Deep learning, GPU recommended - Academic papers:
marker- Optimized for LaTeX/equations - Tables:
pdfplumber- Excellent table detection - Speed:
pymupdforkreuzberg- Fast extraction - Minimal dependencies:
pypdf- Pure Python, no binaries - Budget LLM:
geminiwith gemini-2.0-flash - Very low cost LLM option
System Dependencies
Some backends require system packages for OCR functionality:
Tesseract OCR (for kreuzberg and unstructured with OCR):
# Ubuntu/Debian
sudo apt-get install tesseract-ocr
# macOS
brew install tesseract
# Windows
# Download from https://github.com/UB-Mannheim/tesseract/wiki
Without tesseract, these backends will still work for text-based PDFs but cannot extract text from scanned/image PDFs.
Async Support
from pdfsmith import parse_async
# Async parsing (uses backend's native async if available)
markdown = await parse_async("document.pdf")
Benchmarks
pdfsmith's backend wrappers were developed and refined through the pdf-bench benchmarking project, which evaluates parser performance across diverse document types.
License
MIT
Contributing
Contributions welcome! Please read our contributing guidelines before submitting PRs.
Metadata
Release files for pdfsmith 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pdfsmith-0.2.0.tar.gz | 499.2 kB | Without provenance | Details for pdfsmith-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pdfsmith-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for pdfsmith-0.2.0-py3-none-any.whl |
Total release size: 538.9 kB
Release files / pdfsmith-0.2.0.tar.gz
| Download URL | pdfsmith-0.2.0.tar.gz |
|---|---|
| Size | 499.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8fe4da11e50c15b2521799f0001befbf2c4b7a1d01d5c897ba8f9e0585507bc7
|
|
BLAKE2b-256 checksum How to use checksums |
35c0130e0947c510451dcc8af2cfc6509c0e943fa5b1a24e1323f01787ea6932
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / pdfsmith-0.2.0-py3-none-any.whl
| Download URL | pdfsmith-0.2.0-py3-none-any.whl |
|---|---|
| Size | 39.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5c9ff402fa7af7688f9183c7441df49a0b375dde8daff8332aa92bdc94804b13
|
|
BLAKE2b-256 checksum How to use checksums |
c5ad1733d1b7889bc3150ef13910790eaa3c66a59c385750e935087883a9a277
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for pdfsmith 0.2.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.