A Node.js-based service that converts .docx and .pdf documents to HTML with high layout fidelity. Ideal for resume parsing, previews, and web-based document viewers.
- 🧠 Converts
.docxusing LibreOffice - 🖼️ Converts
.pdfusing pdf2htmlEX - 📄 Preserves original layout, fonts, and formatting
- ⚙️ Built with Node.js + Docker
- 🌐 Preview rendered HTML directly in the browser
doc-to-html-service/
├── Dockerfile
├── docker-compose.yml
├── server.js
├── package.json
├── uploads/ # Uploaded files (auto-created)
├── converted/ # Output HTML files (auto-created)
└── public/
└── index.html # Simple HTML upload interface
# Build the container
docker compose build --no-cache
# Start the service
docker compose upOnce running, open your browser to:
http://localhost:3000
Upload a .docx or .pdf file and preview the converted HTML in the embedded iframe.
Upload a file using multipart/form-data.
Field name: document
Response:
{
"message": "Converted successfully",
"htmlUrl": "/converted/your-file-name.html"
}- Node.js
- Express
- Multer for file uploads
- LibreOffice for
.docx→.html - pdf2htmlEX for
.pdf→.html
- All uploaded and converted files are stored locally in
uploads/andconverted/. - You can mount volumes or persist data externally in production.
- pdf2htmlEX builds from source (adds time to Docker build).
ISC