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

Aperta
#445 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 5 giorni

@RaphaelFakhri ci sta già lavorando.

Dal 4/11/2026.

  • #446 di @RaphaelFakhri — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
cpp, python
Ambito
backend, data

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
C++
Stelle
346
Fork
92
Merge medio
4g 3h
PR unite (30g)
26

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di docling-project/docling-parse

Tutte le issue di docling-project/docling-parse

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.