Skip to content
πŸ“– PDF Book to Text Extractor Tool
Featured

πŸ“– PDF Book to Text Extractor Tool

CLI Tools MIT v1.0.0

Extract clean, publication-grade plain text from PDF books β€” specially tuned for programming and technical literature.

5.0 (1 review)
0 downloads
0 likes
5 views

About This Project

Standard PDF extraction tools (pdftotext, pypdf, pdfplumber) treat technical books like plain text documents. This breaks code listings, loses indentation, inserts running headers into functions, and destroys chapter hierarchies. ###FEATURES: Authoritative Chapter Hierarchy: Uses PDF bookmarks (Table of Contents) as ground truth, formatting headings with clean underlines (====, ----, ~~~~). Preserves Section Numbers: Retains printed numbering (3.1 Function calls, 3.2 Math functions) that typical outline parsers drop. Dual-Tier Monospace & Code Detection: Regex matching for popular monospace families (Courier, Consolas, JetBrains Mono, Fira Code, M+, DejaVu, etc.). Mathematical character-metric analysis: Measures Latin glyph width variance. If character advances are uniform across diverse letters ('i' vs 'm'), it is classified as codeβ€”detecting custom/renamed fonts with 100% accuracy. Intelligent Indentation Reconstruction: Computes code indentation and multi-column alignment from character bounding boxes, keeping tabs, nested loops, and ASCII diagrams aligned. Margin Band Header/Footer Removal: Detects recurring top and bottom margin coordinates across hundreds of pages, removing page numbers and alternating chapter headers without losing text. Continuous Code Stitching: Re-joins code blocks that span across physical page breaks. Syntax Normalization: Straightens curly quotes (β€œ, ”, β€˜, ’) and hyphens (βˆ’, β€”) into valid ASCII code characters (", ', -). Smart De-Hyphenation: Reconstructs broken lines while checking an internal book-specific vocabulary to preserve true compound words. Full Multilingual & Arabic (RTL) Support: Preserves natural Right-to-Left (RTL) reading order and span continuity for Arabic, Hebrew, and Persian PDFs without word inversion. Mojibake & Encoding Immunity: Sanitizes corrupt PDF bookmarks (null bytes, byte-swapped UTF-16) and outputs UTF-8 with BOM (utf-8-sig), completely preventing text editors (like Windows Notepad) from misinterpreting English/Arabic as Chinese characters. Chapter Splitting (--split-chapters): Exports both the full text and a folder of numbered chapter files (01 - Preface.txt, 02 - Chapter 1.txt). LLM & RAG Friendly: Optional single-line paragraph mode (-w 0) with page markers (--page-markers) for vector databases and embedding pipelines.

Reviews (1) 5.0

Please sign in to leave a review.

Sign In
A
Author
3Β hours ago

I'm happy to share a good tools for everyone

Get This Project

Sign in to download

View on GitHub
Like (0)
Source GitHub
Version 1.0.0
License MIT
Published Oct 23, 2026
Updated 3Β hours ago

About the Author

A

azzani

@azzani

5 projects shared