From asta-tools
Extracts text from PDFs using olmOCR for cloud batch extraction or remote OCR for single files. Supports markdown output, page ranges, and embedded image extraction.
How this skill is triggered — by the user, by Claude, or both
Slash command
/asta-tools:pdf-extractionThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Extract high-quality text from PDFs using two OCR engines:
Extract high-quality text from PDFs using two OCR engines:
asta pdf-extraction olmocr — cloud-based extraction via olmOCR (best for large batches, S3, and complex layouts)asta pdf-extraction remote — quick single-file extraction via the Asta remote OCR API# Extract text from a PDF using a temporary workspace
TEMP_WORKSPACE=$(mktemp -d)
asta pdf-extraction olmocr "$TEMP_WORKSPACE" \
--pdfs document.pdf \
--markdown
# Output will be in $TEMP_WORKSPACE/markdown/document.md
# Batch extract text from all PDFs in a directory
TEMP_WORKSPACE=$(mktemp -d)
find /path/to/pdfs -name "*.pdf" > "$TEMP_WORKSPACE/pdf-list.txt"
asta pdf-extraction olmocr "$TEMP_WORKSPACE" \
--pdfs "$TEMP_WORKSPACE/pdf-list.txt" \
--markdown
# Batch extract text from PDFs stored in S3
TEMP_WORKSPACE=$(mktemp -d)
asta pdf-extraction olmocr "$TEMP_WORKSPACE" \
--pdfs s3://my-bucket/prefix/*.pdf \
--markdown
Key arguments:
<workspace> - Output directory (required: positional argument)--pdfs - PDF file(s) to process (required: single path, path with wildcard, S3 path with wildcard, or a text file with paths)--markdown - Generate markdown output (recommended)--workers - Parallel workers (default: 20)# Print extracted markdown to stdout
asta pdf-extraction remote paper.pdf
# Save to a file
asta pdf-extraction remote paper.pdf -o paper.md
# Process a large PDF in steps (pages 0-49, then 50-99, etc.)
asta pdf-extraction remote paper.pdf --start-page 0 --max-pages 50 -o paper-part1.md
asta pdf-extraction remote paper.pdf --start-page 50 --max-pages 50 -o paper-part2.md
Key arguments:
<pdf> - PDF file to process (required: local path)-o / --output - Output file path (default: stdout)--start-page - First page to process, 0-indexed (default: 0)--max-pages - Maximum number of pages to process (default: 50)--images - Extract and save embedded images alongside the markdown; images are saved in the same directory as the output file and referenced by filename in the markdownRequirements: Asta login (same as olmocr).
Recommended workflow:
# 1. Create temporary workspace (not in .asta/documents)
TEMP_WORKSPACE=$(mktemp -d)
# 2. Extract text
asta pdf-extraction olmocr "$TEMP_WORKSPACE" \
--pdfs research-paper.pdf \
--markdown
# 3. Move final output to permanent location
mkdir -p ~/.asta/documents/research
mv "$TEMP_WORKSPACE/markdown/research-paper.md" ~/.asta/documents/research/
# 4. Clean up temporary files
rm -rf "$TEMP_WORKSPACE"
Why use a temporary workspace?
Where to store final outputs:
~/.asta/documents/ - For indexing with asta documents# Create temporary workspace and extract
TEMP_WORKSPACE=$(mktemp -d)
asta pdf-extraction olmocr "$TEMP_WORKSPACE" \
--pdfs paper.pdf \
--markdown
# Review the extracted text
cat "$TEMP_WORKSPACE/markdown/paper.md"
# Move to permanent location
mkdir -p ~/.asta/documents/papers
mv "$TEMP_WORKSPACE/markdown/paper.md" ~/.asta/documents/papers/
# Clean up
rm -rf "$TEMP_WORKSPACE"
# Process all PDFs in a directory
TEMP_WORKSPACE=$(mktemp -d)
asta pdf-extraction olmocr "$TEMP_WORKSPACE" \
--pdfs papers/*.pdf \
--markdown \
--workers 10
# Move all extracted markdown files
mkdir -p ~/.asta/documents/batch
mv "$TEMP_WORKSPACE/markdown/"*.md ~/.asta/documents/batch/
# Clean up
rm -rf "$TEMP_WORKSPACE"
# 1. Extract text to temporary workspace
TEMP_WORKSPACE=$(mktemp -d)
asta pdf-extraction olmocr "$TEMP_WORKSPACE" \
--pdfs research-paper.pdf \
--markdown
# 2. Move to documents directory
mkdir -p ~/.asta/documents/research
FINAL_PATH=~/.asta/documents/research/research-paper.md
mv "$TEMP_WORKSPACE/markdown/research-paper.md" "$FINAL_PATH"
# 3. Index in asta documents
asta documents add "file://${FINAL_PATH}" \
--name="Research Paper (OCR)" \
--summary="Extracted via olmOCR" \
--tags="ocr,extracted,research"
# 4. Clean up temporary workspace
rm -rf "$TEMP_WORKSPACE"
olmOCR supports reading PDFs from S3 and using S3 as a workspace.
# Extract PDF stored in S3
TEMP_WORKSPACE=$(mktemp -d)
asta pdf-extraction olmocr "$TEMP_WORKSPACE" \
--pdfs s3://my-bucket/documents/paper.pdf \
--markdown
# Output will be in local workspace
cat "$TEMP_WORKSPACE/markdown/paper.md"
# Use S3 bucket as workspace (requires AWS credentials)
asta pdf-extraction olmocr s3://my-bucket/ocr-workspace \
--pdfs document.pdf \
--markdown
# Output will be in s3://my-bucket/ocr-workspace/markdown/document.md
S3 Configuration:
~/.aws/credentials or environment variables)After extraction, the workspace directory contains:
workspace/
├── markdown/ # Markdown output (if --markdown used)
│ └── document.md
├── output/ # Raw JSON output
│ └── document.json
└── work_queue/ # Internal work tracking
The extracted text is saved as markdown, preserving:
# Process with 50 parallel workers (faster for large batches)
TEMP_WORKSPACE=$(mktemp -d)
asta pdf-extraction olmocr "$TEMP_WORKSPACE" \
--pdfs papers/*.pdf \
--workers 50 \
--markdown
# Apply filters to skip non-English or form-like documents
TEMP_WORKSPACE=$(mktemp -d)
asta pdf-extraction olmocr "$TEMP_WORKSPACE" \
--pdfs documents/*.pdf \
--apply_filter \
--markdown
# View statistics about a workspace
asta pdf-extraction olmocr ~/workspace/output --stats
The first argument must be a workspace directory:
# ✓ Correct
asta pdf-extraction olmocr ~/workspace/output --pdfs file.pdf ...
# ✗ Wrong (missing workspace)
asta pdf-extraction olmocr --pdfs file.pdf ...
Check the output directories:
<workspace>/markdown/<workspace>/output/olmocr | remote | |
|---|---|---|
| Input | Local file, S3 path, or glob | Local file only |
| Output | Files in workspace directory | Stdout or single file |
| Batch processing | Yes (--workers) | No |
| S3 support | Yes | No |
| Auth required | Asta login | Asta login |
| Best for | Large batches, complex layouts | Quick single-file extraction |
✅ Use PDF extraction when:
❌ Don't use when:
npx claudepluginhub allenai/asta-plugins --plugin asta-toolsExtracts text and structured data from single or batch PDFs using 9 backends with automatic fallback, OCR for scanned docs, and markdown output via CLI.
Extracts, converts, and structures content from PDFs, images, and Office documents using OCR, text extraction, and markdown conversion. Supports batch processing and structured data extraction.
Routes PDF conversions through analysis to choose optimal extraction tools and settings for Markdown, HTML, text, JSON, DOCX, or structured notes.