906 Feature PDF Extractor 92093e36

Technical implementation notes for PDF extraction.

tools-only Updated 7 repo stars

File contents

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

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.

tools-only/X-Skills/tree/main/data-analysis/906-feature-pdf-extractor_92093e36 commit 99cb28bcfd

Frequently asked questions

npx skillmds@latest add tools-only/906-feature-pdf-extractor-92093e36