DeepSHPlugins
dsh-pdf-reader 项目预览
GITHUB / COMMUNITY PROJECT

dsh-pdf-reader

视觉与多模态PythonMIT

面向视觉模型的内容感知 PDF 读取插件:逐页分析图(矢量与栅格)、表格、公式风险与双栏排版,基于内容识别进行混合提取,图表/公式页渲染成高 DPI 区域裁切。提供低清预览以理解页面概况并支持指定选区获取高清渲染。功能包装为多个工具供Agent使用。

2 StarsAngelosZou 更新时间 2026-08-26
访问 GitHub 仓库
dsh-pdf-reader 项目预览

项目介绍

中文

面向视觉模型的内容感知 PDF 读取插件:逐页分析图(矢量与栅格)、表格、公式风险与双栏排版,基于内容识别进行混合提取,图表/公式页渲染成高 DPI 区域裁切。提供低清预览以理解页面概况并支持指定选区获取高清渲染。功能包装为多个工具供Agent使用。

English

A content-aware PDF reading plugin for vision models: profiles each page for figures (vector and raster), tables, formula risk and double-column layout, then applies content-aware hybrid extraction, rendering figure/table/formula pages as high-DPI region crops. Provides a low-resolution preview to understand the page layout, and renders a specified region at high resolution. Packaged as multiple tools for agents.

项目信息与收录信号

快照 2026-09-11
作者 / 组织
AngelosZou
仓库
AngelosZou/dsh-pdf-reader
GitHub Stars
2
Forks
0
开发语言
Python
许可证
MIT
最近推送
2026-08-26
Manifest
数据中检测到声明

公开仓库不自动等于可商用;许可证与当前兼容性以原项目文档为准。Manifest 和数据评分不构成安装安全认证。

数据评分

55/ 100
维护活跃
90
文档与实用信息
85
生态关注度
14
安装便捷信号
75
项目声明信号
100

近 16 天仍在更新;README 含完整安装与使用说明;关注度尚低(2)。

评分来自已有数据快照的五维模型,仅作浏览参考,不是实际使用评测或安全检测结论。

安装与使用

所有项目资料与许可均以对应 GitHub 仓库为准。

dsh plugin --profile web add github:AngelosZou/dsh-pdf-reader

复制命令不会自动执行。请先阅读仓库文档,确认环境要求与许可证。

项目截图

仓库 README

GitHub 原文

已保存的仓库文档快照;文档抓取时间未记录,可能与上方目录介绍处于不同版本。安装前请核对当前仓库说明。

dsh-pdf-reader

DeepSeek Harness plugin for content-aware PDF reading by vision models.

The plugin reads a PDF the way its content demands: text-heavy pages are extracted as text, while figures, tables, formula-heavy or two-column pages are rendered as high-DPI region crops fed to the vision model — so a paper's vector figures and structured tables are never lost to the per-image token ceiling.

Backed by PyMuPDF. When Python or a dependency is missing, the tools return a clear, actionable warning (with the exact install command) for the agent to resolve, instead of failing hard.

Install

dsh plugin --profile web add dsh-pdf-reader

Requires a Python interpreter with pymupdf.

After installing Python, you can install the dsh-python-env plugin in DeepSeek Harness so the agent handles the dependency automatically — it will create a project venv and install pymupdf itself, with no manual steps:

dsh plugin --profile web add dsh-python-env

To set it up by hand instead:

python -m venv .venv
.venv\Scripts\python.exe -m pip install pymupdf

Tools

ToolWhat it does
pdf_scanPer-page content profile — columns, figures (vector regions), raster images, tables, text characters, hasGraphics, formulaRisk, hasTextLayer. Use first to decide how each page should be read.
pdf_read_pageRead one page. mode=mixed is the one-shot: a low-res fullPage preview + the page text + every auto-detected figure/table region as high-DPI PNGs (paths, cached in .dsh-pdf-reader). mode=auto/text/render force a single path.
pdf_render_regionTargeted high-res render of a [x0,y0,x1,y1] region at budget-filling DPI (or an explicit dpi), returning its path for read_image.

Recommended workflow

The tools are built around a preview → content → refine loop so large PDFs stay cheap and no layout is lost to flattening:

  1. Preview (whole page, low-res). Call pdf_read_page --mode mixed for a page.

It returns a low-res fullPage render (the whole layout — formulas, table gridlines, figure placement, two-column order) plus the page's text. Look at the preview to see *what* is on the page before spending high-res budget on it.

  1. Content (auto, cached). The same mixed call auto-detects every figure and

table region and renders each as a high-DPI PNG. All PNGs are written to <cwd>/.dsh-pdf-reader and returned only as paths — heavy/long content lives in the cache, never inlined into your context. Feed the paths to read_image.

  1. Refine (on demand). If a specific area is still too small, or was not

auto-cropped (an uncropped formula, a crowded table cell, a sub-figure), zoom it with pdf_render_region on the exact [x0,y0,x1,y1] you read off the fullPage preview.

Start any document with pdf_scan (whole-document overview) to plan which pages are text-only vs figure/table/formula-rich, then apply the loop per page.

Why this design

A two-column paper's figures are usually vector (only page rasterization can see them), tables lose structure under text extraction, and formulas garble in some text layers. Meanwhile DeepSeek caps each image at ~800×800-equivalent / 384 tokens — so reading a whole two-column page at that budget makes each column ~350px and loses small text, sub/superscripts and figure detail. The fix:

  • Text pages → extraction (cheap, precise, preserves prose + inline math that

PyMuPDF decodes well).

  • Figure/table/math pages → render the region and scale it to fill the

~640k-pixel budget via dpi = 72 × sqrt(640000 / region_pt_area). Content is complete (nothing legible is lost inside the budget) and token-optimal (rendered AT the budget, not beyond it).

Region detection is heuristic (not a perfect classifier) and deliberately biased toward rendering — vector clusters from get_drawings(), raster rects from get_image_rects(), the same clustering for tables, and math from fonts + a LaTeX producer. It over-flags (a ruled table or a logo may be treated as a figure) rather than under-flagging, because rendering is cheap and safe.

When dependencies are missing

Each tool resolves a Python interpreter in priority order — the activated venv ($VIRTUAL_ENV) first, then PATH python/python3/py, then the project .venv/venv/env — probes it for pymupdf (and optionally pymupdf4llm), and picks the first one that can import it. If none can, it returns a warning naming what is missing and how to fix it, so the agent can install the dependency, switch interpreters, or fall back.

Limitations

  • page.find_tables() false-positives on plot grids and diagrams, so tables

are primarily read by rendering (the reliable path); Markdown tables from pymupdf4llm are a best-effort extra.

  • Formula detection is heuristic (fonts + LaTeX producer). PyMuPDF decodes inline

math well, but stacked fractions can still be imperfect — use pdf_render_region on an equation when exact structure is needed.

  • A whole page renders to only ~83 DPI-equivalent at the budget; the tools never

do that for a two-column page — they crop regions instead, and body text uses extraction.

  • Large PDFs are parsed into memory.

Requirements

  • Node ≥ 20, @deepseek-ai/cordis ^4, @deepseek-ai/dsh-tools (peer deps,

provided by the harness).

  • Python 3 + pymupdf (optional pymupdf4llm).

License

MIT

使用前核对

安装步骤、兼容版本与授权范围以原项目当前文档为准。Stars 和评分是快照中的导航信号。

安装与排错 · 项目问题反馈

同类项目