Document Template Processing Service
A lightweight microservice for processing Word document templates with data injection and PDF conversion.
Get started now View on GitHub
Features
β¨ Easy Template Processing: Transform Word documents with dynamic data injection
π Automatic PDF Conversion: Seamless conversion to PDF using Gotenberg
π Fast REST API: Built with FastAPI for high performance
π³ Docker Ready: Complete containerization with Docker Compose
βΈοΈ Kubernetes Support: Production-ready deployment manifests
Technology Stack
- Backend: FastAPI 0.115.6, Python 3.12
- Templating: docxtpl 0.19.0 (Jinja2-based)
- PDF Generation: Gotenberg 8
- Deployment: Docker, Kubernetes
Getting Started
Quick Start with Docker Compose
The fastest way to get up and running:
git clone https://github.com/etherisc-services/document-templating-service.git
cd document-templating-service
docker compose up -d
Your service will be available at:
- Health Check: http://localhost:8000/
Next Steps
- π Read the Installation Guide for detailed setup options
- π§ Check the Usage Guide for service usage and examples
- π Start building your document templates!
API Examples
Basic Template Processing
Process a Word template with dynamic data:
curl -X POST \
http://localhost:8000/api/v1/process-template-document \
-F "file=@template.docx" \
-F "data={\"name\":\"John Doe\",\"amount\":150.00}" \
--output result.pdf
Template Processing with Images
Process templates with embedded images:
# Encode image and create request
IMAGE_BASE64=$(base64 -w 0 logo.png)
REQUEST_DATA='{"template_data":{"name":"John Doe","logo":""},"images":{"company_logo":{"data":"'$IMAGE_BASE64'","width_mm":50,"height_mm":20}}}'
curl -X POST \
http://localhost:8000/api/v1/process-template-document-with-images \
-F "file=@template.docx" \
-F "request_data=$REQUEST_DATA" \
--output result.pdf
Documentation
π Installation Guide
Complete setup instructions for all environments
π§ Usage Guide
Service usage with templating examples
πΌοΈ Image Support Guide
Include inline images in document templates
π³ Docker Integration Guide
Integrate with existing Docker Compose stacks
About
This service combines the power of docxtpl for Word document templating with Gotenberg for PDF conversion, providing a simple REST API for document processing workflows.
Original Author
Etherisc GmbH (Originally created by M.B.C.M (PapiHack))
Contributing
We welcome contributions! Please feel free to submit a Pull Request. Make sure to include a description with your PR.
License
This project is licensed under the MIT License - see the LICENSE file for details.