docling-project / docling-project/docling
Export to markdown does not save image references
- Dominant language
- Python
- Stars
- 66.4k
- Forks
- 4.8k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 84
Description
### Bug
`document.export_to_markdown(image_mode=ImageRefMode.REFERENCED)` does not save image references
### Steps to reproduce
```
def convert_pdf_to_markdown_docling(file_path: str, output_dir: str) -> str:
"""
Convert a PDF file to Markdown using Docling.
Args:
input_path (str): Path to the input PDF file.
output_path (str): Path to the output Markdown file.
Returns:
str: The markdown content
"""
IMAGE_RESOLUTION_SCALE=2.0
pipeline_options = PdfPipelineOptions(do_ocr=False)
pipeline_options.images_scale = IMAGE_RESOLUTION_SCALE
pipeline_options.generate_page_images = True
pipeline_options.generate_picture_images = True
doc_converter = DocumentConverter(
format_options={
InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options)
}
)
conv_res = doc_converter.convert(file_path)
return conv_res.document.export_to_markdown(image_mode=ImageRefMode.REFERENCED)
```
The save_to_markdown() with the image_mode=ImageRefMode.REFERENCED works, but i am trying to keep it consistent to my codebase by returning the markdown
### Docling version
```
Docling version: 2.31.0
Docling Core version: 2.30.0
Docling IBM Models version: 3.4.3
Docling Parse version: 4.0.1
Python: cpython-311 (3.11.3)
Platform: Linux-6.10.14-linuxkit-x86_64-with-glibc2.36
```
### Python version
Python 3.11.3
Contributor guide
Assessment
This issue has not been assessed yet.