- A Windows tool for converting documents (PDF · Word .docx · Markdown, scanned files included) between formats.
- Input:
.pdf,.docx,.md→ Output:.md,.docx,.pdf
- Input:
- Built as preprocessing for vector-embedding in RAG pipelines.
- Packaged as a GUI so non-developers can use it.
pdf2md_1_compressed.mp4
- Multi-format conversion — pick the output format (Markdown / Word / PDF) from the
Convert to:dropdown at the top.- Items whose input and output formats match are copied as-is (e.g.
.docx→.docx). - PDF output automatically embeds a system font (Malgun Gothic) so Korean and other CJK characters don't break.
- Items whose input and output formats match are copied as-is (e.g.
- Queue individual files or whole folders (including subfolders) and convert them sequentially.
- OCR for scanned PDFs — Korean, Japanese, Latin scripts, and more.
- Live display of per-page and overall progress, elapsed time, estimated completion time, and pages per second.
- Runs on a background thread — minimize the window and keep working on other things.
- "Open output folder" button, plus a per-item right-click menu of file actions.
- All status is written to the in-app log — no popup dialogs to interrupt your workflow.
- Markdown splitting — automatically split a large
.mdfile into a chosen number of chunks (to work around upload size limits on vector-embedding services).
git clone <this-repo>
cd pdf2md
.\setup.batsetup.batinstalls the Python packages automatically.- If Tesseract OCR is not installed, it downloads the installer and
kor.traineddata, then runs them. - Because Tesseract installs into
Program Files, a UAC administrator prompt will appear.
If you only need English or Chinese OCR, you can skip Tesseract — pip install -r requirements.txt alone installs RapidOCR, which handles those languages.
- Install Python 3.10 or newer from https://www.python.org/.
- Run
pip install -r requirements.txt. - (For Korean / Japanese / Cyrillic / Arabic, etc.) Install Tesseract from https://github.com/UB-Mannheim/tesseract/wiki, checking the language data you need during setup.
- On startup the GUI auto-detects Tesseract at
C:\Program Files\Tesseract-OCR\— no environment variables to configure.
- On startup the GUI auto-detects Tesseract at
Double-click pdf2md.bat, or run the command below.
python pdf2md_gui.py- Markdown is used as the hub format — every input is converted to Markdown first, then written out in the selected output format.
- PDF → Markdown: native text extraction via
pymupdf4llm. - DOCX → Markdown:
mammoth(semantic HTML conversion) +markdownify. - Markdown → DOCX:
markdown(→ HTML) +htmldocx(→ Word). - Markdown → PDF: rendered with the PyMuPDF
StoryHTML engine (CJK font embedded, then subset to minimize file size). - When the input and output formats are identical, the original is copied as-is with no round-trip (avoiding any loss of formatting).
- PDF → Markdown: native text extraction via
- For scanned files, if Tesseract is installed it runs pure Tesseract OCR — handling every writing system covered by the installed
traineddata. - If Tesseract is not installed, it falls back to RapidOCR (English and Chinese only).
- Output panel: choose the output format; by default it saves next to the source file, or to a folder you specify.
- OCR panel: toggles for auto-OCR / force-OCR and an OCR-language dropdown (default
kor+eng, applied to PDF inputs only).
- Click the
Split Markdown...button in the top toolbar to open the split dialog. - Specify an input
.mdfile and a chunk count (N) → produces N files namedfilename_part01.md,filename_part02.md, …. - Splits only at paragraph (blank-line) boundaries — paragraphs, lists, code blocks, and tables are never cut in the middle.
- Each chunk is distributed as evenly as possible — to avoid exceeding an embedding model's input limit.
- Example use: when a vector-embedding service (e.g. Google Vertex AI) hits its single-file size limit, split the same markdown into several chunks and upload them.
- The default language is
kor+eng— pick another from the OCR-language dropdown (Japanese, Chinese, German, etc.). - Some presets stack multiple languages with the
+symbol (e.g.kor+eng); the matching Tesseracttraineddatamust be installed for each code. - The first Korean conversion may be slightly slow due to Tesseract warm-up — subsequent pages run at roughly 0.5–2 seconds per page on a recent CPU.