any-file to PDF (Phase 2, Chunk A): pandoc converters for docx/odt/rtf/tex/latex/org/adoc/rst, 27 formats, 126 tests green

This commit is contained in:
sirdave73
2026-09-02 21:55:22 -04:00
parent 2931d547de
commit b19d8d3f52
8 changed files with 721 additions and 11 deletions
+11 -7
View File
@@ -1,7 +1,8 @@
# Document → PDF Converter — User Guide
A small, self-hosted web app that converts common document formats —
EPUB3 ebooks, Markdown, HTML, plain text, CSV/TSV, JSON, XML, SVG,
EPUB3 ebooks, office documents (DOCX/ODT/RTF), TeX/LaTeX, Org,
AsciiDoc, RST, Markdown, HTML, plain text, CSV/TSV, JSON, XML, SVG,
images, and existing PDFs — into PDFs.
Everything runs locally (or on your own server); **no file ever leaves your machine**.
@@ -14,15 +15,18 @@ Everything runs locally (or on your own server); **no file ever leaves your mach
| Preserves the EPUB's own CSS, images, headings, tables, code blocks | Re-flow or re-typeset like a print publisher would |
| Renders CJK (Chinese / Japanese / Korean) correctly via Noto fonts | Handle DRM-protected (e.g. protected) EPUBs |
| Supports right-to-left books (Arabic, Hebrew) | Convert *to* other formats (only PDF out) |
| Keeps book title/author as PDF metadata | Office formats (DOCX, PPTX, XLSX) — planned, not yet |
| Keeps book title/author as PDF metadata | PPTX, XLSX and other Office formats — planned, not yet |
**Supported input formats (18):**
**Supported input formats (27):**
| Family | Extensions | Notes |
|---|---|---|
| Ebooks | `.epub` | Full CSS / images / metadata fidelity (the original mode) |
| Web | `.html` `.htm` | Native WeasyPrint rendering; `<script>` tags stripped |
| Markup | `.md` `.markdown` | Headers, tables, fenced code, links |
| Office | `.docx` `.odt` `.rtf` | Via pandoc; title from document metadata (DOCX/ODT) or the H1 |
| TeX / LaTeX | `.tex` `.latex` | Via pandoc; needs `\documentclass` or a leading `%`, else treated as plain text |
| Extended markup | `.org` `.adoc` `.rst` | Org mode, AsciiDoc, reStructuredText via pandoc |
| Text | `.txt` `.log` | UTF-8 safe, paginated |
| Data | `.csv` `.tsv` | Auto-detected delimiter → styled table; max 5000 rows × 50 cols |
| Structured | `.json` `.xml` | Cleanly formatted listing |
@@ -44,8 +48,8 @@ another in the same server process), max upload **400 MB**, max output **200 MB*
### Option A — Run directly (no Docker)
```bash
# 1. install dependencies (Python 3.11+; WeasyPrint also needs the pango
# system libraries, e.g. on Debian/Ubuntu: sudo apt install libpango-1.0-0
# libpangoft2-1.0-0 libharfbuzz0b fontconfig fonts-noto-cjk shared-mime-info)
# system libraries; pandoc for office/TeX/markup formats — e.g. on Debian/Ubuntu: sudo apt install libpango-1.0-0
# libpangoft2-1.0-0 libharfbuzz0b fontconfig fonts-noto-cjk shared-mime-info pandoc)
pip install -r requirements.txt
# 2. start the web server
@@ -71,7 +75,7 @@ See `COOLIFY.md` in this directory (3 steps: Dockerfile service, port 8030, volu
1. Open `http://<host>:8030` in your browser.
2. **Drop any supported file** onto the upload box (or click to browse).
- The 18 formats in §1 are accepted; anything else is rejected with a message.
- The 27 formats in §1 are accepted; anything else is rejected with a message.
- Files over 400 MB are rejected before upload finishes.
3. The job starts immediately — progress updates show the current stage
(e.g. `Rendering chapter-04.xhtml (4/12)` for EPUBs), then `Done`.
@@ -89,7 +93,7 @@ See `COOLIFY.md` in this directory (3 steps: Dockerfile service, port 8030, volu
| `No readable content found in EPUB spine` | The EPUB has no HTML chapters (images-only books, broken exports) |
| `DRM protected` style errors | Remove DRM first (Calibre / Calibre-DB tools) — this app can't decrypt |
| Stuck at `Working…` forever | The server restarted mid-job; refresh the page and re-upload |
| `Unsupported format` | File isn't one of the 18 supported types — see §1 |
| `Unsupported format` | File isn't one of the 27 supported types — see §1 |
| CSV/TSV rejected | Over 5000 rows or 50 columns — split the file |
| PDF rejected | Encrypted/password-protected, or over 500 pages |