Skip to main content

langchain-pdfmux

PyPI version Python versions License: MIT

LangChain document loader for pdfmux -- self-healing PDF extraction for RAG pipelines.

Why pdfmux?

Most PDF loaders use a single extraction method and silently fail on complex layouts. pdfmux routes each page through the best extraction pipeline automatically:

  • Smart routing -- selects the optimal parser per page (text-heavy, scanned, tables, mixed)
  • Confidence scoring -- every chunk includes a confidence score so your RAG pipeline can filter or re-rank
  • Self-healing -- retries with alternative extractors when the primary one returns low-quality output

Install

pip install langchain-pdfmux

Usage

from langchain_pdfmux import PDFMuxLoader

docs = PDFMuxLoader("report.pdf").load()

Each Document includes metadata with extraction quality signals:

loader = PDFMuxLoader("report.pdf", quality="high")
for doc in loader.lazy_load():
    print(doc.metadata)
    # {
    #   "source": "report.pdf",
    #   "title": "Q4 Results",
    #   "page_start": 1,
    #   "page_end": 3,
    #   "tokens": 820,
    #   "confidence": 0.94
    # }

Options

# Quality presets: "fast", "standard" (default), "high"
loader = PDFMuxLoader("report.pdf", quality="high")

# Load all PDFs in a directory
loader = PDFMuxLoader("./papers/")

# Custom glob pattern
loader = PDFMuxLoader("./papers/", glob="**/*.pdf")

# Streaming with lazy_load
for doc in PDFMuxLoader("large.pdf").lazy_load():
    process(doc)

License

MIT

Metadata

Release files for langchain-pdfmux 0.2.0

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

Source distribution (sdist)

Source distribution for langchain-pdfmux 0.2.0
File Size Uploaded
langchain_pdfmux-0.2.0.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-pdfmux 0.2.0
File Interpreter ABI Platform
langchain_pdfmux-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / langchain_pdfmux-0.2.0.tar.gz

Download URL langchain_pdfmux-0.2.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
118e0083f71e8904decef1b6f60267b1dfa5a1c864995f681e5a6b60386662bc
BLAKE2b-256 checksum
How to use checksums
ecc899e521c502d81cf5c571cf2584baf58a063f32d0419fab650f43f9d7e71d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / langchain_pdfmux-0.2.0-py3-none-any.whl

Download URL langchain_pdfmux-0.2.0-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0947cec5a963a76bc6bd68e72a3ed0a534ed79870f180de44db0419322cf5f84
BLAKE2b-256 checksum
How to use checksums
c8d3576c9e32a085a1a36221b0a71ac6c61abc5a021b95bacbbe5ca3e24cb666
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.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