360 Secure SkillHub
360 安全技能中心

PDF to Text

该工具依托MinerU API,通过mineru-open-api CLI实现PDF文本提取。支持免令牌快速提取(限10MB/20页PDF)、带OCR的精准提取(适配扫描/图像型PDF),可批量处理并保留段落结构,输出纯文本或Markdown。适用于文本挖掘、数据处理、内容索引、NLP预处理等场景,收到PDF转文本类请求时触发,输入为PDF文件,输出可到终端或指定目录。

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

安装技能

复制下面的话术发给你的 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