Sign inSign up

codeinchq/office2pdf

By codeinchq

Updated almost 2 years ago

Containerized REST API for the conversion of Office files to PDF using LibreOffice

Image
0

2.8K

codeinchq/office2pdf repository overview

Office2Pdf

Code Inc. Docker Image CI Docker Image Version

This repository contains a simple containerized API to convert Office documents to PDF documents using LibreOffice headless.

The code source is available on GitHub.

Configuration

By default, the container listens on port 3000. The port is configurable using the PORT environment variable.

Usage

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}).

Example
Step 1: run the container using Docker
docker run -p "3000:3000" codeinchq/office2pdf 
Step 2: convert an Office file to PDF
curl -X POST -F "file=@/path/to/file.docx" http://localhost:3000/convert -o example.pdf
Health check

A 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" }

Client

A PHP 8 client is available at on GitHub and Packagist.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Tag summary

Content type

Image

Digest

sha256:dba59a2c9

Size

398.1 MB

Last updated

almost 2 years ago

docker pull codeinchq/office2pdf