Node.js + React app to batch-convert DOCX/PPTX to PDF and PDF back to DOCX/PPTX using LibreOffice headless mode.
- Node.js 18+
- LibreOffice installed.
- Preferred: add
sofficeto PATH. - Windows: set
SOFFICE_PATHinserver/.envto the full exe path, e.g.C:\\Program Files\\LibreOffice\\program\\soffice.exe. - If you see
spawn soffice ENOENT, the backend cannot find the binary—setSOFFICE_PATHor add LibreOffice to PATH and restartnpm run dev.
- Preferred: add
- Backend
cd server
npm install
cp .env.example .env # on Windows: copy .env.example .env
npm run dev- Frontend (new terminal)
cd web
npm install
npm run dev- Open the UI at the URL printed by Vite (defaults to http://localhost:5173). The UI proxies API calls to http://localhost:4000.
- POST /api/convert
- Form-data fields:
files(one or many),targetFormat(pdf | docx | pptx) - Response:
{ jobId, targetFormat, results: [{ input, output, url, status, error? }] }
- Form-data fields:
- GET /api/health
Supported directions:
- targetFormat=pdf → accepts .doc, .docx, .ppt, .pptx
- targetFormat=docx → accepts .pdf (LibreOffice draw import → DOCX)
- targetFormat=pptx → accepts .pdf (LibreOffice draw import → PPTX)
Outputs are served for download from /downloads/{jobId}/{file} and cleaned after OUTPUT_TTL_MINUTES (default 60).
Set in server/.env:
- PORT (default 4000)
- CONCURRENCY (queue parallelism, default 1 for sequential safety)
- SOFFICE_PATH (path to LibreOffice executable)
- CONVERSION_TIMEOUT_MS (per-file cap)
- CONVERSION_RETRIES (per-file attempts, default 5)
- OUTPUT_TTL_MINUTES (how long to keep artifacts)
- PDF→DOCX/PPTX quality depends on LibreOffice import fidelity; complex layouts may shift.
- Temp uploads are removed after each job; output folders are pruned on an interval.
- Backend: server/src/server.js, server/src/converter.js
- Frontend: web/src/App.jsx, web/src/api.js
signed by Otaku