Batch convert PDF, DOCX, PPTX, and XLSX files to Markdown using the mineru engine.
A simple Python CLI tool that wraps mineru to convert office documents and PDFs into clean Markdown with extracted images.
- ๐ Multi-format โ PDF, DOCX, PPTX, XLSX
- ๐ผ๏ธ Image extraction โ Auto-extracts embedded images to
images/subdirectory - ๐ Multi-language โ Chinese, Japanese, Korean, Arabic, and more
- ๐ฆ Batch mode โ Process entire directories at once
- ๐ OCR support โ For scanned documents and image-based PDFs
- ๐งน Auto-cleanup โ Removes intermediate files by default
# Clone the repo
git clone https://github.com/thousandcents/convert-file2md.git
cd convert-file2md
# Install dependencies
pip install mineru
# Make it executable
chmod +x convert2md.py# Single file
python3 convert2md.py -i document.pdf -o ./output/
# Batch
python3 convert2md.py -i ./input/ -o ./output/
# Chinese document
python3 convert2md.py -i ไธญๆๆๆกฃ.pdf -o ./output/ -l ch
# Scanned PDF (OCR mode)
python3 convert2md.py -i scanned.pdf -o ./output/ -m ocr-h, --help Show help message
-i, --input PATH Input file or directory (default: ./input/)
-o, --output PATH Output directory (default: ./output/)
-b, --backend BACKEND mineru backend: pipeline (default), vlm-http-client,
hybrid-http-client, vlm-auto-engine, hybrid-auto-engine
-m, --method METHOD Parse method: auto (default), txt, ocr
-l, --lang LANG Document language: en (default), ch, japan, korean, ...
--keep-intermediates Keep temp files (default: clean up)
output/
โโโ DocumentName/
โโโ DocumentName.md
โโโ images/
โโโ image1.png
โโโ image2.jpg
- Python 3.7+
- mineru CLI โ install via
pip install mineru
This tool was originally created as a skill for Hermes Agent to enable document-to-markdown conversion within AI agent workflows. It can be used standalone or integrated into any automation pipeline.
MIT