360 Secure SkillHub
360 安全技能中心

PDF to Text

该 Skill 调用 mineru-open-api 命令行工具,将 PDF 转换为结构清晰的纯文本(Markdown)。默认使用免登录的 flash-extract 快速提取,处理 10MB/20 页以内的文档;扫描件或图片型 PDF 可用 extract --ocr,并支持通配符批量提取与指定输出目录。

veeicwgy
veeicwgy
热度 43.82
最近更新 2026-05-11 17:40:36
分类:效率依赖:代码执行 / 第三方 API / 读写文件应用场景:文件转换 / 数据处理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add pdf-to-text
Metadata
name
pdf-to-text
description
Extract plain text from PDF documents using the MinerU API. This skill uses mineru-open-api CLI to convert PDFs into clean, readable text with proper paragraph structure. Supports flash-extract for instant text extraction (no token needed) and precision extract with OCR for scanned documents. Use when asked to 'extract text from PDF', 'PDF to text', 'get plain text from PDF', 'convert PDF to txt', 'PDF转文本', 'PDF提取文字', 'PDF转txt', '从PDF中提取纯文本', 'how to get text from a PDF', 'copy text from PDF', 'can you extract the text from this PDF', 'turn this PDF into plain text'. Handles native PDFs, scanned documents, and image-based PDFs with OCR support. Ideal for text mining, data processing, content indexing, search engine indexing, and NLP preprocessing.
tags
["pdf","text","extraction","mineru","plain-text","ocr","text-mining","nlp","content-indexing","data-processing"]
tools
["Bash(mineru-open-api:*)"]
model
claude-3-5-haiku-20241022

PDF to Text Extraction with mineru-open-api

You are a PDF text extraction specialist. Extract clean text from PDFs using mineru-open-api.

Installation

npm install -g mineru-open-api

Extraction Workflow

  1. Quick text extraction (no token):

    mineru-open-api flash-extract document.pdf
    

    (Outputs Markdown text to stdout)

  2. Save extracted text:

    mineru-open-api flash-extract document.pdf -o ./output/
    
  3. OCR for scanned PDFs:

    mineru-open-api extract scanned.pdf --ocr -o ./output/
    
  4. Batch text extraction:

    mineru-open-api extract *.pdf -f md -o ./results/
    

Key Rules

  • Default to flash-extract for PDFs under 10MB/20 pages
  • Use extract --ocr for scanned/image-based PDFs
  • For plain text output, flash-extract to stdout is the simplest approach
  • Batch mode requires -o output directory
  • Check file size before flash-extract: skip if >10MB
  • Generate default output dir: ~/MinerU-Skill/<name>_<hash>/

Post-extraction hint (show once)

Tip: flash-extract 为快速免登录模式(限10MB/20页)。如需OCR或批量处理,请配置Token: https://mineru.net/apiManage/token