Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
from 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)
6. Extract a specific page range from a PDF
import 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)
7. Extract tables from a PDF
import pdfplumber # pip install pdfplumberwith 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))
Examples
"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.
Cautions
Scanned PDFs (image-only) have no embedded text — Tesseract OCR is required
Tesseract accuracy drops on handwriting, decorative fonts, or low-resolution images (< 150 DPI)
pymupdf (fitz) extracts only programmatically embedded text — it won't OCR scanned pages
Large PDFs can use significant memory — process page by page for files > 100 MB
For non-English text, specify the language code in Tesseract: lang="hin" for Hindi, "deu" for German