Open-Source Python & CLI Reference

Offline Python PDF to CSV Library & CLI (CPU, CUDA, ROCm, Docker)

Quick summary: Install pdf-to-csv-table-extractor (MIT License, Python 3.11–3.14) to run the exact TableCSV extraction engine 100% offline with zero page limits, zero external OS binaries, pandas/polars exports, and optional NVIDIA CUDA or AMD ROCm GPU speedup.

Install in one command (zero OS binaries)

Requires Python 3.11–3.14 on Linux, macOS, or Windows. No Java, Ghostscript, Poppler, or Tesseract required:

# Standard CPU install (PyPI)
pip install pdf-to-csv-table-extractor

# Include Arabic / Persian / Urdu right-to-left (RTL) ordering
pip install "pdf-to-csv-table-extractor[rtl]"

# One-shot execution with uvx (no virtualenv needed)
uvx --from pdf-to-csv-table-extractor \
  pdf2csv-tables extract report.pdf --utf8-bom -o output/

Multi-table merge modes

ModeCLI FlagBehavior
Schema Merge (default)--merge schemaMerges matching tables across pages (repeated headers + headerless continuations) into one CSV per table schema while keeping distinct tables separate.
Per-Table--merge noneEmits one separate CSV file for every individual table detected on every page.
Combine All--merge allConcatenates every extracted table in the document into a single CSV file.

Python Library API (PDFs, images, folders & in-memory bytes)

from pathlib import Path
from pdf_table_extractor import ExtractionConfig, extract_tables

cfg = ExtractionConfig(
    text_source="auto",       # "auto" (native + OCR fallback) | "ocr" | "native"
    ocr_lang="en",            # any of 50 built-in or custom ONNX languages
    merge="schema",           # "schema" | "none" | "all"
    deduplicate_headers=True,
    deskew=True,
    borderless_tables=True,
    utf8_bom=True,
    device="auto",            # "auto" | "cpu" | "cuda" | "rocm"
    workers=0,                # 0 = auto multi-core CPU parallelism
)

# Works on PDF path, single image, folder of images, PIL.Image, or raw bytes
result = extract_tables(Path("report.pdf"), cfg)
print(f"Found {len(result)} tables (native={result.native_text_pages}p)")

for table in result:
    table.to_csv(f"output/{table.slug}.csv")
    df = table.to_dataframe()  # pandas (or table.to_polars())

result.export_zip("output/all_tables.zip", include_manifest=True, utf8_bom=True)

GPU acceleration (NVIDIA CUDA & AMD ROCm) & Docker

Digital PDFs finish in milliseconds on CPU via native vector text boxes. For high-volume scanned PDFs and image folders, GPU acceleration speeds up RapidOCR by 3×–4.6×:

# Check GPU / ONNX / PyTorch readiness
pdf2csv-tables doctor

# NVIDIA CUDA acceleration (swap CPU onnxruntime after install)
pip uninstall -y onnxruntime && pip install "onnxruntime-gpu>=1.18.0"
pdf2csv-tables extract scans.pdf --device cuda -o output/

# AMD ROCm (Linux) via PyTorch HIP
pip install torch --index-url https://download.pytorch.org/whl/rocm7.1
pdf2csv-tables extract scans.pdf --device rocm -o output/

# Multi-target Docker (cpu, cuda, or rocm)
docker build --target cpu -t pdf2csv-tables:cpu .
docker run --rm -v "$PWD:/data" \
  pdf2csv-tables:cpu extract /data/report.pdf -o /data/out

Air-gapped compliance & enterprise support

Pre-cache language packs once via pdf2csv-tables languages install en de ar and run with zero internet egress inside HIPAA, SOC2, or GDPR VPC boundaries. Need custom layout tuning, managed REST API throughput, or a commercial SLA? Reach out via the TableCSV contact form.

Frequently asked questions

Does pdf-to-csv-table-extractor work 100% offline for HIPAA, SOC2, or GDPR records?

Yes. Once language packs are pre-installed (`pdf2csv-tables languages install en` or baked into your Docker image), the engine makes zero network requests, sends no telemetry, and requires no cloud API keys.

Which Python versions and operating systems are supported?

Python 3.11 through 3.14 on Linux, macOS, and Windows, with zero external OS binaries (no Java JVM, Ghostscript, Poppler, or Tesseract installation needed).

How do I enable NVIDIA CUDA or AMD ROCm GPU acceleration?

Run `pdf2csv-tables doctor` to inspect your hardware. For NVIDIA CUDA, swap `onnxruntime` for `onnxruntime-gpu>=1.18.0`. For AMD ROCm on Linux, install PyTorch ROCm (or `onnxruntime-migraphx`), or use the ready-made `cuda` and `rocm` targets in the repository Dockerfile. `--device auto` automatically routes OCR onto your GPU.

When should I use the managed Commercial API instead of self-hosting?

Self-host the MIT Python library when you already operate Python/Docker jobs or require strict air-gapped processing. Contact us for Pro API & Enterprise plans when you want a managed high-throughput REST API with async webhooks, custom document template tuning, accuracy QA, or an enterprise support SLA.