Page geometry reports the crop box as the trim, bleed and art boxes (regression in 6.0.0)

Abierto
#445 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 5 días

@RaphaelFakhri ya está trabajando en esto.

Desde el 4/11/2026.

  • #446 de @RaphaelFakhri — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
cpp, python
Área
backend, data

Línea de trabajo

Start in docling_parse/pdf_parser.py at _to_page_geometry_from_decoder, then inspect the Python binding for the page dimension in src/parse/page_items/page_dimension.h. The issue identifies the missing box accessors and includes a reproducer using tests/pdf_builder.py; compare its output with the expected /TrimBox coordinates. Done means both parser classes report each declared page box instead of copying the crop box; linked pull request #446 is already open.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

SegmentedPdfPage.dimension reports trim_bbox, bleed_bbox and art_bbox equal to crop_bbox on every page, even when the page declares its own /TrimBox, /BleedBox or /ArtBox.

The native parser reads the three boxes correctly (page_item<PAGE_DIMENSION>::execute in src/parse/page_items/page_dimension.h), but the Python binding only exposes get_crop_bbox and get_media_bbox, and _to_page_geometry_from_decoder in docling_parse/pdf_parser.py fills the other three fields from the crop box:

art_bbox=_to_bounding_box(crop_bbox),
media_bbox=_to_bounding_box(media_bbox),
trim_bbox=_to_bounding_box(crop_bbox),
crop_bbox=_to_bounding_box(crop_bbox),
bleed_bbox=_to_bounding_box(crop_bbox),

Up to 5.0.0, _to_page_geometry read these fields from the rectangles of the page dimension (art-bbox, bleed-bbox, trim-bbox). Since 6.0.0 they always equal the crop box. Both DoclingPdfParser and DoclingThreadedPdfParser are affected.

Steps to reproduce
from io import BytesIO

from docling_parse.pdf_parser import DoclingPdfParser
from tests.pdf_builder import build_pdf, content_stream

pdf = build_pdf([
    "<< /Type /Catalog /Pages 2 0 R >>",
    "<< /Type /Pages /Kids [3 0 R] /Count 1 >>",
    "<< /Type /Page /Parent 2 0 R /MediaBox [0 0 300 400] /CropBox [10 10 290 390]"
    " /TrimBox [20 20 280 380] /Contents 4 0 R >>",
    content_stream("0 0 1 rg 50 50 100 100 re f"),
])
page = DoclingPdfParser().load(BytesIO(pdf)).get_page(1)
print(page.dimension.trim_bbox)
Expected

l=20.0 t=380.0 r=280.0 b=20.0, the page's /TrimBox.

Actual

l=10.0 t=390.0 r=290.0 b=10.0, the page's /CropBox.

Version

docling-parse 7.24.2 (current main); the same mapping exists since 6.0.0.

Lenguaje dominante
C++
Estrellas
346
Forks
92
Merge medio
4 d 3 h
PR fusionados (30 d)
26

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de docling-project/docling-parse

Todos los issues de docling-project/docling-parse

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.