Skip to content

ganwell/document-merge-service

 
 

Repository files navigation

Document Merge Service

Build Status Black License: GPL-3.0-or-later

A document template merge service providing an API to manage templates and merge them with given data.

Installation

Requirements

  • docker
  • docker-compose

After installing and configuring those, download docker-compose.yml and run the following command:

docker-compose up -d

You can now access the api at http://localhost:8000/api/v1/ which includes a browsable api.

Workaround LibreOffice lockup

The workaround has a setting called ISOLATE_UNOCONV, it is only enabled in the development environment. If ISOLATE_UNOCONV is enabled the container needs CAP_SYS_ADMIN. See docker-compose.override.yml.

    cap_add:
      - CAP_SYS_ADMIN
    security_opt:
      - apparmor:unconfined
    environment:
      - ISOLATE_UNOCONV=true

Getting started

Uploading templates

Upload templates using the following:

curl --form template=@docx-template.docx --form name="Test Template" --form engine=docx-template http://localhost:8000/api/v1/template/

Merging a template

After uploading successfully, you can merge a template with the following call:

curl -H "Content-Type: application/json" --data '{"data": {"test": "Test Input"}}' http://localhost:8000/api/v1/template/test-template/merge/ > output.docx

Further reading

  • Configuration - Further configuration and how to do a production setup
  • Usage - How to use the DMS and it's features
  • Contributing - Look here to see how to start with your first contribution. Contributions are welcome!

License

Code released under the GPL-3.0-or-later license.

About

Merge Document Template Service

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.1%
  • Dockerfile 1.3%
  • Makefile 0.6%