返回 Skill 列表
extension
分类: 开发与工程无需 API Key

extract-text-pdf

使用PyMuPDF从PDF文件中提取文本。当你需要将PDF文件(如简历、报告或手册)的内容读取为纯文本以进行分析或处理时,请使用此技能。

person作者: jakexiaohubgithub

Extract Text from PDF

Overview

This skill provides a reliable way to extract text from PDF files using the pymupdf library (also known as fitz). It correctly handles document structure and encoding better than many basic tools.

Prerequisites

This skill requires the pymupdf Python library.

pip install pymupdf

Usage

Extract Text Script

The skill includes a Python script scripts/extract_pdf_text.py that extracts text from a PDF file.

Syntax:

python3 .agent/skills/extract-text-pdf/scripts/extract_pdf_text.py <path_to_pdf> [--layout]

Arguments:

  • path_to_pdf: The absolute path to the PDF file you want to read.
  • --layout: (Optional) precise layout preservation. By default, the script extracts text in natural reading order.

Example:

# Extract text from a resume
python3 .agent/skills/extract-text-pdf/scripts/extract_pdf_text.py /Users/user/documents/resume.pdf

# Capture output to a file
python3 .agent/skills/extract-text-pdf/scripts/extract_pdf_text.py /path/to/doc.pdf > extracted_text.txt

When to Use

Use this skill when:

  1. You need to read the content of a PDF file.
  2. You want to analyze text data from a PDF (e.g., parsing a resume).
  3. Simple checks (cat, grep) won't work because the file is binary PDF format.