Skip to content

docs: add visual-safe reader export example - #3919

Draft
one-num-three wants to merge 1 commit into
docling-project:mainfrom
one-num-three:agent/export-pdf-visual-blocks
Draft

docs: add visual-safe reader export example#3919
one-num-three wants to merge 1 commit into
docling-project:mainfrom
one-num-three:agent/export-pdf-visual-blocks

Conversation

@one-num-three

Copy link
Copy Markdown

Summary

Adds a documented export_visual_blocks.py example for converting research PDFs into reader-oriented Markdown with source-positioned visual assets.

Why

A semantic PDF conversion can emit chart labels, table cells, and diagram glyphs as ordinary text. In a reader this creates duplicated content, broken reading order, and apparent gibberish after a figure. Vector-only charts can also be absent from image extraction.

What changes

  • preserve Docling pictures and tables as Markdown image assets;
  • crop formula provenance boxes from the source PDF for faithful rendering;
  • skip text items whose bounding box is substantially covered by a visual item, while retaining captions;
  • detect captioned vector/raster figure and table regions from PDF geometry as a fallback;
  • add the rendered example to the documentation navigation.

Impact

This is an opt-in documentation example. It does not change Docling's conversion defaults or public APIs. It needs the optional pymupdf package.

Validation

  • ruff check docs/examples/export_visual_blocks.py
  • ruff format --check docs/examples/export_visual_blocks.py
  • python -m py_compile docs/examples/export_visual_blocks.py
  • verified the required PdfPipelineOptions fields against an installed Docling environment
  • the example CLI loads and exposes --input, --output, and --pages

A real-PDF end-to-end smoke run was attempted with a one-minute local command limit; it exceeded that limit during Docling model initialization, so full conversion should be exercised in the project CI or a fully warmed environment.

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

DCO Check Passed

Thanks @one-num-three, all your commits are properly signed off. 🎉

@one-num-three

one-num-three commented Jul 31, 2026 via email

Copy link
Copy Markdown
Author

@mergify

mergify Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

@one-num-three
one-num-three force-pushed the agent/export-pdf-visual-blocks branch from f05894a to a05de50 Compare July 31, 2026 11:21
Signed-off-by: 可可磨成粉 <16092910+Keke_cocoa@user.noreply.gitee.com>
@one-num-three
one-num-three force-pushed the agent/export-pdf-visual-blocks branch from a05de50 to d9eee08 Compare July 31, 2026 12:32
@dolfim-ibm

Copy link
Copy Markdown
Member

@one-num-three can you please provide an example of the export with and without your code?

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.

2 participants