2953 Fetch PDF 360ca3de

fetch-pdf

tools-only Updated 7 repo stars

File contents

fetch-pdf

Download and extract text from a PDF URL using curl and a PDF text extraction tool.

Usage

# Download PDF
curl -L -o document.pdf "URL"

# Extract all text from PDF (requires pdftotext from poppler-utils)
pdftotext document.pdf output.txt

# Or use Python's pdfplumber for better text extraction
python3 -c "import pdfplumber; pdf = pdfplumber.open('document.pdf'); text = '\n\n'.join([page.extract_text() for page in pdf.pages]); print(text)"

Installation

macOS

brew install poppler  # for pdftotext
# or
pip install pdfplumber  # for Python approach

Linux

sudo apt-get install poppler-utils  # for pdftotext
# or
pip install pdfplumber  # for Python approach

Example

# Download a PDF
curl -L -o document.pdf "https://example.gov/document.pdf"

# Extract all text
pdftotext document.pdf document.txt

# View the extracted text
cat document.txt

tools-only/X-Skills/tree/main/development/tools/2953-fetch-pdf_360ca3de commit 017208c746

Frequently asked questions

npx skillmds@latest add tools-only/2953-fetch-pdf-360ca3de