Skip to content

ExtractPDF4J

Extract tables from selectable text, ruled grids, and scanned PDFs in Java. Export the results to CSV or JSON, or work with the rows directly in your application.

Watch the four parsing demos

Each demo shows the source PDF, the CLI command, and rows from the generated CSV. Get the sample PDFs, expected CSVs, and commands on GitHub.

Compare Java PDF tools

  • ExtractPDF4J extracts structured tables from text-based and scanned PDFs using stream, lattice, OCR stream, and hybrid modes.
  • Tabula Java extracts tables from text-based PDFs using stream and lattice modes. Tabula Java CLI and API
  • Apache PDFBox creates, edits, renders, and extracts text from PDFs. ExtractPDF4J uses it for PDF processing. PDFBox features · Command-line tools
  • Aspose.PDF for Java creates and edits PDFs and exposes table rows and cells through its TableAbsorber API. Aspose.PDF for Java · Table extraction example

✓ means the named tool provides the feature directly. ✗ means the feature requires other tooling or custom code.

Capability ExtractPDF4J Tabula Java Apache PDFBox Aspose.PDF for Java
Table extraction API ✓ ✓ ✗ ✓
OCR to tables in one workflow ✓ ✗ ✗ ✗
CLI exports tables to both CSV and JSON ✓ ✓ ✗ ✗
General-purpose PDF creation and editing ✗ ✗ ✓ ✓

For image-only pages, Tabula requires a text layer from an OCR tool. PDFBox can render pages for an external OCR engine, and Aspose provides PDF recognition through a separate Aspose.OCR product. Tabula scan guidance · PDFBox rendering · Aspose.OCR for Java

Try the ExtractPDF4J parsing demos to see the sample inputs and generated outputs.

Use the Java API

Start with HybridParser when the layout is mixed or unknown.

import com.extractpdf4j.helpers.Table;
import com.extractpdf4j.parsers.HybridParser;

import java.util.List;

public class QuickStart {
    public static void main(String[] args) throws Exception {
        List<Table> tables = new HybridParser("sample.pdf")
                .pages("all")
                .dpi(300f)
                .parse();

        if (!tables.isEmpty()) {
            System.out.println(tables.get(0).toCSV(','));
        }
    }
}

See the Java quickstart, installation guide, or CLI reference to run your first extraction.

Contribute

If ExtractPDF4J helps you, star the project so more Java developers can find it. Open an issue to share a bug or an idea, or fork the repository and follow the contributing guide.