pdf-page-extract
БесплатноБез исполняемых скриптовНе проверенExtract rich data from PDF pages including text spans with metadata, rendered PNG images, and page mapping. Creates persistent artifacts for downstream…
от aiskillstore★ 509 звёзд на GitHubОб этом скилле
PDF Page Extract Skill
Purpose
This skill extracts all necessary data from PDF pages to enable accurate AI-driven HTML generation. It produces three critical artifacts:
- Rich extraction data - Text spans with font metadata (sizes, styles, positions)
- Rendered PNG image - Visual reference for AI to understand page layout
- Page mapping - Authoritative mapping of PDF indices to book pages
This is the deterministic, Python-based foundation for the entire pipeline. All extracted data is saved to persistent files for traceability and future processing.
What to Do
Validate input parameters
- Check PDF file exists and is readable
- Verify page range (PDF indices or book pages)
- Confirm output directory structure
Establish page mapping (if not already done)
- Run:
python3 Calypso/tools/read_page_footers.py - Scans page footers to establish PDF index → book page mapping
- Saves to:
analysis/page_mapping.json
- Run:
Extract rich page data using PyMuPDF and pdfplumber
- Run:
python3 Calypso/tools/rich_extractor.py - Extracts text spans with font metadata:
- Font name and size
- Bold/italic flags
- Position (bounding box)
- Color information
- Analyzes page structure to identify:
- Likely headings (by size and style)
- Paragraphs (regular text)
- Potential lists
- Detects tables using pdfplumber
- Saves to:
analysis/chapter_XX/rich_extraction.json
- Run:
Render PDF page to PNG
- Convert page to high-resolution PNG image (300+ DPI)
- Maintains visual fidelity for AI reference
- Saves to:
output/chapter_XX/page_artifacts/page_YY/02_page_XX.png
Extract embedded images (if present)
- Run:
python3 Calypso/tools/extract_images.py - Extracts all images from page
- Saves:
output/chapter_XX/images/page_YY_image_*.png - Creates metadata:
page_YY_images.json
- Run:
Validate extraction completeness
- Verify all files saved correctly
- Check JSON files are valid
- Confirm PNG image is readable
- Validate page mapping consistency
Input Parameters
chapter: <int> - Chapter number (1-8)
start_page: <int> - Starting PDF index (0-based) or page range
end_page: <int> - Ending PDF index (optional if single page)
pdf_path: <str> - Path to PDF file (default: Calypso/PREP-AL 4th Ed 9-26-25.pdf)
output_base: <str> - Output directory (default: Calypso/output)
mapping_file: <str> - Page mapping file (default: Calypso/analysis/page_mapping.json)
Output Structure
Artifact Files Saved
Per-page artifacts (in output/chapter_XX/page_artifacts/page_YY/):
01_rich_extraction.json- Text spans with metadata02_page_XX.png- Rendered PDF page imagepage_mapping.json- Shared mapping file (symlink or copy)
Extraction data (in analysis/chapter_XX/):
rich_extraction.json- Full extraction for all pages in chapterpage_6_pattern_analysis.json- (Optional) Pattern analysis for specific pages
Images (in output/chapter_XX/images/chapter_XX/):
page_XX_image_*.png- Embedded images from pagepage_XX_images.json- Metadata for embedded images
Rich Extraction JSON Format
{
"page_number": 16,
"pdf_index": 15,
"book_page": 17,
"chapter": 2,
"dimensions": {
"width": 612,
"height": 792
},
"text_spans": [
{
"text": "Rights in Real Estate",
"font": "Arial-BoldMT",
"size": 27.04,
"bold": true,
"italic": false,
"bbox": {
"x0": 72,
"y0": 150,
"x1": 400,
"y1": 177
},
"color": 0,
"sequence": 1
}
],
"analysis": {
"font_sizes": {
"27.04": 1,
"11.04": 45
},
"font_styles": {
"bold_27.04": 1,
"regular_11.04": 45
},
"likely_headings": [
{
"text": "Rights in Real Estate",
"level": 1,
"confidence": 0.95
}
],
"likely_paragraphs": [
{
"text": "Real property consists of...",
"type": "body_text"
}
]
},
"extraction_timestamp": "2025-11-08T14:30:00Z",
"extraction_tool": "rich_extractor.py v1.0"
}
Python Commands to Execute
Step 1: Establish Page Mapping
cd Calypso/tools
python3 read_page_footers.py \
--start 15 \
--end 28 \
--pdf "../PREP-AL 4th Ed 9-26-25.pdf" \
--output "../analysis/page_mapping.json"
Success indicators:
- Command exits with code 0
- Page mapping JSON created/updated
- All pages in range have entries
Step 2: Extract Rich Data
cd Calypso/tools
python3 rich_extractor.py \
--pdf "../PREP-AL 4th Ed 9-26-25.pdf" \
--start 15 \
--end 28 \
--output "../analysis/chapter_02/rich_extraction.json"
Success indicators:
- Command exits with code 0
- JSON file created
- File contains text_spans array
- All pages in range represented
Step 3: Render to PNG
cd Cal
Установить pdf-page-extract в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл pdf-page-extract?
Extract rich data from PDF pages including text spans with metadata, rendered PNG images, and page mapping. Creates persistent artifacts for downstream processing.
Как установить скилл pdf-page-extract?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл pdf-page-extract запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic