← Back to library

文档处理实战:启用 PDF 工具做多页文档提取与问答

问题/场景:长 PDF 需要快速提取结构化信息并交给模型分析。前置条件:模型支持 Anthropic/Google 原生 PDF 或配置了提取回退;并设置 `agents.defaults.pdfModel`、`pdfMaxBytesMb`、`pdfMaxPages`。实施步骤:配置 PDF 模型与阈值 → 上传样例文档 → 执行分析提示词 → 根据页数/体积调优。关键配置:`agents.defaults.pdfModel`、`pdfMaxBytesMb`、`pdfMaxPages`。验证方法:超限文档被正确拦截,合规文档能稳定产出引用明确的摘要。风险与边界:扫描件 OCR 质量受源文件影响(需验证)。来源归因:v2026.3.2-beta.1 Release Notes。

GITHUBDiscovered 2026-03-04Author openclaw
Prerequisites
  • PDF tool is available in your OpenClaw build (v2026.3.2-beta.1+).
  • A compatible provider/model is configured for PDF analysis.
Steps
  1. Set default PDF model and conservative page/size limits in config.
  2. Run a small known PDF through the tool to validate extraction quality.
  3. Prompt for structured output (sections, key facts, cited page ranges).
  4. Increase `pdfMaxPages` gradually and monitor latency/token impact.
  5. Document provider-specific fallback behavior for unsupported PDFs.
Commands
openclaw gateway status
openclaw gateway restart
Verify

Expected sections are extracted with page-level traceability, and oversized PDFs are rejected with clear errors.

Caveats
  • Scanned or image-heavy PDFs may require additional OCR quality checks(需验证).
  • Large-page documents can increase token cost quickly; keep strict limits by default.
Source attribution

This tip is aggregated from community/public sources and preserved with attribution.

Open original source ↗
Visit original post