跳到正文
FunCoding

iyeque-pdf-reader

PDF reader skill using PyMuPDF (fitz) for text extraction and metadata retrieval. Supports encrypted PDFs and handles large documents efficiently.

Star
859
最近提交
2026年8月20日

skills/iyeque-pdf-reader/SKILL.md

在 GitHub 上查看

PDF Reader (Iyeque)

PDF reader skill for text extraction and metadata retrieval using PyMuPDF.


Installation

pip install pymupdf

Tool API

The skill provides two commands:

1. extract — Extract Text

Extracts plain text from the specified PDF file.

Parameters:

ParameterTypeRequiredDescription
file_pathstring✅Path to the PDF file
--max_pagesinteger❌Maximum number of pages to extract

Usage:

# Extract all text
python3 skills/pdf-reader/reader.py extract /path/to/document.pdf

# Extract first 5 pages only
python3 skills/pdf-reader/reader.py extract /path/to/document.pdf --max_pages 5

Output: Plain text content from the PDF.


2. metadata — Get Document Info

Retrieve metadata about the document.

Parameters:

ParameterTypeRequiredDescription
file_pathstring✅Path to the PDF file

Usage:

python3 skills/pdf-reader/reader.py metadata /path/to/document.pdf

Output: Structured JSON with document metadata.


Metadata Fields

FieldDescription
titleDocument title
authorDocument author
subjectDocument subject
creatorSoftware that created the PDF
producerPDF producer software
creationDateCreation date
modDateModification date
formatPDF format version
encryptionEncryption info (if any)

Example Output

Extract Output

Plain text content from the PDF...

Metadata Output

{
  "title": "Annual Report 2024",
  "author": "John Doe",
  "creationDate": "D:20240115120000Z",
  "creator": "Microsoft Word",
  "producer": "Adobe PDF Library",
  "format": "PDF 1.7"
}

Features

  • Fast extraction using PyMuPDF (fitz)
  • Metadata retrieval including creation/modification dates
  • Page limiting with --max_pages for large documents
  • Encrypted PDF support (password required if applicable)
  • Error handling for corrupted or malformed PDFs

When to Use This Skill

  • Extract text content from PDF files
  • Get document metadata (title, author, dates)
  • Process multiple PDFs for analysis
  • Quick PDF content preview
  • Academic paper text extraction

Python API Alternative

You can also use PyMuPDF directly in Python:

import fitz  # PyMuPDF

# Open PDF
doc = fitz.open("document.pdf")

# Get metadata
print(doc.metadata)

# Extract text from all pages
for page in doc:
    text = page.get_text()
    print(text)

# Extract from specific page
page = doc[0]  # First page (0-indexed)
text = page.get_text()

Notes

  • Uses PyMuPDF (imported as fitz) for fast, reliable PDF processing
  • Supports encrypted PDFs (will modify if password required)
  • Handles large PDFs efficiently with --max_pages option
  • Returns error message if file not found or invalid PDF

Error Handling

ErrorCauseSolution
File not foundInvalid pathCheck file path
Not a valid PDFCorrupted fileVerify file integrity
Encrypted PDFPassword protectedProvide password if required

相似的 Skill

精选

pdf

提取文本和表格、合并拆分、填写表单,也能对扫描件做 OCR。

ANanthropics/skills181k近 7 天新增 1,119 个 star

精选

canvas-design

按设计理念生成海报和视觉作品,输出 PNG 或 PDF。

ANanthropics/skills181k近 7 天新增 1,119 个 star

精选

docx

创建和编辑 Word 文档,支持目录、页码、页眉等排版。

ANanthropics/skills181k近 7 天新增 1,119 个 star

精选

doc-coauthoring

按步骤协作撰写技术方案、提案和决策文档,逐轮修改。

ANanthropics/skills181k近 7 天新增 1,119 个 star

精选

xlsx

读写 Excel 和 CSV,处理公式、格式、图表与数据清洗。

ANanthropics/skills181k近 7 天新增 1,119 个 star

精选

pptx

生成、读取和修改演示文稿,也能合并拆分幻灯片。

ANanthropics/skills181k近 7 天新增 1,119 个 star