Skip to main content

A blazingly fast PDF table extraction library with python API powered by Rust

Project description

Rust Python

⚡ Tablers

A blazingly fast PDF table extraction library with python API powered by Rust

License: MIT PyPI version Python versions pdm-managed


Features

  • 🚀 Blazingly Fast - Core algorithms written in Rust for maximum performance
  • 🐍 Pythonic API - Easy-to-use Python interface with full type hints
  • 📄 Edge Detection - Accurate table detection using line and rectangle edge analysis
  • 📝 Text Extraction - Extract text content from table cells with configurable settings
  • 📤 Multiple Export Formats - Export tables to CSV, Markdown, and HTML
  • 🔐 Encrypted PDFs - Support for password-protected PDF documents
  • 💾 Memory Efficient - Lazy page loading for handling large PDF files
  • 🖥️ Cross-Platform - Works on Windows, Linux, and macOS

Why Tablers?

This project draws significant inspiration from the table extraction modules of pdfplumber and PyMuPDF. Compared to pdfplumber and PyMuPDF, tablers has the following advantages:

  • High Performance: Utilizes Rust for high-performance PDF processing
  • Higher Accuracy: Tablers optimizes some table detection algorithms to address table extraction problems that other libraries have not fully solved, including:
  • More Configurable: Supports customizable table filter settings (min_rows, min_columns, include_single_cell, e.g., see this issue)
  • Clean Python Dependencies: No external python dependencies required

Benchmark

Benchmarked on the ICDAR 2013 Table Competition dataset, evaluating both extraction speed and accuracy across tablers, PyMuPDF, pdfplumber, and camelot. All libraries use their default configuration for table extraction. PyMuPDF excludes tables that have only one row or only one column (see PyMuPDF#3987), and this behaviour is not configurable; among the compared libraries, only tablers allows configuring minimum row/column counts. For a fair comparison, the benchmark therefore includes both tablers (default) and tablers (min 2×2) — the latter with min_rows=2 and min_columns=2 so that single-row/single-column tables are filtered out in the same way as in PyMuPDF. For more on the libraries and settings, see the Libraries compared section in tablers-benchmark.

Table Extraction Benchmark

For more details, please refer to the tablers-benchmark repository.

Note

  • This solution is primarily designed for text-based PDFs and does not support scanned PDFs.
  • Thread Safety: tablers is not thread-safe. The library creates a global PDFium runtime at import time, which is bound to the importing thread. All Document operations must be performed on the same thread that imported tablers. Using Document from a different thread will raise a PanicException. For multi-threaded environments, import and use tablers within the same worker thread. Use multiprocessing for parallel processing instead. See Thread Safety for details and code examples.

Installation

pip install tablers

Quick Start

Basic Table Extraction

from tablers import Document, find_tables

# Open a PDF document
doc = Document("example.pdf")

# Extract tables from each page
for page in doc.pages():
    tables = find_tables(page, extract_text=True)
    for table in tables:
        print(f"Found table with {len(table.cells)} cells")
        for cell in table.cells:
            print(f"  Cell: {cell.text} at {cell.bbox}")

doc.close()

Using Context Manager

from tablers import Document, find_tables

with Document("example.pdf") as doc:
    page = doc.get_page(0)  # Get first page
    tables = find_tables(page, extract_text=True)

    for table in tables:
        print(f"Table bbox: {table.bbox}")

For more advanced usage, please refer to the documents.

Requirements

  • Python >= 3.10
  • Supported platforms: Windows (x64), Linux (x64, ARM64) with glibc >= 2.28, macOS (ARM64)

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tablers-0.8.0-cp310-abi3-win_amd64.whl (3.7 MB view details)

Uploaded CPython 3.10+Windows x86-64

tablers-0.8.0-cp310-abi3-manylinux_2_28_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ x86-64

tablers-0.8.0-cp310-abi3-manylinux_2_28_aarch64.whl (4.9 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

tablers-0.8.0-cp310-abi3-macosx_11_0_arm64.whl (3.8 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file tablers-0.8.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: tablers-0.8.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.7 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.27.0 CPython/3.12.3 Linux/6.17.0-1015-azure

File hashes

Hashes for tablers-0.8.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 da9a7813eaeb4ee583437df38ac782f7bbf9f74f2e344eb14b9243e45f3edf23
MD5 b21ade316a31ebe1543cfd3390f1c5ff
BLAKE2b-256 e10813097ffcf93ad99e9cd7609be11b35867b7a9bfb7454f7da84721bee5cba

See more details on using hashes here.

File details

Details for the file tablers-0.8.0-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: tablers-0.8.0-cp310-abi3-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: CPython 3.10+, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.27.0 CPython/3.12.3 Linux/6.17.0-1015-azure

File hashes

Hashes for tablers-0.8.0-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 11f86893033599bf4d7a84207f776a9b25be8b5166453519d48569ae959ae4bb
MD5 d2c9a821e1e841ca81b65e8e2f2d690d
BLAKE2b-256 57cb79378333d02a910ed078ee8063e65bebdd2c8e2768bd4616609d39c06e43

See more details on using hashes here.

File details

Details for the file tablers-0.8.0-cp310-abi3-manylinux_2_28_aarch64.whl.

File metadata

  • Download URL: tablers-0.8.0-cp310-abi3-manylinux_2_28_aarch64.whl
  • Upload date:
  • Size: 4.9 MB
  • Tags: CPython 3.10+, manylinux: glibc 2.28+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.27.0 CPython/3.12.3 Linux/6.17.0-1015-azure

File hashes

Hashes for tablers-0.8.0-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4524003a9cb9b4d956b19cb6f906eeca1a36ccfeae5b41f9c93d420f8032ee47
MD5 003d508e57c36242d2b10008d7460fbe
BLAKE2b-256 c702a2a2478d3da743222aa4c1203f932de84e337eadea0ab7709543562ea935

See more details on using hashes here.

File details

Details for the file tablers-0.8.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: tablers-0.8.0-cp310-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 3.8 MB
  • Tags: CPython 3.10+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.27.0 CPython/3.12.3 Linux/6.17.0-1015-azure

File hashes

Hashes for tablers-0.8.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8a805d19fbf743c544339a8eaa83423705929ac9d13f52ac47b5981f19072604
MD5 23bd6486ffc82f1bd26b73de6c3376f4
BLAKE2b-256 89b0cfd4313261f9b17fc745f26df869df595210606e8de1b443d6454675ef6c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page