PDF-AI-Viewer

PDF 阅读翻译器 / PDF Reader & Translator

一个类似「知云文献翻译」的桌面 PDF 阅读翻译工具,使用 Python + PyQt6 开发。

A desktop PDF reader & translator similar to “Zhiyun Literature Translation”, built with Python + PyQt6.

左侧查看 PDF,右侧显示翻译结果;用鼠标刷选 PDF 内容即可翻译,支持记录阅读位置,下次从上次位置继续阅读。

View the PDF on the left and the translation on the right. Select text in the PDF with your mouse to translate it. Your reading position is remembered so you can resume where you left off.


功能特性 / Features



安装 / Installation

需要 Python 3.9+。

Requires Python 3.9+.

# 克隆仓库 / Clone the repository
git clone https://github.com/fangvv/PDF-AI-Viewer.git
cd PDF-AI-Viewer

# 安装依赖 / Install dependencies
pip install -r requirements.txt

# 国内用户可使用清华源加速 / Chinese users can use the Tsinghua mirror
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

运行 / Run

python main.py

使用说明 / Usage

  1. 点击「打开 PDF」或使用 Ctrl + O 打开一个 PDF 文件(也可直接把 PDF 拖到窗口)
  2. 在左侧 PDF 中用鼠标刷选要翻译的文本,翻译按钮会出现在鼠标附近,点击即可翻译
  3. 翻译结果显示在右侧;也可点击「翻译选中内容」或按 Ctrl + T
  4. 可在右上角选择翻译引擎(自动 / 微软 Edge / 大模型 / MyMemory)
  5. 使用「A- / A+」按钮调节翻译字体大小
  6. 缩放:工具栏选择适合页面 / 适合宽度 / 百分比,或按住 Ctrl 滚动鼠标滚轮快速缩放
  7. 点击工具栏「全文总结」对整篇论文生成总结,结果在独立窗口中流式显示
  8. 在工具栏搜索框输入关键词回车,即可全文搜索并高亮定位,支持「上一个 / 下一个」跳转
  9. 首次使用大模型翻译或总结前,请到「设置 → 大模型设置」填写接口地址、API Key 和模型名
  10. 夜间阅读可到「设置 → 主题」切换夜间模式,PDF 页面会自动反色
  11. 若 PDF 自带内部链接,点击正文中的参考文献引用(如 [1])可直接跳转到文末对应条目
  12. 关闭程序后,下次打开同一 PDF 会自动跳转到上次阅读位置,并恢复窗口状态

  1. Click “Open PDF” or press Ctrl + O to open a PDF file (or drag a PDF onto the window)
  2. Select the text you want to translate in the PDF on the left; a translate button appears near the mouse — click it to translate
  3. The result appears on the right; you can also click “Translate Selected” or press Ctrl + T
  4. Choose a translation engine in the top-right (Auto / Microsoft Edge / LLM / MyMemory)
  5. Use the “A- / A+” buttons to adjust the translation font size
  6. Zoom: choose Fit Page / Fit Width / Percentage in the toolbar, or hold Ctrl and scroll the mouse wheel for quick zoom
  7. Click “Full-document Summary” in the toolbar to summarize the entire paper; the result streams into a standalone window
  8. Type a keyword in the toolbar search box and press Enter to search the whole document with highlighted, centered results; use “Prev / Next” to navigate
  9. Before using LLM translation or summary for the first time, configure the base URL, API key, and model under “Settings → LLM Settings”
  10. For night reading, switch to dark mode under “Settings → Theme”; PDF pages are automatically inverted
  11. If the PDF has internal links, click an in-text reference citation (e.g. [1]) to jump directly to the corresponding entry at the end of the document
  12. After closing, reopening the same PDF resumes at your last reading position and restores the window state

大模型设置 / LLM Settings

本软件支持任意 OpenAI 兼容 的大模型接口,由用户自行选择服务商并填写:

This software supports any OpenAI-compatible LLM endpoint. You choose the provider and fill in:


项目结构 / Project Structure

pdf_translator/
├── main.py          # 主窗口:分栏布局、工具栏、菜单栏、翻译/总结线程、浮动按钮
├── pdf_viewer.py    # PDF 阅读器:按需渲染、刷选、缩放、链接点击
├── translator.py    # 翻译引擎:Edge / OpenAI 兼容大模型 / MyMemory,流式总结
├── settings.py      # 配置存储:阅读位置、最近历史、界面设置、大模型配置
├── make_logo.py     # Logo 生成脚本
├── requirements.txt # 依赖清单
├── AGENTS.md        # 给 AI 助手/开发者的工程说明与约定
├── LICENSE          # MIT 许可证
├── dist/            # 打包产物(PDF阅读翻译器.exe)
└── logo.ico / logo.png  # 应用图标

技术栈 / Tech Stack


翻译引擎 / Translation Engines

引擎 / Engine 说明 / Description 需要 Key
微软 Edge / Microsoft Edge 官方翻译接口,质量稳定
大模型 / LLM 通用 OpenAI 兼容大模型,翻译质量高,可做 AI 总结 是(可选)
MyMemory 免费在线翻译服务

选择「自动」时,程序会依次尝试各引擎,直到成功为止。

When “Auto” is selected, the program tries each engine in turn until one succeeds.


许可证 / License

MIT


致谢 / Acknowledgements