local-pdf-extraction
यह क्या करती है
यह स्किल बताती है कि शेल से pdftotext या PyMuPDF लाइब्रेरी से स्थानीय PDF फ़ाइलों का टेक्स्ट कैसे निकालें। यह उन लोगों के लिए है जिन्हें ऐसी PDF का टेक्स्ट चाहिए जिसे AI सीधे नहीं पढ़ सकता।
कब इस्तेमाल करें
- ✓जब मेरे कंप्यूटर की PDF फ़ाइल गड़बड़ या बाइनरी डेटा के रूप में वापस आए।
- ✓जब मुझे फ़ोल्डर की कई PDF का टेक्स्ट सारांशित या विश्लेषित करना हो।
- ✓जब मुझे PDF का टेक्स्ट बाद में इस्तेमाल के लिए सादी टेक्स्ट फ़ाइलों में चाहिए।
Skill का लिंक
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/local-pdf-extraction/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरे फ़ोल्डर की सभी PDF से टेक्स्ट निकालिए, और हर एक को पढ़ने योग्य टेक्स्ट फ़ाइल के रूप में सहेजिए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
AI PDF फ़ाइलों की सूची बनाता है, हर फ़ाइल को pdftotext या एक छोटी PyMuPDF स्क्रिप्ट से टेक्स्ट में बदलता है, और फिर सहेजी गई टेक्स्ट फ़ाइलें पढ़ता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Local PDF Extraction Workflow
Use this skill when you need to extract text from PDF files that exist locally on the filesystem, and read_file returns binary data instead of readable text.
When to Use
- PDF files exist in the local workspace or known directories
read_fileon PDFs returns binary/garbled data instead of text- You need to process PDF content for analysis, summarization, or data extraction
Step-by-Step Instructions
Step 1: Locate PDF Files
First, list directory contents to find all PDF files:
ls -la *.pdf
# or for recursive search
find . -name "*.pdf" -type f
Step 2: Extract PDFs to Text
Choose one of these methods based on available tools:
Method A: Using pdftotext (poppler-utils)
# Extract single PDF
pdftotext input.pdf output.txt
# Batch extract all PDFs in directory
for pdf in *.pdf; do
pdftotext "$pdf" "${pdf%.pdf}.txt"
done
Method B: Using PyMuPDF (fitz) via Python
python3 << 'EOF'
import fitz # PyMuPDF
import glob
import os
for pdf_path in glob.glob("*.pdf"):
doc = fitz.open(pdf_path)
text = ""
for page in doc:
text += page.get_text()
txt_path = pdf_path.replace(".pdf", ".txt")
with open(txt_path, "w", encoding="utf-8") as f:
f.write(text)
print(f"Extracted: {pdf_path} -> {txt_path}")
EOF
Step 3: Read Extracted Text Files
Once extracted, use read_file to read the .txt files:
# Now you can read the text files normally
content = read_file(filetype="txt", file_path="document.txt")
Step 4: Process Content
Proceed with your analysis, summarization, or data extraction on the text content.
Complete Workflow Example
# Step 1: Find PDFs
ls -la *.pdf
# Step 2: Extract all PDFs to text
for pdf in *.pdf; do
pdftotext "$pdf" "${pdf%.pdf}.txt"
done
# Step 3: Verify extraction
ls -la *.txt
Or as a Python script via run_shell:
python3 << 'SCRIPT'
import fitz, glob
for pdf in glob.glob("*.pdf"):
doc = fitz.open(pdf)
text = "".join(page.get_text() for page in doc)
with open(pdf.replace(".pdf", ".txt"), "w") as f:
f.write(text)
print(f"Done: {pdf}")
SCRIPT
Troubleshooting
- pdftotext not found: Install with
apt-get install poppler-utilsor use PyMuPDF method - Empty text output: PDF may be image-based; consider OCR tools like
pdftoppm+tesseract - Encoding issues: Ensure output files use UTF-8 encoding
Key Takeaways
- Never use
read_filedirectly on PDFs for text extraction - Always list directory first to confirm PDF locations
- Use
run_shellwith pdftotext or PyMuPDF for reliable extraction - Batch process when multiple PDFs exist
- Read the resulting
.txtfiles for further processing
अक्सर पूछे जाने वाले सवाल
pdftotext क्या है?
यह एक कमांड-लाइन टूल है जो PDF फ़ाइलों को सादे टेक्स्ट में बदलता है।
क्या पूरा फ़ोल्डर संसाधित हो सकता है?
हाँ, गाइड में एक लूप है जो फ़ोल्डर की हर PDF बदलता है।
कौन सा तरीका चुनें?
गाइड कहती है कि कंप्यूटर पर जो तरीका उपलब्ध हो, pdftotext या PyMuPDF, वही इस्तेमाल करें।
जानकारी
लेखक का मूल विवरण
Extract text from local PDFs using pdftotext or PyMuPDF via run_shell
repo: HKUDS/AgentPilot
लोकप्रियता
- GitHub स्टार
- 7.8k
- रैंकिंग में स्थान
- #12895
- लाइसेंस
- 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 फ़ाइल तक किसकी पहुंच है, यह जांचने और बदलने देती है, और आपके अनुरोध के लिए सबसे छोटी अनुमति चुनती है।