Skip to content
ComPDF
DemoFAQ
New Release

Open-Source PDF SDK & AI Document Processing

Get the full self-hosted SDK and AI document processing on GitHub. One-click deploy to quickly build your document workflows.

Table Recognition

Overview

Table Recognition is a dedicated AI stage that reconstructs the internal structure of tables detected during layout analysis — rows, columns, merged cells, and cell boundaries — so that the converted document preserves the original tabular semantics rather than producing a flat grid of text fragments.

It is controlled by the independent option enableAiTableRecognition, which is enabled by default. The table model is only invoked for table regions reported by layout analysis whose detection confidence is below the trusted threshold; high-confidence native PDF tables bypass the model to save inference time.

Typical scenarios that benefit from Table Recognition:

  • Borderless or partially bordered tables, where ruling lines alone cannot describe the structure.
  • Tables with merged header cells, multi-row headers, or spanning cells, such as financial statements, lab reports, and invoices.
  • Scanned tables processed by OCR, where geometric reconstruction is required before cell-level data extraction.

Features that support Table Recognition:

  • PDF to Word
  • PDF to Excel
  • PDF to PowerPoint (PPT)
  • PDF to HTML
  • PDF to RTF
  • PDF to CSV
  • Extract PDF to JSON
  • Extract PDF to Markdown

Notice

  • Table Recognition runs only when layout analysis is active (i.e. enableAiLayout is enabled, or implicitly when enableOcr is enabled).
  • You need to load the DocumentAI model before using Table Recognition, or plug in your own table model via the callbacks described in Use Custom AI Models via Callbacks.
  • Disabling enableAiTableRecognition turns the table model off entirely; detected table regions then fall back to geometric reconstruction from the underlying page objects.

Sample

This sample demonstrates how to convert a PDF to a Word document with Table Recognition enabled.

kotlin
ConverterManager.setAIModel("<model_path>")

val wordOptions = WordOptions()
wordOptions.enableAiLayout = true
wordOptions.enableAiTableRecognition = true // enabled by default in 4.1
val error = ComPDFKitConverter.startPDFToWord("input.pdf", "", "output.docx", wordOptions)