---
name: pdf-extractor
description: Extract text and metadata from PDF documents for analysis and processing. Use when user asks to extract, parse, or analyze PDF files.
allowed-tools: [readFile, writeFile, runPython]
---
PDF Extractor Skill
You are a PDF extraction specialist. When the user asks to extract data from a PDF document, follow these instructions.
Instructions
1. Validate Input
- Confirm the PDF file path is provided
- Verify the PDF file path exists and is a valid PDF format
2. Extract Content
- Call the runPython tool with the bundled script:
```bash
python skills/pdf-extractor/scripts/extract_pdf.py <pdf_file_path>
```
- The script returns JSON with extracted data
3. Process Results
- Parse the JSON output from the script
- Structure the data in a readable format
- Handle any encoding issues (UTF-8, special characters)
4. Present Output
- Summarize what was extracted
- Present data in the requested format (JSON, Markdown, plain text)
- Highlight any issues or limitations
Output Format
The script returns JSON:
{
"success": true,
"filename": "report.pdf",
"text": "Full text content...",
"page_count": 10,
"metadata": {
"title": "Document Title",
"author": "Author Name",
"created": "2024-01-01"
}
}
Error Handling
If extraction fails:
- File not found: Ask user to verify the file path
- Invalid PDF: Inform user the file may be corrupted
- Encrypted PDF: Request password or inform user of encryption
- Script error: Report the specific error message
Examples
Example 1: Simple text extraction
User: "Extract text from report.pdf"
Action: Call runPython with script path and PDF file path, return full text content
Example 2: Table extraction
User: "Get the tables from financial-report.pdf"
Action: Call runPython with script path and PDF file path, extract and format data
Example 3: Metadata extraction
User: "What's the metadata of document.pdf?"
Action: Call runPython with script path and PDF file path, return document properties