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, specifically targeting documents that are difficult to parse, such as scanned invoices, bank statements, and financial reports. It provides a way to extract clean rows and columns even when a PDF lacks a text layer.

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 positions via PDFBox.
  • LatticeParser: Handles scanned or ruled PDFs by rendering pages to images and using OpenCV to detect lines and grids.
  • OcrStreamParser: Uses Tesseract OCR to extract text from image-heavy documents where no text layer exists.
  • HybridParser: Orchestrates these strategies to automatically select the best method for the document.

Who it’s for

It is designed for developers building production-grade document processing pipelines, specifically for fintech, banking platforms, analytics platforms, and AI/ML data preparation workflows.

Highlights

  • Native OCR Support: Handles scanned and image-based PDFs without requiring external text layers.
  • Java-Native: Built for Java 17+ and available via Maven Central.
  • Flexible Output: Supports exporting extracted tables to CSV or JSON formats.
  • Declarative Configuration: Offers annotation-based configuration for defining parser settings.
  • Deployment Ready: Includes a Spring Boot microservice wrapper and Docker support for easy API deployment.

Related

  • Project
  • Project
  • Project
  • Project
  • Project