Supported Formats
DocFinder supports a wide range of document formats. Each format is handled by a dedicated parser with automatic text extraction and page detection.
| Format | Extension | Parser | Page Model |
|---|---|---|---|
.pdf |
PyMuPDF | Real pages (1-based) | |
| Word | .docx |
python-docx | Virtual pages (10 paragraphs) |
| Word (legacy) | .doc |
olefile | Virtual pages (~3000 chars) |
| OpenDocument Text | .odt |
odfpy | Virtual pages (10 paragraphs) |
| OpenDocument Presentation | .odp |
odfpy | Virtual pages (10 paragraphs) |
| OpenDocument Drawing | .odg |
odfpy | Virtual pages (10 paragraphs) |
| PowerPoint | .pptx |
python-pptx | Slide numbers |
| PowerPoint (legacy) | .ppt |
olefile | Virtual pages (~3000 chars) |
| HTML | .html, .htm |
beautifulsoup4 | Virtual pages (~3000 chars) |
| EPUB | .epub |
zipfile + beautifulsoup4 | Chapter numbers |
| Markdown | .md |
Custom parser | Section numbers (headings) |
| Plain Text | .txt |
Built-in | Virtual pages (~3000 chars) |
Lazy Loading
All format-specific libraries are loaded lazily. If a library is not installed, DocFinder logs a warning and skips files of that type rather than crashing.
Text Extraction Details
PDFs are parsed with PyMuPDF. Tables are detected automatically and rendered as Markdown tables in the extracted text to preserve structure. Text blocks overlapping with tables are excluded to avoid duplication.
Legacy Binary Formats (.doc, .ppt)
These formats use the OLE2 compound document structure (via olefile):
- .doc — The Word piece table is read from the OLE
WordDocumentand table streams, preserving ANSI and Unicode text without indexing binary metadata. - .ppt — A recursive binary record parser walks the
PowerPoint Documentstream looking forTextCharsAtomandTextBytesAtomrecords.
EPUB
EPUB parsing follows the standard OCF container structure:
- Read
META-INF/container.xmlto locate the OPF file - Parse the OPF manifest and spine
- Read each spine item in order
- Extract clean text via BeautifulSoup
Dependency Table
| Format | Required Library | Availability |
|---|---|---|
| PyMuPDF | Included by default | |
| DOCX | python-docx | Included by default |
| DOC, PPT | olefile | Included by default |
| ODT, ODP, ODG | odfpy | Included by default |
| PPTX | python-pptx | Included by default |
| HTML, EPUB | beautifulsoup4 | Included by default |