Skip to content

feat(docling-serve-api): expose PDF heading hierarchy options in ConvertDocumentOptions - #1

Closed
edeandrea wants to merge 2 commits into
mainfrom
feature/heading-hierarchy-options
Closed

edeandrea wants to merge 2 commits into
mainfrom
feature/heading-hierarchy-options

Conversation

@edeandrea

Copy link
Copy Markdown
Owner

Summary

Expose Docling's HeadingHierarchyOptions in the docling-java API so callers can enable PDF section-header level inference from bookmarks, outline numbering and visual style.

What changed

HeadingHierarchyOptions (new)

  • 8 fields mirroring docling-serve: useBookmarks, useNumbering, useStyle, useFontStyle, styleSizeTolerance, numberingSchemes, maxLevel, bookmarkMatchThreshold
  • No enabled field — the presence of headingHierarchyOptions on ConvertDocumentOptions is the switch

ConvertDocumentOptions (modified)

  • New headingHierarchyOptions field (serialises as pdf_heading_hierarchy_options)
  • Derived doPdfHeadingHierarchy() getter — returns true when options are non-null, false otherwise
  • @Builder no longer has a doPdfHeadingHierarchy parameter

Tests

  • HeadingHierarchyOptionsTests — builder, getters, immutability, toBuilder
  • ConvertDocumentOptionsTests — with/without hierarchy, toBuilder preservation
  • AbstractDoclingServeClientTests.shouldInferHeadingHierarchyFromPdfNumbering — real-container test that converts a PDF with numbering and asserts multiple distinct heading levels are assigned

Docs

  • Updated whats-new.md (Docling Serve section)
  • Updated serve-api.md options list

Ref docling-project#754

…ertDocumentOptions

Introduce HeadingHierarchyOptions with all docling-serve fields except
enabled (which is derived from the presence of this options object).
Add a derived doPdfHeadingHierarchy() getter that returns true when
headingHierarchyOptions is non-null.

Add unit tests for both options classes and a real-client integration
test that verifies heading levels are inferred from PDF numbering.

Update serve-api.md documentation to list the new option.

Ref docling-project#754

Signed-off-by: Eric Deandrea <eric.deandrea@ibm.com>
Add  and  entry to
the Docling Serve section of what's new.

Signed-off-by: Eric Deandrea <eric.deandrea@ibm.com>
@edeandrea

Copy link
Copy Markdown
Owner Author

Opened by mistake against the fork; the real PR is docling-project#756.

@edeandrea edeandrea closed this Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant