Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.
Python ai4sciencedocument-analysisdocxextract-datalayout-analysisocrparserpdfpdf-converterpdf-extractor-llmpdf-extractor-pretrainpdf-extractor-ragpdf-parserpptxpythonxlsx
fix: enhance image handling in DocxConverter to support anchored images and adjust text placement
myhloli45a9da0d8526
diff --git a/mineru/model/docx/docx_converter.py b/mineru/model/docx/docx_converter.pyindex 40947997..552e61cd 100644--- a/mineru/model/docx/docx_converter.py+++ b/mineru/model/docx/docx_converter.py@@ -342,11 +342,23 @@ class DocxConverter:logger.debug("could not parse a table, broken docx table")# 检查图片元素elif drawing_blip:- # 处理图片元素- self._handle_pictures(drawing_blip)- # 如果是段落元素,同时处理其中的文本内容(如描述性文字)- if tag_name == "p":+ # 判断图片是否为锚定(浮动)图片+ is_anchored = bool(+ element.findall(+ ".//wp:anchor",+ namespaces=DocxConverter._BLIP_NAMESPACES,+ )+ )+ # 锚定图片在段落中浮动定位,段落文本应出现在图片之前+ if is_anchored and tag_name == "p":self._handle_text_elements(element)+ self._handle_pictures(drawing_blip)+ else:+ # 处理图片元素+ self._handle_pictures(drawing_blip)+ # 如果是段落元素,同时处理其中的文本内容(如描述性文字)+ if tag_name == "p":+ self._handle_text_elements(element)# 检查 sdt 元素elif tag_name == "sdt":sdt_content = element.find(