mirror of
https://github.com/DS4SD/docling.git
synced 2025-07-31 14:34:40 +00:00
Add export with referenced images to export_figures example
Signed-off-by: Christoph Auer <cau@zurich.ibm.com>
This commit is contained in:
parent
35c73938a7
commit
9777f41137
@ -71,10 +71,16 @@ def main():
|
||||
element.get_image(conv_res.document).save(fp, "PNG")
|
||||
|
||||
# Save markdown with embedded pictures
|
||||
content_md = conv_res.document.export_to_markdown(image_mode=ImageRefMode.EMBEDDED)
|
||||
md_filename = output_dir / f"{doc_filename}-with-images.md"
|
||||
with md_filename.open("w") as fp:
|
||||
fp.write(content_md)
|
||||
conv_res.document.save_as_markdown(md_filename, image_mode=ImageRefMode.EMBEDDED)
|
||||
|
||||
# Save markdown with externally referenced pictures
|
||||
md_filename = output_dir / f"{doc_filename}-with-image-refs.md"
|
||||
conv_res.document.save_as_markdown(md_filename, image_mode=ImageRefMode.REFERENCED)
|
||||
|
||||
# Save HTML with externally referenced pictures
|
||||
html_filename = output_dir / f"{doc_filename}-with-image-refs.html"
|
||||
conv_res.document.save_as_html(html_filename, image_mode=ImageRefMode.REFERENCED)
|
||||
|
||||
end_time = time.time() - start_time
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user