SuperAPI AI Directory

pdf-reader

Office & productivity

View repository

Updated 10-13 22:05

About this skill

PDF Reader

This skill extracts text from PDF files and converts it to Markdown format.

クイックスタート

Basic Usage

# WSL環境でPythonスクリプトを実行
wsl python3 scripts/read_pdf.py "/mnt/c/path/to/file.pdf"

Save in Markdown format

  1. Extract text with a script
  2. Save to a .md file with the Write tool

Prerequisites

The pdfplumber package is required:

wsl pip3 install pdfplumber

Usage Examples

Example 1: Load a PDF file and display its contents

User: "C:\Users\keita\repos\guideline.pdf を読み込んで"
Assistant:
1. Windowsパスを WSL パスに変換: /mnt/c/Users/keita/repos/guideline.pdf
2. wsl python3 scripts/read_pdf.py を実行
3. 抽出されたテキストを Markdown 形式で表示

Example 2: Convert a PDF to Markdown and save it

User: "ガイドライン.pdf を Markdown に変換して保存"
Assistant:
1. scripts/read_pdf.py でテキスト抽出
2. Markdown形式で構造化(ページごとに見出し、テーブルも含む)
3. Write ツールで ガイドライン.md に保存
4. 保存完了を報告

ワークフロー

Loading a single file

  1. The user specifies the PDF file path
  2. Convert the Windows path to WSL path format (C:\ → /mnt/c/)
  3. wsl python3 scripts/read_pdf.py run
  4. Display or save the extracted text in Markdown format

Batch processing of multiple files

  1. Search for .pdf files with Glob
  2. Run the script on each file
  3. Report the results together

Output Format

Markdown Structure

# [PDFファイル名]

**Total Pages:** 10

---

## Page 1

[ページ1のテキスト内容]

### Tables

**Table 1:**

| 列1 | 列2 | 列3 |
| --- | --- | --- |
| データ1 | データ2 | データ3 |

---

## Page 2

[ページ2のテキスト内容]

---

Script Details

Python スクリプトは scripts/read_pdf.py is located in.

Main features:

  • Text extraction per page
  • Conversion of tables to Markdown
  • Structuring of multiple pages
  • エラーハンドリング

How to use:

python scripts/read_pdf.py <file_path>

Supported Features

  • ✅ Text extraction (all pages)
  • ✅ Conversion of tables to Markdown
  • ✅ Preservation of page numbers
  • ✅ Structured output
  • ⚠️ Text extraction from images (OCR not supported)
  • ⚠️ Complex layouts are simplified

Limitations

  • Text cannot be extracted from scanned PDFs (images only)
  • OCR functionality is not included
  • Complex layouts are simplified
  • Styles such as font information and colors are lost
  • Embedded objects are not extracted

トラブルシューティング

pdfplumber がインストールされていない

wsl pip3 install pdfplumber

No text is extracted

  • The PDF may be a scanned image (OCR is required)
  • The PDF may be encrypted
  • テキストレイヤーがない PDF かもしれません

Garbled characters

# 日本語対応の確認
wsl locale
# UTF-8 が含まれていることを確認

Out of memory error

For large PDF files, consider splitting them into pages for processing.

Path Conversion

Converting from a Windows path to a WSL path:

  • C:\Users\... → /mnt/c/Users/...
  • D:\Projects\... → /mnt/d/Projects/...
  • バックスラッシュ \ をスラッシュ / convert to

Related Tools

  • PyPDF2: A lightweight alternative library
  • pdfminer.six: When more detailed control is needed
  • Camelot: Specialized for table extraction
  • OCRmyPDF: Apply OCR to scanned PDFs

Advanced Usage

Extract only specific pages

You can modify the script and use slicing like pdf.pages[0:5] .

Extract only tables

Use only the extract_tables() part in the script.

When OCR is needed

Use pytesseract in combination with pdf2image (recommended to create as a separate skill).

Version history

  • v1.0.0 (2026-01-06): Initial release
    • Basic text extraction function
    • Table Markdown conversion support
    • Operation in WSL environment
    • Per-page structuring