Service for generating PDF documents from DOCX templates using JSON data.
- Docker
- Running conversion service on port 8181
-
Build the Docker image:
docker build -t doc-processor .
-
Run the service:
docker run -p 8000:8000 doc-processor
The service will be available at http://localhost:8000
OpenAPI - /api/v1/doc
POST /api/v1/documents/upload
Process a DOCX template with JSON data and returns a PDF.
- Content-Type:
multipart/form-data
- Parameters:
file
: DOCX template filejson
: JSON data for template processing
curl -X POST \
-F "[email protected]" \
-F "json={\"name\":\"John Doe\",\"age\":30}" \
http://localhost:8000/api/v1/documents/upload \
--output result.pdf
- Success: PDF file (
application/pdf
) - Error: JSON with error details
{
"status": "error",
"message": "Error description"
}
GET /api/v1/health
Returns service health status.
The service uses the following environment variables:
APP_ENV
: Application environment (default:prod
)CONVERSION_ENDPOINT
: URL of the conversion service (default:http://localhost:8181/convert
)MESSENGER_TRANSPORT_DSN
: Message transport configuration (default:sync://
)
├── src/
│ ├── Controller/ # API controllers
│ ├── Service/ # Business logic
│ └── DTO/ # Data Transfer Objects
├── config/ # Application configuration
├── docker/ # Docker configuration files
├── public/ # Web server root
└── var/ # Runtime files
└── data/ # SQLite database
MIT License