This repository contains a simple containerized API to convert Office documents to PDF documents using LibreOffice headless.
The image is available on Docker Hub under the name codeinchq/office2pdf.
By default, the container listens on port 3000. The port is configurable using the PORT environment variable.
All requests must by send in POST to the /convert endpoint with a multipart/form-data content type. The request must contain an Office file with the key file.
The server returns 200 if the conversion was successful and the images are available in the response body. In case of error, the server returns a 400 status code with a JSON object containing the error message (format: {error: string}).
A PHP 8 client is available at on GitHub and Packagist.
docker run -p "3000:3000" codeinchq/office2pdf curl -X POST -F "file=@/path/to/file.docx" http://localhost:3000/convert -o example.pdfA health check is available at the /health endpoint. The server returns a status code of 200 if the service is healthy, along with a JSON object:
{ "status": "up" }A PHP 8 client is available at on GitHub and Packagist.
This project is licensed under the MIT License - see the LICENSE file for details.