robust-pdf-read
यह क्या करती है
यह स्किल AI एजेंट को pdftotext टूल से PDF का पढ़ने योग्य टेक्स्ट निकालना दिखाती है। यह उन लोगों के लिए है जिनकी PDF रीडिंग अपठनीय अक्षरों के रूप में वापस आती है।
कब इस्तेमाल करें
- ✓जब फ़ाइल रीडर किसी PDF के लिए कच्चा बाइनरी, base64 इमेज डेटा या गड़बड़ अक्षर लौटाए।
- ✓जब आपको काम करने के लिए PDF के शब्द सादे टेक्स्ट में चाहिए।
- ✓जब आप चाहें कि PDF के टेक्स्ट का लेआउट मूल के जितना संभव हो उतना करीब रहे।
Skill का लिंक
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/robust-pdf-read/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरी लीज़ PDF पढ़िए और मुझे उसका टेक्स्ट दीजिए। फ़ाइल रीडर सिर्फ़ गड़बड़ अक्षर दिखा रहा है।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट सामान्य रीडर के आउटपुट में बाइनरी या गड़बड़ सामग्री जाँचता है। अगर ऐसा मिले, तो वह layout विकल्पों और बिना page break अक्षरों के साथ pdftotext चलाता है, और पढ़ने के लिए टेक्स्ट standard output पर भेजता है।
तकनीकी सामग्री (मूल 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.
अक्सर पूछे जाने वाले सवाल
एजेंट विफल रीड कैसे पहचानता है?
वह null bytes, base64 जैसा दिखने वाला डेटा या साफ़ तौर पर गड़बड़ टेक्स्ट खोजता है।
pdftotext के विकल्प क्या करते हैं?
layout विकल्प पेज का लेआउट बनाए रखता है, और nopgbrk विकल्प page break अक्षर हटाता है।
क्या इसके लिए कोई खास इंस्टॉल चाहिए?
स्किल कहती है कि pdftotext poppler-utils का हिस्सा है, जो Linux सिस्टम पर अक्सर पहले से इंस्टॉल होता है।
जानकारी
लेखक का मूल विवरण
Reliably extract text from PDFs using pdftotext when standard file reading fails.
repo: HKUDS/AgentPilot
लोकप्रियता
- GitHub स्टार
- 7.8k
- रैंकिंग में स्थान
- #12977
- लाइसेंस
- MIT
- अपडेट की गई
- 1/11/2026
कमेंट
- …
इस repository की और skills
agentpilot
7.8kआपके एजेंट को AgentPilot से प्रोजेक्ट को चरण-दर-चरण सुधारने में मदद करती है, जिसमें बदलाव सुझाए, परखे और स्कोर किए जाते हैं।
openspace
7.8kआपके एजेंट को OpenSpace सेट करने में मदद करती है, जो एजेंट स्किल्स सहेजता और वापस लाता है, और MCP के ज़रिए आपके AI ऐप से जुड़ता है।
rsi-arena
7.8kआपके एजेंट को AIME और Terminal-Bench जैसे मानक AI बेंचमार्क टेस्ट सेट करने और चलाने में मदद करती है, ताकि सुधार के तरीकों की तुलना हो सके।
experiment-guide
7.8kआपके एजेंट को छोटे प्रयोग बनाने, उनके नतीजे पढ़ने और जाँच के दौरान उपयोगी निष्कर्ष लिखने में मदद करती है।
मिलती-जुलती skills
feishu-doc
394kयह आपके एजेंट को document टूल से Feishu क्लाउड दस्तावेज़ पढ़ने, बनाने और बदलने में मदद करती है, जिसमें टेक्स्ट, इमेज और टेबल शामिल हैं।
feishu-drive
394kयह आपके एजेंट को बॉट के साथ साझा किए गए Feishu क्लाउड फ़ोल्डर में फ़ाइलें देखने, व्यवस्थित करने और उन पर टिप्पणी करने देती है।
feishu-perm
394kयह आपके एजेंट को Feishu फ़ाइल तक किसकी पहुंच है, यह जांचने और बदलने देती है, और आपके अनुरोध के लिए सबसे छोटी अनुमति चुनती है।