ExtractPDF4J/ExtractPDF4J

Java PDF table extraction & OCR library. Extract structured tables from text-based and scanned PDFs using stream, lattice (OpenCV-style grid detection), and hybrid parsing.

What it solves

ExtractPDF4J eliminates the need to manually retype data from PDF tables, especially for documents that lack a text layer, such as scanned invoices, bank statements, and financial reports. It provides a way to programmatically extract clean rows and columns from both text-based and image-heavy PDFs.

How it works

The library uses a multi-strategy approach to identify and extract tabular data:

  • StreamParser: Extracts data from text-based PDFs using text coordinates via Apache PDFBox.
  • LatticeParser: Uses OpenCV to detect lines and grids in scanned or image-based PDFs to construct table structures.
  • OcrStreamParser: Employs Tesseract OCR to read text from documents where no text layer exists.
  • HybridParser: Orchestrates these strategies, automatically selecting or merging the best method based on the document's characteristics.

Who it’s for

This tool is designed for developers building production-grade document processing pipelines, specifically for fintech, banking platforms, analytics platforms, and enterprise ingestion workflows, as well as those preparing data for AI/ML pipelines.

Highlights

  • Native Java Support: Built for Java 17+ and available via Maven Central.
  • OCR Integration: Built-in support for scanned PDFs using Tesseract and OpenCV.
  • Flexible Parsing: Offers multiple modes (Stream, Lattice, OCR-hybrid) to handle different PDF types.
  • Deployment Options: Includes a CLI for quick extraction and a Spring Boot microservice for REST-based integration via Docker.
  • Declarative Config: Supports annotation-based configuration for defining parser settings.

Related

  • Project
  • Project
  • Project
  • Project
  • Project