From b19d8d3f52bf5e99591a7f7dca23a99710dfbd03 Mon Sep 17 00:00:00 2001 From: sirdave73 Date: Wed, 2 Sep 2026 21:55:22 -0400 Subject: [PATCH] any-file to PDF (Phase 2, Chunk A): pandoc converters for docx/odt/rtf/tex/latex/org/adoc/rst, 27 formats, 126 tests green --- Dockerfile | 1 + USER_GUIDE.md | 18 +- app.py | 3 +- converters/__init__.py | 10 + converters/pandoc_converter.py | 269 +++++++++++++++++++++ templates/index.html | 4 +- tests/test_multi_format.py | 4 +- tests/test_pandoc.py | 423 +++++++++++++++++++++++++++++++++ 8 files changed, 721 insertions(+), 11 deletions(-) create mode 100644 converters/pandoc_converter.py create mode 100644 tests/test_pandoc.py diff --git a/Dockerfile b/Dockerfile index 074b58c..4410a72 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ fontconfig \ fonts-dejavu-core \ fonts-noto-cjk \ + pandoc \ && rm -rf /var/lib/apt/lists/* && fc-cache -f WORKDIR /app diff --git a/USER_GUIDE.md b/USER_GUIDE.md index 82952d5..c8ede5e 100644 --- a/USER_GUIDE.md +++ b/USER_GUIDE.md @@ -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; `