robust-pdf-read
하는 일
이 스킬은 pdftotext 도구로 PDF에서 읽을 수 있는 텍스트를 꺼내는 방법을 AI 에이전트에게 보여 줍니다. PDF 읽기 결과가 알아볼 수 없는 문자로만 나오는 사람에게 맞습니다.
사용하는 경우
- ✓파일 리더가 PDF에 대해 바이너리, base64 이미지 데이터 또는 깨진 문자를 반환할 때.
- ✓작업에 쓰려고 PDF의 단어를 일반 텍스트로 얻어야 할 때.
- ✓PDF 텍스트의 레이아웃을 원본에 가깝게 유지하고 싶은 경우.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/robust-pdf-read/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 임대 계약서 PDF를 읽고 텍스트를 주세요. 파일 리더는 깨진 문자만 보여 줍니다.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 일반 리더 출력에 바이너리나 깨진 내용이 있는지 확인합니다. 있으면 레이아웃 옵션과 페이지 나눔 문자를 없애는 옵션을 붙여 pdftotext를 실행하고, 텍스트를 표준 출력으로 보내 읽습니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Robust PDF Text Extraction
Problem
Standard file reading tools (e.g., read_file) often fail to extract text from PDF documents. Instead of returning parsed text, they may return:
- Raw binary data
- Base64 encoded images
- Garbled characters or null bytes
This occurs because PDFs are complex binary formats, not plain text files. Attempts to parse them using general-purpose Python libraries (like PyMuPDF) in sandboxed environments may also fail due to missing dependencies or environment restrictions.
Solution
Use the pdftotext command-line utility (part of poppler-utils) via run_shell. This tool is commonly pre-installed in Linux environments and reliably extracts text content from PDFs.
Procedure
1. Detect Extraction Failure
When attempting to read a PDF:
- Check the content returned by
read_file. - If the content contains null bytes (
\x00), appears as base64, or is clearly binary/garbled, assume standard reading has failed.
2. Execute pdftotext
Run the following shell command using run_shell:
pdftotext -layout -nopgbrk <file_path> -
-layout: Maintains the physical layout of the text (optional but recommended).-nopgbrk: Prevents inserting form feed characters between pages.-: Outputs content to stdout instead of creating a new file.
3. Parse Output
Capture the stdout from the shell command. This string is the extracted text.
Example Usage
Scenario: You need to read document.pdf.
Step 1: Attempt standard read
content = read_file("document.pdf")
if "\x00" in content or not content.strip():
# Fallback needed
pass
Step 2: Fallback to shell
result = run_shell("pdftotext -layout -nopgbrk document.pdf -")
text = result.stdout
Prerequisites
- The environment must have
pdftotextinstalled (usually viapoppler-utils). - If
pdftotextis not found, attempt to install it (apt-get install poppler-utils) if permissions allow, or notify the user.
Benefits
- Reliability: Bypasses Python library dependency issues in sandboxes.
- Speed: Command-line tools are often faster than loading heavy Python libraries.
- Compatibility: Works consistently across most Linux-based agent environments.
자주 묻는 질문
실패한 읽기는 어떻게 알아보나요?
널 바이트, base64처럼 보이는 데이터, 분명히 깨진 텍스트를 찾습니다.
pdftotext 옵션은 무엇을 하나요?
layout 옵션은 레이아웃을 유지하고, nopgbrk 옵션은 페이지 나눔 문자를 없앱니다.
특별한 설치가 필요한가요?
pdftotext는 poppler-utils의 일부이며, Linux 시스템에는 보통 이미 설치되어 있다고 스킬이 말합니다.
상세 정보
작성자의 원본 설명
Reliably extract text from PDFs using pdftotext when standard file reading fails.
repo: HKUDS/AgentPilot
인기도
- GitHub 스타
- 7.8k
- 순위
- #12977
- 라이선스
- 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 파일에 누가 접근할 수 있는지 확인하고 바꾸도록 돕습니다.