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.5.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23766ad4d9a3cb99c129ac9f360c1c74358cb1fd6ed5f99774ecfe6a6edbdf68 |
|
MD5 | 40c00e7788be08cd0b9b628c7bbb0408 |
|
BLAKE2b-256 | fe2343740445e9aa63acbe2d596567f8fe27ff79328471777db6723ee0f9f999 |
Hashes for document_merge_service-6.5.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fdef1d1d7bcc91616b3a3c2c93c44b3eb32791e0ddf8d24ba63b37ce5bd82ae |
|
MD5 | e2ae13244efb41da8cc2a5d290efbb1d |
|
BLAKE2b-256 | 64a34ca7cc26cb2d7001e967222c10f27a1384c4e3a17daae4003c38b76f0325 |