# 906 Feature PDF Extractor 92093e36

> Technical implementation notes for PDF extraction.

- Skill: `tools-only/906-feature-pdf-extractor-92093e36` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add tools-only/906-feature-pdf-extractor-92093e36`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tools-only/906-feature-pdf-extractor-92093e36/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: tools-only (https://skillmd.com/u/tools-only)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/tools-only/906-feature-pdf-extractor-92093e36

---


# Implementation Guide

## Code Structure
**How is the code organized?**

- `pdf_to_epub/core/pdf_extractor.py`

## Implementation Notes
**Key technical details to remember:**

### PyMuPDF Usage
```python
import fitz
doc = fitz.open(path)
for page in doc:
    text = page.get_text("text", sort=True)
```
Setting `sort=True` is vital for correct reading order.

### Paragraph Joining
PDF text often has extra newlines. We should join lines that end without "sentence-ending" punctuation or lines that look like parts of the same flow.

## Error Handling
**How do we handle failures?**

- Catch `fitz.FileDataError` for corrupted files.
- Catch `RuntimeError` for encrypted files without password.

