pdf-text-extraction
하는 일
이 스킬은 내장 핸들러를 믿을 수 없을 때 PDF 텍스트를 추출하는 여러 방법을 나열합니다. 분석이나 요약에 읽을 수 있는 PDF 내용이 필요한 사람에게 맞습니다.
사용하는 경우
- ✓PDF를 읽을 때 이미지 데이터, 오류 또는 불완전한 내용이 나올 때.
- ✓PDF의 페이지 수나 메타데이터가 필요한 경우.
- ✓간단한 방법으로는 부족해서 PDF의 표 데이터가 필요할 때.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pdf-text-extraction/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“내장 PDF 리더가 제 보고서에서 실패합니다. 텍스트를 꺼내고 몇 쪽인지도 알려 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
AI는 텍스트에는 pdftotext, 메타데이터에는 pdfinfo, Python 방법에는 PyMuPDF, 표에는 pdfplumber를 고르고, 선택한 명령을 셸에서 실행합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
PDF Text Extraction (Fallback Method)
When to Use This Skill
Use this skill when read_file with filetype='pdf':
- Returns binary image data instead of text
- Produces errors or incomplete content
- Fails to extract structured data reliably
The built-in PDF handler is unreliable for structured text extraction. Shell-based tools provide more robust alternatives.
Available Methods
Method 1: pdftotext (Recommended)
# Extract text from PDF to stdout
pdftotext /path/to/file.pdf -
# Extract text to a file
pdftotext /path/to/file.pdf output.txt
# Preserve layout (maintains spacing/structure)
pdftotext -layout /path/to/file.pdf output.txt
Usage in agent:
run_shell command="pdftotext -layout /path/to/document.pdf -"
Method 2: pdfinfo (Metadata)
# Get PDF metadata (pages, author, creation date, etc.)
pdfinfo /path/to/file.pdf
Usage in agent:
run_shell command="pdfinfo /path/to/document.pdf"
Method 3: Python with PyMuPDF (fitz)
import fitz # PyMuPDF
doc = fitz.open("/path/to/file.pdf")
text = ""
for page in doc:
text += page.get_text()
doc.close()
print(text)
Usage in agent:
run_shell command="python3 -c \"import fitz; doc=fitz.open('file.pdf'); print(''.join(p.get_text() for p in doc))\""
Method 4: Python with pdfplumber (Tables)
import pdfplumber
with pdfplumber.open("/path/to/file.pdf") as pdf:
for page in pdf.pages:
text = page.extract_text()
tables = page.extract_tables() # For tabular data
Usage in agent:
run_shell command="python3 -c \"import pdfplumber; pdf=pdfplumber.open('file.pdf'); print(''.join(p.extract_text() or '' for p in pdf.pages))\""
Workflow
Try pdftotext first - Fastest and most reliable for plain text
run_shell command="pdftotext -layout /path/to/file.pdf -"If pdftotext unavailable, check for Python libraries
run_shell command="python3 -c \"import fitz; print('PyMuPDF available')\""For table/structured data, use pdfplumber
run_shell command="python3 -c \"import pdfplumber; ...\""Verify extraction succeeded - Check output contains readable text, not binary data
Installation Notes
If tools are not available:
# Ubuntu/Debian
apt-get install poppler-utils # pdftotext, pdfinfo
# Install Python libraries
pip install pymupdf pdfplumber
Anti-Patterns to Avoid
- Do NOT rely solely on
read_filewithfiletype='pdf'for critical text extraction - Do NOT assume PDF text is in any particular order - verify extracted content
- Do NOT use image-based extraction unless the PDF is scanned (use OCR instead)
Example: Complete Extraction Pattern
# Step 1: Try pdftotext
RESULT=$(pdftotext -layout /path/to/form.pdf - 2>/dev/null)
# Step 2: Verify we got text, not error
if [ -z "$RESULT" ]; then
# Fallback to Python
RESULT=$(python3 -c "import fitz; doc=fitz.open('/path/to/form.pdf'); print(''.join(p.get_text() for p in doc))")
fi
# Step 3: Use extracted text
echo "$RESULT"
자주 묻는 질문
pdfinfo는 무엇을 보여 주나요?
페이지 수, 제목, 작성자, 생성 날짜 같은 메타데이터를 보여 줍니다.
pdfplumber는 언제 유용한가요?
가이드는 PDF에서 표를 추출할 때 이 라이브러리를 추천합니다.
내장 핸들러는 항상 믿을 수 없나요?
가이드는 구조화된 텍스트 추출에는 믿기 어렵다고 말하고, 셸 도구를 우선합니다.
상세 정보
인기도
- GitHub 스타
- 7.8k
- 순위
- #12935
- 라이선스
- MIT
- 업데이트
- 2026. 11. 1.
댓글
- …
이 저장소의 다른 스킬
agentpilot
7.8k작업을 준비하고 AgentPilot 루프를 실행해 변경을 제안, 테스트, 점수화하면서 프로젝트를 단계적으로 개선하도록 돕습니다.
openspace
7.8k에이전트 스킬을 저장하고 가져오는 도구인 OpenSpace를 설정하고, MCP를 통해 AI 앱에 연결하도록 돕습니다.
rsi-arena
7.8kAIME나 Terminal-Bench 같은 표준 AI 벤치마크 테스트를 설정하고 실행해 서로 다른 개선 방법을 비교하도록 돕습니다.
experiment-guide
7.8k프로그램을 개선하는 방법을 조사하면서 작은 실험을 계획하고, 결과를 읽고, 발견 사항을 기록하도록 돕습니다.
비슷한 스킬
feishu-doc
394k에이전트가 문서 도구를 사용해 텍스트, 이미지, 표를 포함한 Feishu 클라우드 문서를 읽고, 만들고, 편집하도록 돕습니다.
feishu-drive
394k에이전트가 봇과 공유된 Feishu 클라우드 폴더의 파일을 찾아보고, 정리하고, 댓글을 달도록 돕습니다.
feishu-perm
394k에이전트가 요청을 충족하는 가장 작은 권한을 골라, Feishu 파일에 누가 접근할 수 있는지 확인하고 바꾸도록 돕습니다.