Skip to content

Table Incorrectly Identified as Form Area in Scanned PDF #3454

Description

@akowalsk

Bug

In the attached scanned PDF, the tables on pages 1 and 4 are being tagged as "form" instead of "table", causing their contents to be processed into a "group" object instead of a "table" object in the docling document. I cannot determine any particular reason for this, as page 3 looks very similar to page 1 and page 4 looks similar to page 5. You can see this in the debug postprocessing image for the pages:

Image Image Image Image

...

Steps to reproduce

Using the attached file, run this:

import json
from docling.datamodel.settings import settings
from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import (
    VlmPipelineOptions,
    VlmConvertOptions,
    PdfPipelineOptions,
)
from docling.document_converter import DocumentConverter, PdfFormatOption
from docling.pipeline.vlm_pipeline import VlmPipeline

settings.debug.visualize_layout = True
settings.debug.visualize_tables = True
settings.debug.visualize_ocr = True

filename = "docling-layout-bug.pdf"

# vlm_options = VlmConvertOptions.from_preset("granite_docling")


# pipeline_options = VlmPipelineOptions(vlm_options=vlm_options)

# pipeline_options = PdfPipelineOptions()
# pipeline_options.do_ocr = True
# pipeline_options.do_table_structure = True


converter = DocumentConverter(
    # format_options={
    #     InputFormat.PDF: PdfFormatOption(
    #         pipeline_cls=VlmPipeline, pipeline_options=pipeline_options
    #     )
    # }
)

# Convert and export

result = converter.convert(filename)
json.dump(
    result.document.export_to_dict(),
    open("contents.json", "w", encoding="utf-8"),
    indent=2,
)

It also happens with the various commented out options enabled. They do not seem to affect the layout detection, just the contents.

...

Docling version

Docling version: 2.93.0
Docling Core version: 2.74.1
Docling IBM Models version: 3.13.2
Docling Parse version: 5.10.0
Python: cpython-312 (3.12.9)
Platform: macOS-15.7.4-arm64-arm-64bit
...

Python version

Python 3.12.9
...

docling-layout-bug.pdf

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions