doc-files
Read what PDF, Office, OpenDocument and EPUB files say: their text and its structure, from headings and lists to tables and the pages, slides, sheets or chapters they sit in. You get a document model, plain text or Markdown.
Status: early development. The model and the command line may still change between releases.
What it reads
| Files | Needs |
|---|---|
Word .docx, Excel .xlsx, PowerPoint .pptx |
nothing beyond Python |
OpenDocument .odt .ods .odp |
nothing beyond Python |
EPUB .epub |
nothing beyond Python |
PDF .pdf |
pypdf, installed with doc-files |
The old binary Office formats (.doc, .xls, .ppt) are not read.
How it works
pip install doc-files
doc-files dump report.docx # plain text
doc-files dump deck.pptx -f markdown # Markdown: a section per slide, notes included
doc-files dump budget.xlsx -f json # the document model
doc-files formats # what can be read
import doc_files
doc = doc_files.read("deck.pptx")
for section in doc.sections: # one per slide
print(section.number, section.title, len(section.notes))
print(doc_files.to_markdown(doc))
What you get, and what you don't
The model keeps what a document means:
- headings and their levels;
- lists and their nesting;
- tables with their merged cells;
- emphasis and links;
- a slide's speaker notes, page headers and footers, each in its own layer.
It leaves out how the document looks: positions, fonts, sizes, page layout. That is the point. The result can be searched, selected, copied and wrapped to any width, which a picture of a page cannot. To see what a file looks like, open it in the application that made it.
A PDF stores glyphs at positions rather than paragraphs and tables, so from a PDF you get the text of each page in reading order, and nothing guessed from the layout. A scanned PDF has no text at all; doc-files says so instead of returning an empty document. It does no OCR.
The model is specified in doc/MODEL_FORMAT.md. XeFM, a dual-pane file manager, uses it to show documents as text.
Safety
Documents are untrusted input. Zip members are read with a size cap (no zip bombs), and XML with a DOCTYPE is refused (no entity expansion). doc-files only reads files. It never writes or changes them.
License
MIT
Metadata
Release files for doc-files 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| doc_files-0.2.0.tar.gz | 32.0 kB | Without provenance | Details for doc_files-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| doc_files-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for doc_files-0.2.0-py3-none-any.whl |
Total release size: 65.6 kB
Release files / doc_files-0.2.0.tar.gz
| Download URL | doc_files-0.2.0.tar.gz |
|---|---|
| Size | 32.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cd5df78dff093319eb226cee09cfaf9c08cb5c8039a33bf4660e32a9e8655a01
|
|
BLAKE2b-256 checksum How to use checksums |
8da0f8e186f465abeaa6805691b364ab13a8860cf410d26377f117ebc3bd8b36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / doc_files-0.2.0-py3-none-any.whl
| Download URL | doc_files-0.2.0-py3-none-any.whl |
|---|---|
| Size | 33.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ecd4b7e873bde7364240aacacdc4725eaec3b1053c2077d1843ce3dc0c95e29
|
|
BLAKE2b-256 checksum How to use checksums |
088c1981ea41cc94147dbf93676547e2827c4cc2315e1ec5fe8c2246ed055847
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for doc-files 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.