* * * GUIDES * * *

OCR a PDF from the command line.

No SDK, no install — if you have curl you have OCR. Useful for shell scripts, cron jobs and quick one-offs.

01 / THE ONE-LINER

curl -s https://api.pennyocr.com/v1/ocr?format=text \
  -H "Authorization: Bearer $PENNYOCR_API_KEY" \
  -F "file=@scan.pdf" | jq -r .text

02 / MARKDOWN WITH TABLES

curl -s https://api.pennyocr.com/v1/ocr \
  -H "Authorization: Bearer $PENNYOCR_API_KEY" \
  -F "file=@report.pdf" | jq -r .text > report.md

03 / BY URL, SPECIFIC PAGES, SPEND-CAPPED

curl -s https://api.pennyocr.com/v1/ocr/url \
  -H "Authorization: Bearer $PENNYOCR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/doc.pdf", "pages": "1-10", "max_cost_usd": 0.01}' \
  | jq -r '.page_results[] | "--- page \(.page) ---", .text'

04 / A WHOLE DIRECTORY

for f in scans/*.pdf; do
  curl -s https://api.pennyocr.com/v1/ocr?format=text \
    -H "Authorization: Bearer $PENNYOCR_API_KEY" \
    -F "file=@$f" | jq -r .text > "${f%.pdf}.txt"
done

Estimate before you spend: POST the URL to /v1/estimate (free) and it returns the page count and exact cost. Full reference at pennyocr.com/docs.