Skip to content

Hesamsamani/Distilmark

✨ Distilmark ✨

📄 → 📝 The friendliest way to turn PDFs into beautiful Markdown

lint release python qt platform license version

🌙 Dark & Light themes · 🔌 8 engines · 📚 Courses · 👀 Editable preview · 📤 HTML / DOCX export · 🔭 Watch folder · 🦙 Offline ready


🌟 What is this?

Distilmark is a modern, lovingly-designed desktop app that converts PDF files into clean Markdown. Pick a backend — fully offline native parser, a local Ollama vision model, or any hosted LLM — drop your files in, and grab your .mds. That's it.

💡 Originally a fork of a PDF editor (pyPDFeditor-GUI), now reborn as a focused PDF → Markdown converter. The legacy editor still ships in the same repo.


🚀 Quick start

🪟
Windows

Grab the prebuilt .exe from the 📦 Releases page — no Python needed.

🐍
From source
pip install git+https://github.com/Hesamsamani/distilmark.git
distilmark
🛠️
Dev mode
git clone https://github.com/Hesamsamani/distilmark.git
cd distilmark && pip install -r requirements.txt
python -m distilmark

📖 Full setup notes: INSTALL.md


🔌 Conversion engines

Pick whichever vibe matches you:

Engine Icon Offline? Best for Notes
Native Speed, privacy, simple PDFs PyMuPDF + pymupdf4llm, with a heading heuristic fallback. Zero cost.
pdfplumber 📐 Table-heavy, layout-sensitive PDFs Layout-aware extraction, tables → GitHub-flavored Markdown. Tunable.
Compare Deciding which engine wins Runs native and pdfplumber at once, writes two files + a diff view.
Ollama 🦙 Tricky layouts, all-local LLM Uses local vision models (llama3.2-vision, llava, …).
OpenAI 🤖 Highest fidelity, easy setup gpt-4o-mini and friends.
Anthropic 🧠 Great structure on dense PDFs Claude Haiku/Sonnet/Opus with vision.
OpenAI-compatible 🌐 🤷 Groq · OpenRouter · LM Studio · vLLM · anything custom Plug in any /chat/completions endpoint.
AWS Bedrock ☁️ Claude · Nova on your own AWS account Native SigV4 (no boto3, no proxy). Uses the Bedrock Converse API, so any vision model works.

✨ Features

  • 🎯 Multiple engines — eight backends, one UI, switch in a single click
  • 📚 Courses & chapters — organise PDFs into courses with chapters and a library view showing which files are added vs converted. Built for exam prep when you've got dozens of per-chapter PDFs; convert all pending docs in one click and double-click any converted file to open it in Preview.
  • 👀 Live preview, editable — source PDF page beside the rendered Markdown, with a Source/Edit tab to tweak the output and Save back to disk. Compare mode adds Native / pdfplumber / Diff tabs side-by-side.
  • 📤 Export anywhere — one click for HTML, DOCX (Pandoc when available, python-docx fallback), or combined .md when batching a folder.
  • 🤖 Custom LLM prompt — edit the conversion prompt right from the Engines tab; presets for Academic paper, Code-heavy, Tables-only.
  • 🔬 Math mode — wraps formulas in $…$ / $$…$$ LaTeX for academic PDFs.
  • 🌀 Streaming output — watch the Markdown appear token-by-token from Ollama/OpenAI/Anthropic.
  • 🔭 Watch folder — point Distilmark at a folder; new PDFs are auto-queued (and optionally auto-converted) — perfect for scanner workflows.
  • 🧪 Auto-detect scanned PDFs — files with no extractable text get tagged in the queue so you know to enable OCR.
  • 🎚️ Per-file engine override — right-click a queued file to convert it with a different engine than the rest of the batch.
  • 🔀 Drag-reorder + multi-select queue — reorder, remove, or delete-key your queue items.
  • ⌨️ Keyboard shortcutsCtrl+O add files · Ctrl+Shift+O add folder · Ctrl+Enter convert · Esc cancel · Ctrl+1..5 switch tabs.
  • Quick actions after a conversion — Open output folder, Copy Markdown to clipboard, Open in Obsidian, Export HTML/DOCX, Combine.
  • 📂 More input formats — PDF, DOCX (via Pandoc), EPUB, XPS, FictionBook (FB2), comic archives (CBZ), SVG, TXT, and image inputs (PNG/JPG).
  • Dual-engine compare — run native + pdfplumber together and get two files (name_native.md + name_pdfplumber.md) to judge for yourself
  • 🔍 OCR fallback — scanned/image-only pages are run through Tesseract automatically (when installed)
  • 🎯 Page-range selection — convert just pages 5–20 of a 500-page monster
  • 🛑 Cancel anytime — a Cancel button stops a long batch mid-run
  • 💲 Cost estimator — see a rough $ estimate before firing off a paid LLM job
  • Parallel pages — hosted LLM engines can process N pages concurrently for a big speedup
  • 🧹 Post-processing — merge hyphenated line breaks, collapse blank lines, strip repeating headers/footers
  • 🔧 pdfplumber tuning — table strategies & snap tolerance exposed in Advanced options
  • 🔒 Privacy-first — fully offline mode, your PDFs never leave your machine
  • 🪄 Drag & drop files or folders — drop a whole folder and every PDF inside gets queued automatically
  • 📂 Smart folder scanning — recursively finds all .pdf files in a folder, adds them to the queue in one click
  • 📚 Batch convert — feed it dozens of PDFs at once, processed one by one with live progress
  • 🖼️ Image extraction with relative paths — embedded images are saved and referenced as ./name_images/page1_img1.png so previews work in VS Code, Obsidian, Typora, and any markdown viewer
  • 📋 Conversion history — every run (success or failure) is logged with timestamp, engine, filename, and page count; persisted across sessions at ~/.distilmark/history.json
  • 🦙 Ollama model management — choose a preset tier, browse installed models, and download new ones — all from inside the app
  • 🌗 Dark & Light themes — modern Tokyo-Night–style dark / clean light
  • 🧵 Threaded worker — UI stays buttery smooth on long jobs
  • 📊 Live progress — per-page progress bar and status messages
  • 🧩 Persistent settings~/.distilmark/config.json
  • 🔑 Hidden keys — API tokens entered as password fields
  • 📦 Prebuilt .exe — one-click Windows install via GitHub Actions

🖼️ A peek inside

Convert — drag in files or a folder, pick an engine, tune the advanced options:

Distilmark — Convert page (dark theme)

Courses — organise your PDFs into courses & chapters and track what's converted:

Distilmark — Courses page with chapters and a library view

Preview (live side-by-side) — original PDF page next to the rendered + editable Markdown.

The preview pane now has improved guidance: when no file is loaded it tells you to convert a PDF containing images (use files under test/ or any PDF with figures) so you can see the left-side PDF render + right-side Markdown with properly resolved extracted images (./..._images/...png).

This makes the image extraction + preview demo much clearer.

Engines — manage Ollama and configure every offline & hosted back-end:

Distilmark — Engines settings page

Light theme — the same UI, clean and bright:

Distilmark — Convert page (light theme)


🦙 Going offline with Ollama

Distilmark has built-in Ollama model management — no terminal needed.

Pick a preset tier

Tier Model VRAM needed Best for
🚀 Powerful llama3.2-vision:90b 64 GB+ Maximum accuracy, research PDFs
Balanced llama3.2-vision:11b 8 GB+ Great quality, most users
💨 Light moondream:latest 4 GB+ Speed, simple documents

Download a model from inside the app

  1. Open Engines tab → Ollama section
  2. Click a preset button to fill the model name, or type your own
  3. Click ⬇ Pull / Download — a live progress bar shows GB downloaded
  4. When done, the model appears in the Active model dropdown automatically

Manual terminal setup

# install Ollama: https://ollama.com/download
ollama serve                          # start the server
ollama pull llama3.2-vision:11b       # or any vision model

# in Distilmark → Engines → Test connection → ✓ Connected — 1 model

100% local. Zero network calls. Zero API bills. 🎉


📋 Conversion history

Every file you convert is logged automatically:

✓  2026-06-01 15:30:12  |  report.pdf → report.md    |  native    |  12 pages
✓  2026-06-01 14:55:08  |  thesis.pdf → thesis.md    |  ollama    |  87 pages
✗  2026-06-01 14:40:01  |  broken.pdf                |  native    |  0 pages
  • History is stored at ~/.distilmark/history.json and survives restarts
  • Switch to the History tab any time to review past conversions
  • Colour-coded: green ✓ for success, red ✗ for errors
  • Clear button wipes the log when you no longer need it

📂 Folder scanning

Drop a whole folder onto the window (or click Add Folder) and Distilmark recursively finds every PDF inside — including sub-folders — and adds them all to the queue. Files are then converted one by one with a File N/total counter so you always know where you are.


🛠️ Build your own .exe

Recommended (lean + fast binary):

Use a clean virtual environment with only the real dependencies, then build with the project spec (it excludes heavy ML packages like torch/sklearn that bloat the exe to 400-500 MB and slow startup).

python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt pyinstaller pillow
# Now build using the spec (excludes unnecessary huge packages)
pyinstaller --clean -y Distilmark.spec
# → dist\Distilmark.exe  (~110 MB typical, much faster to start)

If you prefer the manual command, at least add excludes:

pyinstaller --noconfirm --onefile --windowed --name Distilmark `
  --collect-all pymupdf --collect-all pymupdf4llm --collect-all pdfplumber `
  --exclude-module torch --exclude-module tensorflow --exclude-module sklearn `
  --exclude-module pandas --exclude-module matplotlib --exclude-module scipy `
  --icon icon.ico distilmark_launcher.py

Or just push a v* tag — the release workflow builds and uploads Distilmark.exe to GitHub Releases automatically (using the lean spec).


📁 Where settings live

OS Path
🪟 Windows C:\Users\YOU\.distilmark\config.json
🍎 macOS ~/.distilmark/config.json
🐧 Linux ~/.distilmark/config.json

🧰 Tech stack

Python Qt PyMuPDF Ollama OpenAI Anthropic


📜 Legacy: pyPDFeditor-GUI

The original PDF-editor app this fork was born from is still included. Launch it with:

pdfeditor

Features include: merging PDFs/images/e-books · deleting/rotating/rearranging pages · extracting images · adding watermarks · password & permissions · catalogue & metadata editing.

📁 Its settings live at ~/.pyPDFeditor-GUI/.


🤝 Contributing

PRs, issues, and ✨ stars ✨ all warmly welcome.

  1. 🍴 Fork
  2. 🌿 Create a branch
  3. 🛠️ Code away
  4. 📬 Open a PR

🙏 Credits & acknowledgments

Distilmark stands on the shoulders of some excellent open-source projects. Huge thanks to all of them:

Foundations

  • pyPDFeditor-GUI by Nianze A. TAO — the original PDF-editor project Distilmark was forked from.
  • PyMuPDF (fitz) — core PDF parsing, rendering, and image extraction.
  • pymupdf4llm — high-quality Markdown extraction for the native engine.
  • pdfplumber by Jeremy Singer-Vine — the layout-aware, table-savvy extraction engine.
  • PyQt6 / Qt — the cross-platform GUI toolkit.

Engines & runtimes

Design & tooling

  • UI/UX Pro Max by nextlevelbuilder — the design-intelligence skill that guided the v1.0 redesign (palette, typography, layout, accessibility).
  • Inter by Rasmus Andersson — the primary UI typeface.
  • PyInstaller — packages the Windows .exe.

📄 License

MIT — see LICENSE. Use it, fork it, ship it. 💜

Made with ❤️ + ☕ + a lot of 🐍

If Distilmark saved you time, give it a star!

About

Modern PDF → Markdown converter with offline (PyMuPDF, Ollama) and hosted (OpenAI, Anthropic, OpenAI-compatible) engines. PyQt6 desktop app with dark/light themes, drag-and-drop batch conversion, and prebuilt Windows .

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors

Languages