@dsh-external/dsh-pdf
无文件大小限制的 PDF 读取插件。通过 pdfjs-dist 提取中英文文本,并针对扫描件或多图页面提供自动 OCR 功能(支持 Windows WinRT OCR 或 Tesseract.js)。
AI 分析
核心用于突破大文件限制,实现高质量的 PDF 文本提取与 OCR 识别。适合需要处理超大 PDF、扫描版学术论文或图表密集型文档的分析任务。
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:henryxiao709/dsh-pdf说明文档
阅读完整 README ↗🧰 Usage
read_pdf file_path=... [pages="1-3"] [mode=auto|text|ocr] [ocrEngine=auto|windows|tesseract] [maxCharsPerPage=20000]
Example result:
{
"path": ".../test.pdf",
"totalPages": 7,
"mode": "auto",
"pages": [
{ "number": 1, "text": "test… [OCR] test…", "source": "mixed", "chars": 163 },
{ "number": 2, "text": "1 test)…", "source": "text", "chars": 876 }
],
"engines": ["windows: ok", "tesseract: unavailable (no traineddata)"],
"warnings": []
}
Each page reports source: text (text layer only), ocr (OCR only), or mixed (both).
⚙️ Configuration
The plugin registers a dsh-pdf settings section (host namespace + a
settings-UI card): every knob below is adjustable live in the DSH settings UI
(Settings → Plugins → dsh-pdf); changes apply immediately and clear the result
cache. The same keys can be set in cordis.patch.yml as the composition base:
| Key | Default | Description |
|---|---|---|
maxFileBytes | 209715200 | byte cap per PDF read |
readLimitPages | 50 | max pages processed per call |
ocrMinChars | 120 | pages with fewer text-layer chars get OCR'd in auto mode |
ocrScale | 2 | render scale for OCR (2 ≈ 144 DPI) |
ocrEngine | auto | auto / windows / tesseract |
ocrTimeoutMs | 60000 | per-page OCR timeout |
maxCharsPerPage | 20000 | per-page character cap in results |
cacheEntries | 4 | result cache entries |
cacheDir | %TEMP%/dsh-pdf | scratch dir for the OCR script and temp images |
Settings UI: the plugin registers a
dsh-pdfsettings section — all keys above are adjustable live in the DSH settings UI (Settings → Plugins → dsh-pdf); changes apply immediately and clear the result cache. Thecordis.patch.ymlvalues act as the composition base.