Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Extract text from PDFs, images, scans, Word docs (Python)
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 52% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 22% | 0% |
| case-15 | ✗→✓ | ▲ Improved | 10% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 48% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 27% | 0% |
Extract readable text from PDFs, scanned images, and Word documents using Python libraries available in most environments. No cloud API required.
.docx Word document programmaticallypythonimport fitz # pip install pymupdf doc = fitz.open("document.pdf") text = "\n\n".join(page.get_text() for page in doc) print(text[:2000]) # preview first 2000 chars doc.close()
javascript// requires: npm install pdf-parse (already in DevOS dependencies) const pdfParse = require('pdf-parse') const fs = require('fs') const data = await pdfParse(fs.readFileSync('document.pdf')) console.log(data.text.slice(0, 2000)) console.log(`Pages: ${data.numpages}`)
Requires Tesseract installed: winget install UB-Mannheim.TesseractOCR
pythonimport pytesseract # pip install pytesseract from PIL import Image # pip install Pillow img = Image.open("scan.png") text = pytesseract.image_to_string(img, lang="eng") print(text)
pythonimport pytesseract from PIL import Image, ImageFilter, ImageOps img = Image.open("scan.jpg") img = ImageOps.grayscale(img) img = img.filter(ImageFilter.SHARPEN) img = img.point(lambda p: 255 if p > 128 else 0) # binarize text = pytesseract.image_to_string(img, config="--psm 6") print(text)
pythonfrom docx import Document # pip install python-docx doc = Document("report.docx") paras = [p.text for p in doc.paragraphs if p.text.strip()] text = "\n".join(paras) print(text)
pythonimport fitz doc = fitz.open("big_report.pdf") pages = range(4, 9) # pages 5-9 (0-indexed) text = "\n\n".join(doc[i].get_text() for i in pages) print(text)
pythonimport pdfplumber # pip install pdfplumber with pdfplumber.open("financial_report.pdf") as pdf: for page in pdf.pages: for table in page.extract_tables(): for row in table: print("\t".join(str(cell or "") for cell in row))
"Read the text from this PDF contract" → Use step 1 (pymupdf) or step 2 (pdf-parse) depending on whether Python or Node is preferred.
"Extract the table from page 3 of this quarterly report PDF" → Use step 7 (pdfplumber) targeting pdf.pages[2] for page 3.
"Read the text from this scanned invoice image" → Use step 3 or 4 (Tesseract). For low-quality scans, use step 4 with preprocessing.
fitz) extracts only programmatically embedded text — it won't OCR scanned pageslang="hin" for Hindi, "deu" for GermanOther measured skills in the registry, with their headline benchmark lift.