# 运行一次 OCR(需要已安装 Tesseract 与 ocrmypdf)
openclaw exec python skills/pdf-ocr/scripts/ocr_batch.py <input-pdf> <output-pdf>
:原始扫描 PDF 路径:输出带文字层的 PDF(同目录或指定路径)--batch-dir 参数:openclaw exec python skills/pdf-ocr/scripts/ocr_batch.py --batch-dir <pdf-dir>
--lang chi_sim 指定中文简体模型(默认 tesseract 会自动检测语言)ocrmypdf 可用;如未安装会提示安装指令ocrmypdf 完成 OCR,内部调用已装好的 Tesseract*.pdf 并生成对应带文字层文件logs/pdf_ocr_error.log,便于排查references/ocr_tips.md:常见 OCR 参数调优技巧(如 DPI、图片预处理)references/install_ocr.md:在 Windows 上安装 Tesseract 与 ocrmypdf 的详细步骤在老师 Agent 的工作流(如 auto_ingest)中,可在 HEARTBEAT.md 或 cron 中加入如下调用,以实现每日自动 OCR:
openclaw exec python skills/pdf-ocr/scripts/ocr_batch.py --batch-dir /path/to/teacher-pdfs
这样老师 Agent 在 ingest 前就已拥有文字层,后续向量化、检索都能顺畅进行。
openclaw exec python skills/pdf-ocr/scripts/ocr_batch.py D:\docs\scan1.pdf D:\docs\scan1_text.pdf
openclaw exec python skills/pdf-ocr/scripts/ocr_batch.py --batch-dir D:\teacher-pdfs
如需更细粒度的文本(Markdown),可在脚本后接 pdf2txt.py 转换。
注意:此技能仅在本机执行,不会触发外部网络请求,符合安全策略。
共 1 个版本