A powerful PDF to Markdown converter with GUI preview, powered by the marker-pdf library. Features GPU acceleration, side-by-side PDF and Markdown preview, and export to both Markdown and Word formats.
- 📄 High-Quality Conversion: Converts PDF documents to Markdown with excellent formatting preservation
- 🖼️ Image Extraction: Automatically extracts and saves embedded images from PDFs
- 👁️ Live Preview: Side-by-side PDF and Markdown preview with page navigation
- 🚀 GPU Acceleration: 3-10x faster conversion on NVIDIA GPUs (RTX series)
- 📝 Multiple Export Formats: Export to Markdown (.md) or Word (.docx)
- 🎯 User-Friendly GUI: Simple tkinter-based interface for easy operation
The application features three main panels:
- Left: PDF canvas preview
- Right: Markdown text preview
- Bottom: Page navigation controls
- Windows OS (other platforms may work with minor modifications)
- Python 3.8 or higher
- (Optional) NVIDIA GPU with CUDA support for faster processing
-
Clone the repository
git clone https://github.com/ToGoRun/PDF_To_Markdown.git cd PDF_To_Markdown -
Run the application (automatic setup)
.\run.batThe script will automatically:
- Create a virtual environment
- Install all required dependencies
- Launch the application
For NVIDIA GPU users, enable GPU acceleration for 3-10x faster conversion:
# Check if GPU is detected
.\check_gpu.bat
# Install CUDA-enabled PyTorch
.\setup_gpu.batFor high-quality Word export, install Pandoc:
# Run the installation helper
.\install_pandoc.bat
# Or download manually from:
# https://github.com/jgm/pandoc/releases/latestNote: If Pandoc is not installed, the application will automatically use python-docx as a fallback.
-
Launch the application
.\run.bat -
Convert a PDF
- Click "选择PDF文件" to select your PDF file
- Click "开始转换" to start conversion
- Use navigation buttons to preview different pages
- Export using "导出Markdown" or "导出Word"
-
View Results
- Markdown files are saved with extracted images in
{filename}_images/folder - Word documents include all content and images
- Markdown files are saved with extracted images in
- Conversion Engine: marker-pdf - State-of-the-art PDF to Markdown conversion
- PDF Rendering: PyMuPDF (fitz) for fast PDF preview
- GUI Framework: tkinter (built-in Python GUI library)
- GPU Acceleration: PyTorch with CUDA support
On first run, the application downloads AI models (~1-2GB) to the ./models/ directory. These models are cached for future use, so subsequent conversions are much faster.
The application automatically detects available compute devices:
- ✅ CUDA GPU (NVIDIA)
- ✅ CPU fallback
GPU information is displayed in the status bar when a GPU is detected.
Core libraries:
marker-pdf- PDF to Markdown conversion enginePyMuPDF- PDF rendering and previewPillow- Image processingpython-docx- Word document generationpypandoc- Enhanced Word export (requires Pandoc binary)
PyTorch is automatically installed by marker-pdf. For GPU acceleration, run setup_gpu.bat to install the CUDA version.
Problem: Application shows "CPU" instead of your GPU
Solution:
.\check_gpu.bat # Check current status
.\setup_gpu.bat # Install CUDA-enabled PyTorchProblem: "Export failed, need to install Pandoc" error
Solution:
- Run
.\install_pandoc.batfor guided installation - Or download Pandoc manually from https://github.com/jgm/pandoc/releases/latest
- The application will use python-docx fallback if Pandoc is unavailable
Problem: First conversion takes a long time
Explanation: The first run downloads ~1-2GB of AI models. This is normal and only happens once. Subsequent conversions use cached models and are much faster.
This project is licensed under the MIT License - see the LICENSE file for details.
- marker-pdf - Excellent PDF to Markdown conversion library
- PyMuPDF - Fast PDF rendering
- Pandoc - Universal document converter
Contributions are welcome! Please feel free to submit a Pull Request.
For issues and questions, please use the GitHub Issues page.
Note: This tool is designed for Windows. For Linux/Mac users, you may need to modify the batch scripts (.bat) to shell scripts (.sh).