Merge Document Template Service
Project description
Document Merge Service
A document template merge service providing an API to manage templates and merge them with given data. It can also be used to convert Docx files to PDF.
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
Converting a template
To convert a standalone Docx file the following call can be used:
curl -X POST --form file=@my-test-file.docx --form target_format="pdf" http://localhost:8000/api/v1/convert > example.pdf
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for document_merge_service-6.4.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33f30d4300ceb02ad768b141f0f30941b6a3af324be305537e5a13a715219ee9 |
|
MD5 | 079c021c1baf5cf8887c6a3e3d3ce3c4 |
|
BLAKE2b-256 | 77189f2d923ae3c9ab9fdf5286904f9f0c6041a25074165715a4efc3e7a13ffe |
Hashes for document_merge_service-6.4.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ac582833857a8b22c3356ca015ada388dfa6fcbb44348542d16e62349fa5956 |
|
MD5 | 6b58bb0d031ffb037183151bdf1f2f73 |
|
BLAKE2b-256 | 51adb3b34f95b34f3db2b6c4c542cb701e7f161a203e65509b1fe6bcc261c3c3 |