Repolode
huridocs

huridocs/pdf-document-layout-analysis

A Docker-based microservice and Gradio UI that segments PDF pages into titles, text, tables, pictures and more, with OCR and Markdown/HTML conversion.

Open-source alternative to:Adobe Acrobat

Stars
1,357
Forks
148
Open issues
14
Last commit
14 days ago

What is it?

This project is a microservice for PDF layout analysis. It segments each page into elements such as titles, text, tables, pictures, formulas, captions and headers or footers, and classifies them. It also determines a reading order for these elements, so the output can be used for downstream processing.

Beyond analysis, the service offers OCR through Tesseract and ocrmypdf, extraction of tables as HTML and formulas as LaTeX, and conversion of PDFs to Markdown or HTML. Translation of converted output into other languages is supported through Ollama models. A Gradio web interface and a REST API are both included, and the service runs in Docker with optional GPU support.

Two model options are provided: VGT, a vision-based model that is more accurate but needs a GPU for good speed, and LightGBM models that run on CPU using Poppler XML features and are faster but somewhat less accurate.

Key features

  • 01Classifies page elements into 11 types, including titles, text, tables, pictures and formulas.
  • 02Provides OCR for scanned PDFs with rotation and deskew options.
  • 03Converts PDFs to Markdown or HTML, with optional translation via Ollama.
  • 04Extracts tables as HTML and formulas as LaTeX.
  • 05Offers both a Gradio web UI and a REST API.

Use cases

  • Preprocessing PDF reports or academic papers before indexing or retrieval.
  • Converting scanned documents into searchable PDFs with OCR.
  • Extracting a table of contents or structured text from long documents.
  • Translating converted Markdown or HTML documents into several languages.

Quick start

  1. 1

    Start the service with make

    make start
  2. 2

    Open the Web UI in your browser

  3. 3

    Analyze a PDF via the REST API

    curl -X POST -F 'file=@/path/to/your/document.pdf' http://localhost:5060
  4. 4

    Stop the service

    make stop

Things to know

  • Requires Docker, and models and dependencies take up to 10 GB of disk space.
  • GPU support is optional, but the README lists 5 GB GPU memory for best performance.
  • Translation depends on a running Ollama model.

Topics

FAQ

What is pdf-document-layout-analysis?
A Docker-based microservice and Gradio UI that segments PDF pages into titles, text, tables, pictures and more, with OCR and Markdown/HTML conversion. This project is a microservice for PDF layout analysis. It segments each page into elements such as titles, text, tables, pictures, formulas, captions and headers or footers, and classifies them. It also determines a reading order for these elements, so the output can be used for downstream processing.
Is pdf-document-layout-analysis free to use? What license does it have?
pdf-document-layout-analysis is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is pdf-document-layout-analysis still maintained?
Actively maintained. The last commit to pdf-document-layout-analysis was on Oct 6, 2026.
What can I use pdf-document-layout-analysis for?
Preprocessing PDF reports or academic papers before indexing or retrieval. Converting scanned documents into searchable PDFs with OCR. Extracting a table of contents or structured text from long documents. Translating converted Markdown or HTML documents into several languages.
How do I install pdf-document-layout-analysis?
Start the service with make: make start Open the Web UI in your browser Analyze a PDF via the REST API: curl -X POST -F 'file=@/path/to/your/document.pdf' http://localhost:5060 Stop the service: make stop
Where can I get pdf-document-layout-analysis?
The source code and installation instructions are on GitHub: https://github.com/huridocs/pdf-document-layout-analysis

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects