Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

langchain-pymupdf-layout

An integration package connecting PyMuPDF Layout to LangChain.

Load PDF content to Markdown using AI-based, CPU only, layout analysis.

LangChain Python version License PolyForm Noncommercial

Features

  • 📚 Structured data extraction from your documents
  • 🧐 Advanced document page layout understanding, including semantic markup for titles, headings, headers, footers, tables, images and text styling
  • 🔍 Detect and isolate header and footer patterns on each page

For more detailed information visit the official PyMuPDF Layout documentation webpage.

Requirements

  • Python 3.11 or higher
  • LangChain Core v1.0.0 or higher
  • PyMuPDF v1.26.6 or higher
  • PyMuPDF4LLM v0.2.0 or higher
  • PyMuPDF Layout v1.26.6 or higher

Installation

Install the package using pip to start using the Document Loader:

pip install -U langchain-pymupdf-layout

Usage

You can easily integrate and use the PyMuPDF Layout Loader in your Python application for loading and parsing PDFs.

Below is an example of how to set up and utilize this loader:

from langchain_pymupdf_layout import version

print(version())  # Output: version number

from langchain.text_splitter import RecursiveCharacterTextSplitter

from langchain_pymupdf_layout import PyMuPDFLayoutLoader

loader = PyMuPDFLayoutLoader(
    file_path="https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611_sample_explain.pdf",
    show_progress=False,  
    # See other loader options on https://pymupdf.readthedocs.io/en/latest/pymupdf-layout/index.html#pymupdf-layout-and-parameter-caveats
)

documents = loader.load()

# Chunk
text_splitter = RecursiveCharacterTextSplitter(
    chunk_size=1000,
    chunk_overlap=200
)

chunks = text_splitter.split_documents(documents)

print(f"Loaded {len(documents)} document(s)")
print(f"Created {len(chunks)} chunk(s)")

content = chunks[0].page_content
print(f"\ncontent:\n{content}")

Metadata

Release files for langchain-pymupdf-layout 0.1.3

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-pymupdf-layout 0.1.3
File Size Uploaded Provenance
langchain_pymupdf_layout-0.1.3.tar.gz 10.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-pymupdf-layout 0.1.3
File Interpreter ABI Platform
langchain_pymupdf_layout-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 21.3 kB

Release files / langchain_pymupdf_layout-0.1.3.tar.gz

Download URL langchain_pymupdf_layout-0.1.3.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8c5af2315c20a1b6dea5d79d684747f8288d803c3caf274bdf96aff1f2bb8681
BLAKE2b-256 checksum
How to use checksums
403ad2df8725975cbd35ff038ea90d5bde7145f866b3d8554e51823ab59ccaa2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.7

Release files / langchain_pymupdf_layout-0.1.3-py3-none-any.whl

Download URL langchain_pymupdf_layout-0.1.3-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68499352327de664b7fa70800ac51362bd11f35447e736847585542cf3547bbd
BLAKE2b-256 checksum
How to use checksums
35197c1d081e94295b7bd8f9eefd5983d75ba5bca74a23c26843306f40039156
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.7

Security for langchain-pymupdf-layout 0.1.3

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.

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