# PDFConvert **Repository Path**: papamenu/pdfconvert ## Basic Information - **Project Name**: PDFConvert - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-01-14 - **Last Updated**: 2026-03-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # PDF 转换工具 一个使用 Python + Tkinter 的图形界面工具,用于图片转 PDF、批量处理、PDF 合并,以及多级目录 PDF 转图片。 ## 环境要求 - Python 3 - `Pillow`(通过 requirements.txt 安装) - `tkinter`(通常随 Python 自带;macOS 的 Homebrew Python 可能需要额外安装) - `PyMuPDF`(用于 PDF -> 图片 模式) ## 安装 1. 创建虚拟环境(推荐): ```bash python3 -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate ``` 2. 安装依赖: ```bash pip install -r requirements.txt ``` *macOS 如果出现 SSL 证书错误,可尝试:* ```bash pip install -r requirements.txt --trusted-host pypi.org --trusted-host files.pythonhosted.org ``` 3. **macOS 特别说明**: 如果遇到 `ModuleNotFoundError: No module named '_tkinter'`,说明 Tkinter 缺失。 使用 Homebrew 安装: ```bash brew install python-tk ``` ## Windows 环境安装、运行与打包 EXE ### 1) 安装 Python 1. 下载并安装 Python 3.x: https://www.python.org/downloads/windows/ 2. 安装时勾选: - "Add python.exe to PATH" - "Install for all users"(可选,但推荐) 3. 在命令行验证: ```bash python --version ``` ### 2) 创建虚拟环境 在项目根目录执行: ```bash python -m venv venv venv\Scripts\activate ``` ### 3) 安装依赖 ```bash pip install -r requirements.txt ``` 如果出现 SSL 证书错误,可尝试: ```bash pip install -r requirements.txt --trusted-host pypi.org --trusted-host files.pythonhosted.org ``` ### 4) 启动运行 ```bash python main.py ``` ### 5) 打包成 EXE(PyInstaller) 方式 A:使用脚本 ```bat build_windows.bat ``` 方式 B:手动执行 ```bash pip install -r requirements.txt pyinstaller --noconfirm --onefile --windowed --name "PDFConverter" main.py ``` 打包产物路径: ``` dist\PDFConverter.exe ``` ### 6) Windows 常见问题 - 如果提示 "pip not found",执行: ```bash python -m ensurepip --upgrade python -m pip install --upgrade pip ``` - 如果提示缺少 tkinter,重装 Python 并勾选 "tcl/tk and IDLE"。 ## 使用方法 启动程序: ```bash python main.py ``` ## 功能列表 1. **单张图片转 PDF**:转换单个图片。 2. **多张图片转多个 PDF**:批量转换所选图片。 3. **多级目录多张图片转多个 PDF**:每个文件夹生成一个 PDF。 4. **多张图片合并成一个 PDF**:多图合并。 5. **多级目录多张图片合并成一个 PDF**:所有图片合并为一个 PDF。 6. **多级 PDF 转图片**:递归扫描 PDF,并按页导出图片。 **输出选项**: - 保存到原目录 - 保存到自定义目录(递归模式会保留目录结构)