From 665db27abd3d55b831033507073694f88d3d42c4 Mon Sep 17 00:00:00 2001 From: RyujiYasukochi Date: Sat, 14 Nov 2026 13:19:11 +0900 Subject: [PATCH 1/6] feat: add Oxi (oxidocs) converter for docx to pdf and png Signed-off-by: RyujiYasukochi --- Dockerfile | 13 ++++++++++ README.md | 1 + knip.json | 1 + src/converters/main.ts | 5 ++++ src/converters/oxidocs.ts | 43 ++++++++++++++++++++++++++++++++ src/helpers/printVersions.ts | 11 ++++++++ tests/converters/main.test.ts | 1 + tests/converters/oxidocs.test.ts | 27 ++++++++++++++++++++ 8 files changed, 102 insertions(+) create mode 100644 src/converters/oxidocs.ts create mode 100644 tests/converters/oxidocs.test.ts diff --git a/Dockerfile b/Dockerfile index 7a6d40b3..2237d22c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -76,6 +76,19 @@ RUN ARCH=$(uname -m) && \ chmod +x /usr/local/bin/vtracer && \ rm /tmp/vtracer.tar.gz +# Install oxidocs binary (docx to pdf/png) +RUN ARCH=$(uname -m) && \ + if [ "$ARCH" = "aarch64" ]; then \ + OXIDOCS_ASSET="oxidocs-aarch64-unknown-linux-musl"; \ + else \ + OXIDOCS_ASSET="oxidocs-x86_64-unknown-linux-musl"; \ + fi && \ + curl -L -o /tmp/oxidocs.tar.gz "https://github.com/Ryujiyasu/oxi/releases/download/oxidocs-v0.9.0-static.3/${OXIDOCS_ASSET}.tar.gz" && \ + tar -xzf /tmp/oxidocs.tar.gz -C /tmp/ && \ + mv "/tmp/${OXIDOCS_ASSET}/oxidocs" /usr/local/bin/oxidocs && \ + chmod +x /usr/local/bin/oxidocs && \ + rm -r /tmp/oxidocs.tar.gz "/tmp/${OXIDOCS_ASSET}" + COPY --from=base /app/public/ /app/public/ COPY --from=base /app/dist/convertx /app/convertx diff --git a/README.md b/README.md index 6ec13378..f5f9a83d 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ A self-hosted online file converter. Supports over a thousand different formats. | [XeLaTeX](https://tug.org/xetex/) | LaTeX | 1 | 1 | | [Calibre](https://calibre-ebook.com/) | E-books | 26 | 19 | | [LibreOffice](https://www.libreoffice.org/) | Documents | 41 | 22 | +| [Oxi](https://github.com/Ryujiyasu/oxi) | Word documents | 3 | 2 | | [Dasel](https://github.com/TomWright/dasel) | Data Files | 5 | 4 | | [DjVuLibre](https://djvu.sourceforge.net/) | Documents | 2 | 2 | | [Pandoc](https://pandoc.org/) | Documents | 43 | 65 | diff --git a/knip.json b/knip.json index 472bad85..f0326730 100644 --- a/knip.json +++ b/knip.json @@ -18,6 +18,7 @@ "heif-info", "potrace", "soffice", + "oxidocs", "perl", "markitdown", "fmt" diff --git a/src/converters/main.ts b/src/converters/main.ts index a82adadd..c1fd41e7 100644 --- a/src/converters/main.ts +++ b/src/converters/main.ts @@ -23,6 +23,7 @@ import { convert as convertLibjxl, properties as propertiesLibjxl } from "./libj import { convert as convertLibreOffice, properties as propertiesLibreOffice } from "./libreoffice"; import { convert as convertMarkitdown, properties as propertiesMarkitdown } from "./markitdown"; import { convert as convertMsgconvert, properties as propertiesMsgconvert } from "./msgconvert"; +import { convert as convertOxidocs, properties as propertiesOxidocs } from "./oxidocs"; import { convert as convertPandoc, properties as propertiesPandoc } from "./pandoc"; import { convert as convertPdftops, properties as propertiesPdftops } from "./pdftops"; import { convert as convertPotrace, properties as propertiesPotrace } from "./potrace"; @@ -104,6 +105,10 @@ const properties: Record< properties: propertiesLibreOffice, converter: convertLibreOffice, }, + oxidocs: { + properties: propertiesOxidocs, + converter: convertOxidocs, + }, pandoc: { properties: propertiesPandoc, converter: convertPandoc, diff --git a/src/converters/oxidocs.ts b/src/converters/oxidocs.ts new file mode 100644 index 00000000..0f917514 --- /dev/null +++ b/src/converters/oxidocs.ts @@ -0,0 +1,43 @@ +import { execFile as execFileOriginal } from "node:child_process"; + +import { ExecFileFn } from "./types"; + +export const properties = { + from: { + text: ["docx", "docm", "dotx"], + }, + to: { + text: ["pdf", "png"], + }, +}; + +export function convert( + filePath: string, + fileType: string, + convertTo: string, + targetPath: string, + options?: unknown, + execFile: ExecFileFn = execFileOriginal, // to make it mockable +): Promise { + // png draws the first page; pdf converts the whole document. + // --quiet: nothing is printed on success, only warnings and errors + const command = convertTo === "png" ? "docx-to-png" : "docx-to-pdf"; + + return new Promise((resolve, reject) => { + execFile("oxidocs", [command, "--quiet", filePath, targetPath], (error, stdout, stderr) => { + if (error) { + reject(`error: ${error}`); + } + + if (stdout) { + console.log(`stdout: ${stdout}`); + } + + if (stderr) { + console.error(`stderr: ${stderr}`); + } + + resolve("Done"); + }); + }); +} diff --git a/src/helpers/printVersions.ts b/src/helpers/printVersions.ts index 6d7ba3b4..97171ff6 100644 --- a/src/helpers/printVersions.ts +++ b/src/helpers/printVersions.ts @@ -106,6 +106,17 @@ if (process.env.NODE_ENV === "production") { } }); + exec("oxidocs --version", (error, stdout) => { + if (error) { + console.error("oxidocs is not installed"); + return; + } + + if (stdout) { + console.log(`oxidocs v${stdout.replace("oxidocs", "").trim()}`); + } + }); + exec("xelatex -version", (error, stdout) => { if (error) { console.error("Tex Live with XeTeX is not installed."); diff --git a/tests/converters/main.test.ts b/tests/converters/main.test.ts index 00b7bd92..8f3c6b2c 100644 --- a/tests/converters/main.test.ts +++ b/tests/converters/main.test.ts @@ -100,6 +100,7 @@ describe("converter registry", () => { "libreoffice", "markitDown", "msgconvert", + "oxidocs", "pandoc", "pdftops", "potrace", diff --git a/tests/converters/oxidocs.test.ts b/tests/converters/oxidocs.test.ts new file mode 100644 index 00000000..da832ab8 --- /dev/null +++ b/tests/converters/oxidocs.test.ts @@ -0,0 +1,27 @@ +import { expect, test } from "bun:test"; + +import { convert } from "../../src/converters/oxidocs"; +import { runCommonTests } from "./helpers/commonTests"; +import { createMockExecFile } from "./helpers/converters"; + +runCommonTests(convert); + +test("converts docx to pdf with docx-to-pdf", async () => { + const { execFile, calls } = createMockExecFile(); + + await convert("in/report.docx", "docx", "pdf", "out/report.pdf", undefined, execFile); + + expect(calls).toEqual([ + { cmd: "oxidocs", args: ["docx-to-pdf", "--quiet", "in/report.docx", "out/report.pdf"] }, + ]); +}); + +test("draws the first page with docx-to-png", async () => { + const { execFile, calls } = createMockExecFile(); + + await convert("in/report.docx", "docx", "png", "out/report.png", undefined, execFile); + + expect(calls).toEqual([ + { cmd: "oxidocs", args: ["docx-to-png", "--quiet", "in/report.docx", "out/report.png"] }, + ]); +}); From 7232689b3d28ef4aa076435d259b1f3f352ec552 Mon Sep 17 00:00:00 2001 From: RyujiYasukochi Date: Sat, 14 Nov 2026 13:43:07 +0900 Subject: [PATCH 2/6] fix: verify the oxidocs download and convert with --strict Signed-off-by: RyujiYasukochi --- Dockerfile | 3 +++ src/converters/oxidocs.ts | 31 +++++++++++++++++++------------ tests/converters/oxidocs.test.ts | 10 ++++++++-- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2237d22c..bd634894 100644 --- a/Dockerfile +++ b/Dockerfile @@ -80,10 +80,13 @@ RUN ARCH=$(uname -m) && \ RUN ARCH=$(uname -m) && \ if [ "$ARCH" = "aarch64" ]; then \ OXIDOCS_ASSET="oxidocs-aarch64-unknown-linux-musl"; \ + OXIDOCS_SHA256="7c0ba9fd11010e21fcb48913dafb506e93871d9f7daa45ded6f7ae5b1493c19d"; \ else \ OXIDOCS_ASSET="oxidocs-x86_64-unknown-linux-musl"; \ + OXIDOCS_SHA256="38a40a4dfc8925cd9c04593a26f1977d599081de1c0cde741a422d21dd4bb330"; \ fi && \ curl -L -o /tmp/oxidocs.tar.gz "https://github.com/Ryujiyasu/oxi/releases/download/oxidocs-v0.9.0-static.3/${OXIDOCS_ASSET}.tar.gz" && \ + echo "${OXIDOCS_SHA256} /tmp/oxidocs.tar.gz" | sha256sum -c - && \ tar -xzf /tmp/oxidocs.tar.gz -C /tmp/ && \ mv "/tmp/${OXIDOCS_ASSET}/oxidocs" /usr/local/bin/oxidocs && \ chmod +x /usr/local/bin/oxidocs && \ diff --git a/src/converters/oxidocs.ts b/src/converters/oxidocs.ts index 0f917514..56da596e 100644 --- a/src/converters/oxidocs.ts +++ b/src/converters/oxidocs.ts @@ -20,24 +20,31 @@ export function convert( execFile: ExecFileFn = execFileOriginal, // to make it mockable ): Promise { // png draws the first page; pdf converts the whole document. + // --strict: when the document holds content Oxi does not draw, it writes + // nothing and fails (naming the content) rather than hand back a file with + // parts missing; LibreOffice can then be chosen instead. // --quiet: nothing is printed on success, only warnings and errors const command = convertTo === "png" ? "docx-to-png" : "docx-to-pdf"; return new Promise((resolve, reject) => { - execFile("oxidocs", [command, "--quiet", filePath, targetPath], (error, stdout, stderr) => { - if (error) { - reject(`error: ${error}`); - } + execFile( + "oxidocs", + [command, "--strict", "--quiet", filePath, targetPath], + (error, stdout, stderr) => { + if (error) { + reject(`error: ${error}`); + } - if (stdout) { - console.log(`stdout: ${stdout}`); - } + if (stdout) { + console.log(`stdout: ${stdout}`); + } - if (stderr) { - console.error(`stderr: ${stderr}`); - } + if (stderr) { + console.error(`stderr: ${stderr}`); + } - resolve("Done"); - }); + resolve("Done"); + }, + ); }); } diff --git a/tests/converters/oxidocs.test.ts b/tests/converters/oxidocs.test.ts index da832ab8..0879ce53 100644 --- a/tests/converters/oxidocs.test.ts +++ b/tests/converters/oxidocs.test.ts @@ -12,7 +12,10 @@ test("converts docx to pdf with docx-to-pdf", async () => { await convert("in/report.docx", "docx", "pdf", "out/report.pdf", undefined, execFile); expect(calls).toEqual([ - { cmd: "oxidocs", args: ["docx-to-pdf", "--quiet", "in/report.docx", "out/report.pdf"] }, + { + cmd: "oxidocs", + args: ["docx-to-pdf", "--strict", "--quiet", "in/report.docx", "out/report.pdf"], + }, ]); }); @@ -22,6 +25,9 @@ test("draws the first page with docx-to-png", async () => { await convert("in/report.docx", "docx", "png", "out/report.png", undefined, execFile); expect(calls).toEqual([ - { cmd: "oxidocs", args: ["docx-to-png", "--quiet", "in/report.docx", "out/report.png"] }, + { + cmd: "oxidocs", + args: ["docx-to-png", "--strict", "--quiet", "in/report.docx", "out/report.png"], + }, ]); }); From 0e0f694d21442f7d2d3615174f837db23c8396c0 Mon Sep 17 00:00:00 2001 From: RyujiYasukochi Date: Wed, 18 Nov 2026 06:58:50 +0900 Subject: [PATCH 3/6] chore: let Renovate update oxidocs, verified against the release's .sha256 The oxidocs version is one ARG with a renovate annotation, picked up by a regex manager (the Dockerfile's CRLF line endings keep the stock dockerfileVersions preset from matching). The archive is checked against the .sha256 file published with each release instead of hashes pinned in the Dockerfile, so a version bump needs no other edit. Moves to 0.9.0-static.5. Signed-off-by: RyujiYasukochi --- Dockerfile | 16 ++++++++++------ renovate.json | 13 ++++++++++++- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index bd634894..b955cd26 100644 --- a/Dockerfile +++ b/Dockerfile @@ -77,20 +77,24 @@ RUN ARCH=$(uname -m) && \ rm /tmp/vtracer.tar.gz # Install oxidocs binary (docx to pdf/png) +# Renovate bumps OXIDOCS_VERSION when Oxi tags a new oxidocs-v* release; the +# archive is checked against the .sha256 file published next to it. +# renovate: datasource=github-releases depName=Ryujiyasu/oxi extractVersion=^oxidocs-v(?.+)$ +ARG OXIDOCS_VERSION=0.9.0-static.5 RUN ARCH=$(uname -m) && \ if [ "$ARCH" = "aarch64" ]; then \ OXIDOCS_ASSET="oxidocs-aarch64-unknown-linux-musl"; \ - OXIDOCS_SHA256="7c0ba9fd11010e21fcb48913dafb506e93871d9f7daa45ded6f7ae5b1493c19d"; \ else \ OXIDOCS_ASSET="oxidocs-x86_64-unknown-linux-musl"; \ - OXIDOCS_SHA256="38a40a4dfc8925cd9c04593a26f1977d599081de1c0cde741a422d21dd4bb330"; \ fi && \ - curl -L -o /tmp/oxidocs.tar.gz "https://github.com/Ryujiyasu/oxi/releases/download/oxidocs-v0.9.0-static.3/${OXIDOCS_ASSET}.tar.gz" && \ - echo "${OXIDOCS_SHA256} /tmp/oxidocs.tar.gz" | sha256sum -c - && \ - tar -xzf /tmp/oxidocs.tar.gz -C /tmp/ && \ + OXIDOCS_URL="https://github.com/Ryujiyasu/oxi/releases/download/oxidocs-v${OXIDOCS_VERSION}/${OXIDOCS_ASSET}.tar.gz" && \ + curl -fL -o "/tmp/${OXIDOCS_ASSET}.tar.gz" "${OXIDOCS_URL}" && \ + curl -fL -o "/tmp/${OXIDOCS_ASSET}.tar.gz.sha256" "${OXIDOCS_URL}.sha256" && \ + (cd /tmp && sha256sum -c "${OXIDOCS_ASSET}.tar.gz.sha256") && \ + tar -xzf "/tmp/${OXIDOCS_ASSET}.tar.gz" -C /tmp/ && \ mv "/tmp/${OXIDOCS_ASSET}/oxidocs" /usr/local/bin/oxidocs && \ chmod +x /usr/local/bin/oxidocs && \ - rm -r /tmp/oxidocs.tar.gz "/tmp/${OXIDOCS_ASSET}" + rm -r "/tmp/${OXIDOCS_ASSET}.tar.gz" "/tmp/${OXIDOCS_ASSET}.tar.gz.sha256" "/tmp/${OXIDOCS_ASSET}" COPY --from=base /app/public/ /app/public/ COPY --from=base /app/dist/convertx /app/convertx diff --git a/renovate.json b/renovate.json index 3418a449..0ee0318d 100644 --- a/renovate.json +++ b/renovate.json @@ -4,5 +4,16 @@ "lockFileMaintenance": { "enabled": true, "automerge": true - } + }, + "customManagers": [ + { + "customType": "regex", + "description": "oxidocs release in the Dockerfile. Its tags are oxidocs-v0.9.0-static.N; the -static.N rebuild number is a release, not a prerelease. A dedicated pattern because the Dockerfile has CRLF line endings, which customManagers:dockerfileVersions does not match.", + "managerFilePatterns": ["/(^|/)Dockerfile$/"], + "matchStrings": [ + "# renovate: datasource=(?\\S+) depName=(?\\S+)(?: extractVersion=(?\\S+))?\\s+ARG\\s+[A-Z0-9_]+_VERSION=(?\\S+)" + ], + "versioningTemplate": "regex:^(?\\d+)\\.(?\\d+)\\.(?\\d+)(?:-static\\.(?\\d+))?$" + } + ] } From e8ca063a22df7195241bffbfc38b0f2ecfbc16f1 Mon Sep 17 00:00:00 2001 From: RyujiYasukochi Date: Thu, 19 Nov 2026 08:19:59 +0900 Subject: [PATCH 4/6] feat: oxidocs converts pptx (pdf, png) and xlsx (pdf); simpler Renovate setup - pptx, pptm and potx go to pdf (every slide) or png (the first slide), xlsx, xlsm, xltx and xltm to pdf (the print areas of every visible sheet), with the same --strict --quiet as docx. - The Dockerfile has LF line endings, so the stock dockerfileVersions preset matches the oxidocs ARG; the versioning (-static.N is a release) and the tag filter are in the renovate comment, and renovate.json only extends the preset. - The .sha256 check is gone: it came from the same release as the archive. Signed-off-by: RyujiYasukochi --- Dockerfile | 235 +++++++++++++++---------------- renovate.json | 19 +-- src/converters/oxidocs.ts | 13 +- tests/converters/oxidocs.test.ts | 31 ++++ 4 files changed, 163 insertions(+), 135 deletions(-) diff --git a/Dockerfile b/Dockerfile index b955cd26..ad9a06d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,120 +1,115 @@ -FROM oven/bun:1.4.4-slim AS base -WORKDIR /app -COPY package.json bun.lock /app/ -RUN bun install --frozen-lockfile -COPY . . - -RUN bun run build:bin - -FROM debian:testing-slim AS release -LABEL org.opencontainers.image.source="https://github.com/C4illin/ConvertX" -WORKDIR /app - -# install additional dependencies -ENV PIPX_HOME=/opt/pipx -ENV PIPX_BIN_DIR=/usr/local/bin - -RUN apt-get update && apt-get install -y \ - assimp-utils \ - ca-certificates \ - calibre \ - curl \ - dasel \ - dcraw \ - djvulibre-bin \ - dvisvgm \ - ffmpeg \ - ghostscript \ - gosu \ - graphicsmagick \ - imagemagick-7.q16 \ - inkscape \ - latexmk \ - libheif-examples \ - libjxl-tools \ - libreoffice \ - libva2 \ - libvips-tools \ - libemail-address-perl \ - libemail-outlook-message-perl \ - lmodern \ - mupdf-tools \ - pandoc \ - poppler-utils \ - potrace \ - python3-numpy \ - python3-tinycss2 \ - resvg \ - texlive \ - texlive-fonts-recommended \ - texlive-latex-extra \ - texlive-latex-recommended \ - texlive-xetex \ - python3 \ - python3-pip \ - pipx \ - --no-install-recommends \ - && pipx install "markitdown[all]" \ - && rm -rf /var/lib/apt/lists/* - -# Remove when patch is released -RUN pipx runpip markitdown install --upgrade --no-cache-dir "Brotli>=1.2.1" "brotlicffi>=1.2.1.0" - -RUN groupadd -g 1000 convertx && \ - useradd -u 1000 -g convertx -d /home/convertx -m -s /bin/bash convertx - -# Install VTracer binary -RUN ARCH=$(uname -m) && \ - if [ "$ARCH" = "aarch64" ]; then \ - VTRACER_ASSET="vtracer-aarch64-unknown-linux-musl.tar.gz"; \ - else \ - VTRACER_ASSET="vtracer-x86_64-unknown-linux-musl.tar.gz"; \ - fi && \ - curl -L -o /tmp/vtracer.tar.gz "https://github.com/visioncortex/vtracer/releases/download/0.6.4/${VTRACER_ASSET}" && \ - tar -xzf /tmp/vtracer.tar.gz -C /tmp/ && \ - mv /tmp/vtracer /usr/local/bin/vtracer && \ - chmod +x /usr/local/bin/vtracer && \ - rm /tmp/vtracer.tar.gz - -# Install oxidocs binary (docx to pdf/png) -# Renovate bumps OXIDOCS_VERSION when Oxi tags a new oxidocs-v* release; the -# archive is checked against the .sha256 file published next to it. -# renovate: datasource=github-releases depName=Ryujiyasu/oxi extractVersion=^oxidocs-v(?.+)$ -ARG OXIDOCS_VERSION=0.9.0-static.5 -RUN ARCH=$(uname -m) && \ - if [ "$ARCH" = "aarch64" ]; then \ - OXIDOCS_ASSET="oxidocs-aarch64-unknown-linux-musl"; \ - else \ - OXIDOCS_ASSET="oxidocs-x86_64-unknown-linux-musl"; \ - fi && \ - OXIDOCS_URL="https://github.com/Ryujiyasu/oxi/releases/download/oxidocs-v${OXIDOCS_VERSION}/${OXIDOCS_ASSET}.tar.gz" && \ - curl -fL -o "/tmp/${OXIDOCS_ASSET}.tar.gz" "${OXIDOCS_URL}" && \ - curl -fL -o "/tmp/${OXIDOCS_ASSET}.tar.gz.sha256" "${OXIDOCS_URL}.sha256" && \ - (cd /tmp && sha256sum -c "${OXIDOCS_ASSET}.tar.gz.sha256") && \ - tar -xzf "/tmp/${OXIDOCS_ASSET}.tar.gz" -C /tmp/ && \ - mv "/tmp/${OXIDOCS_ASSET}/oxidocs" /usr/local/bin/oxidocs && \ - chmod +x /usr/local/bin/oxidocs && \ - rm -r "/tmp/${OXIDOCS_ASSET}.tar.gz" "/tmp/${OXIDOCS_ASSET}.tar.gz.sha256" "/tmp/${OXIDOCS_ASSET}" - -COPY --from=base /app/public/ /app/public/ -COPY --from=base /app/dist/convertx /app/convertx - -# COPY . . -RUN mkdir data - -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh - -EXPOSE 3000/tcp -# used for calibre -ENV QTWEBENGINE_CHROMIUM_FLAGS="--no-sandbox" -ENV NODE_ENV=production -ENTRYPOINT [ "/entrypoint.sh" ] -CMD [ "/app/convertx" ] - -# test stage that includes Bun for running tests if needed -FROM release AS test -COPY --from=base /usr/local/bin/bun /usr/local/bin/bun - -# default target remains release -FROM release +FROM oven/bun:1.4.4-slim AS base +WORKDIR /app +COPY package.json bun.lock /app/ +RUN bun install --frozen-lockfile +COPY . . + +RUN bun run build:bin + +FROM debian:testing-slim AS release +LABEL org.opencontainers.image.source="https://github.com/C4illin/ConvertX" +WORKDIR /app + +# install additional dependencies +ENV PIPX_HOME=/opt/pipx +ENV PIPX_BIN_DIR=/usr/local/bin + +RUN apt-get update && apt-get install -y \ + assimp-utils \ + ca-certificates \ + calibre \ + curl \ + dasel \ + dcraw \ + djvulibre-bin \ + dvisvgm \ + ffmpeg \ + ghostscript \ + gosu \ + graphicsmagick \ + imagemagick-7.q16 \ + inkscape \ + latexmk \ + libheif-examples \ + libjxl-tools \ + libreoffice \ + libva2 \ + libvips-tools \ + libemail-address-perl \ + libemail-outlook-message-perl \ + lmodern \ + mupdf-tools \ + pandoc \ + poppler-utils \ + potrace \ + python3-numpy \ + python3-tinycss2 \ + resvg \ + texlive \ + texlive-fonts-recommended \ + texlive-latex-extra \ + texlive-latex-recommended \ + texlive-xetex \ + python3 \ + python3-pip \ + pipx \ + --no-install-recommends \ + && pipx install "markitdown[all]" \ + && rm -rf /var/lib/apt/lists/* + +# Remove when patch is released +RUN pipx runpip markitdown install --upgrade --no-cache-dir "Brotli>=1.2.1" "brotlicffi>=1.2.1.0" + +RUN groupadd -g 1000 convertx && \ + useradd -u 1000 -g convertx -d /home/convertx -m -s /bin/bash convertx + +# Install VTracer binary +RUN ARCH=$(uname -m) && \ + if [ "$ARCH" = "aarch64" ]; then \ + VTRACER_ASSET="vtracer-aarch64-unknown-linux-musl.tar.gz"; \ + else \ + VTRACER_ASSET="vtracer-x86_64-unknown-linux-musl.tar.gz"; \ + fi && \ + curl -L -o /tmp/vtracer.tar.gz "https://github.com/visioncortex/vtracer/releases/download/0.6.4/${VTRACER_ASSET}" && \ + tar -xzf /tmp/vtracer.tar.gz -C /tmp/ && \ + mv /tmp/vtracer /usr/local/bin/vtracer && \ + chmod +x /usr/local/bin/vtracer && \ + rm /tmp/vtracer.tar.gz + +# Install oxidocs binary (docx, pptx and xlsx to pdf/png) +# renovate: datasource=github-releases depName=Ryujiyasu/oxi versioning=regex:^(?\d+)\.(?\d+)\.(?\d+)(?:-static\.(?\d+))?$ extractVersion=^oxidocs-v(?.+)$ +ARG OXIDOCS_VERSION=0.9.0-static.5 +RUN ARCH=$(uname -m) && \ + if [ "$ARCH" = "aarch64" ]; then \ + OXIDOCS_ASSET="oxidocs-aarch64-unknown-linux-musl"; \ + else \ + OXIDOCS_ASSET="oxidocs-x86_64-unknown-linux-musl"; \ + fi && \ + curl -fL -o /tmp/oxidocs.tar.gz "https://github.com/Ryujiyasu/oxi/releases/download/oxidocs-v${OXIDOCS_VERSION}/${OXIDOCS_ASSET}.tar.gz" && \ + tar -xzf /tmp/oxidocs.tar.gz -C /tmp/ && \ + mv "/tmp/${OXIDOCS_ASSET}/oxidocs" /usr/local/bin/oxidocs && \ + chmod +x /usr/local/bin/oxidocs && \ + rm -r /tmp/oxidocs.tar.gz "/tmp/${OXIDOCS_ASSET}" + +COPY --from=base /app/public/ /app/public/ +COPY --from=base /app/dist/convertx /app/convertx + +# COPY . . +RUN mkdir data + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +EXPOSE 3000/tcp +# used for calibre +ENV QTWEBENGINE_CHROMIUM_FLAGS="--no-sandbox" +ENV NODE_ENV=production +ENTRYPOINT [ "/entrypoint.sh" ] +CMD [ "/app/convertx" ] + +# test stage that includes Bun for running tests if needed +FROM release AS test +COPY --from=base /usr/local/bin/bun /usr/local/bin/bun + +# default target remains release +FROM release diff --git a/renovate.json b/renovate.json index 0ee0318d..30d39593 100644 --- a/renovate.json +++ b/renovate.json @@ -1,19 +1,12 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": ["config:recommended", ":disableDependencyDashboard"], + "extends": [ + "config:recommended", + ":disableDependencyDashboard", + "customManagers:dockerfileVersions" + ], "lockFileMaintenance": { "enabled": true, "automerge": true - }, - "customManagers": [ - { - "customType": "regex", - "description": "oxidocs release in the Dockerfile. Its tags are oxidocs-v0.9.0-static.N; the -static.N rebuild number is a release, not a prerelease. A dedicated pattern because the Dockerfile has CRLF line endings, which customManagers:dockerfileVersions does not match.", - "managerFilePatterns": ["/(^|/)Dockerfile$/"], - "matchStrings": [ - "# renovate: datasource=(?\\S+) depName=(?\\S+)(?: extractVersion=(?\\S+))?\\s+ARG\\s+[A-Z0-9_]+_VERSION=(?\\S+)" - ], - "versioningTemplate": "regex:^(?\\d+)\\.(?\\d+)\\.(?\\d+)(?:-static\\.(?\\d+))?$" - } - ] + } } diff --git a/src/converters/oxidocs.ts b/src/converters/oxidocs.ts index 56da596e..732e1fc5 100644 --- a/src/converters/oxidocs.ts +++ b/src/converters/oxidocs.ts @@ -5,12 +5,19 @@ import { ExecFileFn } from "./types"; export const properties = { from: { text: ["docx", "docm", "dotx"], + presentation: ["pptx", "pptm", "potx"], + calc: ["xlsx", "xlsm", "xltx", "xltm"], }, to: { text: ["pdf", "png"], + presentation: ["pdf", "png"], + calc: ["pdf"], }, }; +const presentations = new Set(properties.from.presentation); +const workbooks = new Set(properties.from.calc); + export function convert( filePath: string, fileType: string, @@ -19,12 +26,14 @@ export function convert( options?: unknown, execFile: ExecFileFn = execFileOriginal, // to make it mockable ): Promise { - // png draws the first page; pdf converts the whole document. + // png draws the first page (the first slide); pdf converts the whole + // document, every slide, or the print areas of every visible sheet. // --strict: when the document holds content Oxi does not draw, it writes // nothing and fails (naming the content) rather than hand back a file with // parts missing; LibreOffice can then be chosen instead. // --quiet: nothing is printed on success, only warnings and errors - const command = convertTo === "png" ? "docx-to-png" : "docx-to-pdf"; + const kind = presentations.has(fileType) ? "pptx" : workbooks.has(fileType) ? "xlsx" : "docx"; + const command = `${kind}-to-${convertTo === "png" ? "png" : "pdf"}`; return new Promise((resolve, reject) => { execFile( diff --git a/tests/converters/oxidocs.test.ts b/tests/converters/oxidocs.test.ts index 0879ce53..15dbfdde 100644 --- a/tests/converters/oxidocs.test.ts +++ b/tests/converters/oxidocs.test.ts @@ -31,3 +31,34 @@ test("draws the first page with docx-to-png", async () => { }, ]); }); + +test("converts a presentation with pptx-to-pdf and pptx-to-png", async () => { + const { execFile, calls } = createMockExecFile(); + + await convert("in/deck.pptx", "pptx", "pdf", "out/deck.pdf", undefined, execFile); + await convert("in/deck.pptx", "pptx", "png", "out/deck.png", undefined, execFile); + + expect(calls).toEqual([ + { + cmd: "oxidocs", + args: ["pptx-to-pdf", "--strict", "--quiet", "in/deck.pptx", "out/deck.pdf"], + }, + { + cmd: "oxidocs", + args: ["pptx-to-png", "--strict", "--quiet", "in/deck.pptx", "out/deck.png"], + }, + ]); +}); + +test("converts a workbook's print areas with xlsx-to-pdf", async () => { + const { execFile, calls } = createMockExecFile(); + + await convert("in/sheet.xlsx", "xlsx", "pdf", "out/sheet.pdf", undefined, execFile); + + expect(calls).toEqual([ + { + cmd: "oxidocs", + args: ["xlsx-to-pdf", "--strict", "--quiet", "in/sheet.xlsx", "out/sheet.pdf"], + }, + ]); +}); From 7b435f1de26be0cc49dd068505487cad9e2a9a54 Mon Sep 17 00:00:00 2001 From: RyujiYasukochi Date: Thu, 19 Nov 2026 08:37:22 +0900 Subject: [PATCH 5/6] feat: oxidocs 0.9.0-static.6, xlsx to png Signed-off-by: RyujiYasukochi --- Dockerfile | 2 +- src/converters/oxidocs.ts | 5 +++-- tests/converters/oxidocs.test.ts | 7 ++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index ad9a06d1..cfcb488e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -78,7 +78,7 @@ RUN ARCH=$(uname -m) && \ # Install oxidocs binary (docx, pptx and xlsx to pdf/png) # renovate: datasource=github-releases depName=Ryujiyasu/oxi versioning=regex:^(?\d+)\.(?\d+)\.(?\d+)(?:-static\.(?\d+))?$ extractVersion=^oxidocs-v(?.+)$ -ARG OXIDOCS_VERSION=0.9.0-static.5 +ARG OXIDOCS_VERSION=0.9.0-static.6 RUN ARCH=$(uname -m) && \ if [ "$ARCH" = "aarch64" ]; then \ OXIDOCS_ASSET="oxidocs-aarch64-unknown-linux-musl"; \ diff --git a/src/converters/oxidocs.ts b/src/converters/oxidocs.ts index 732e1fc5..1c72916d 100644 --- a/src/converters/oxidocs.ts +++ b/src/converters/oxidocs.ts @@ -11,7 +11,7 @@ export const properties = { to: { text: ["pdf", "png"], presentation: ["pdf", "png"], - calc: ["pdf"], + calc: ["pdf", "png"], }, }; @@ -26,7 +26,8 @@ export function convert( options?: unknown, execFile: ExecFileFn = execFileOriginal, // to make it mockable ): Promise { - // png draws the first page (the first slide); pdf converts the whole + // png draws the first page (the first slide, the first printed page of a + // workbook); pdf converts the whole // document, every slide, or the print areas of every visible sheet. // --strict: when the document holds content Oxi does not draw, it writes // nothing and fails (naming the content) rather than hand back a file with diff --git a/tests/converters/oxidocs.test.ts b/tests/converters/oxidocs.test.ts index 15dbfdde..72adc8a6 100644 --- a/tests/converters/oxidocs.test.ts +++ b/tests/converters/oxidocs.test.ts @@ -50,15 +50,20 @@ test("converts a presentation with pptx-to-pdf and pptx-to-png", async () => { ]); }); -test("converts a workbook's print areas with xlsx-to-pdf", async () => { +test("converts a workbook with xlsx-to-pdf and xlsx-to-png", async () => { const { execFile, calls } = createMockExecFile(); await convert("in/sheet.xlsx", "xlsx", "pdf", "out/sheet.pdf", undefined, execFile); + await convert("in/sheet.xlsx", "xlsx", "png", "out/sheet.png", undefined, execFile); expect(calls).toEqual([ { cmd: "oxidocs", args: ["xlsx-to-pdf", "--strict", "--quiet", "in/sheet.xlsx", "out/sheet.pdf"], }, + { + cmd: "oxidocs", + args: ["xlsx-to-png", "--strict", "--quiet", "in/sheet.xlsx", "out/sheet.png"], + }, ]); }); From 3a413ba0e6a7384e21cc0df1fc33356ce03eea14 Mon Sep 17 00:00:00 2001 From: RyujiYasukochi Date: Sun, 22 Nov 2026 17:00:50 +0900 Subject: [PATCH 6/6] build: lay out oxidocs' bundled fonts at build time, so they are there when PUID is set --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ee88fbbe..95cec06d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -78,7 +78,9 @@ RUN ARCH=$(uname -m) && \ chmod +x /usr/local/bin/vtracer && \ rm /tmp/vtracer.tar.gz -# Install oxidocs binary (docx, pptx and xlsx to pdf/png) +# Install oxidocs binary (docx, pptx and xlsx to pdf/png). It writes the fonts it +# carries next to itself on first use, so that is done here, as root: with PUID +# set, /usr/local/bin is not writable when it runs. # renovate: datasource=github-releases depName=Ryujiyasu/oxi versioning=regex:^(?\d+)\.(?\d+)\.(?\d+)(?:-static\.(?\d+))?$ extractVersion=^oxidocs-v(?.+)$ ARG OXIDOCS_VERSION=0.9.0-static.6 RUN ARCH=$(uname -m) && \ @@ -91,6 +93,7 @@ RUN ARCH=$(uname -m) && \ tar -xzf /tmp/oxidocs.tar.gz -C /tmp/ && \ mv "/tmp/${OXIDOCS_ASSET}/oxidocs" /usr/local/bin/oxidocs && \ chmod +x /usr/local/bin/oxidocs && \ + oxidocs fonts-index > /dev/null && \ rm -r /tmp/oxidocs.tar.gz "/tmp/${OXIDOCS_ASSET}" COPY --from=base /app/public/ /app/public/