Skip to main content

Merge Document Template Service

Project description

Document Merge Service

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

document_merge_service-9.0.0.tar.gz (744.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

document_merge_service-9.0.0-py3-none-any.whl (768.4 kB view details)

Uploaded Python 3

File details

Details for the file document_merge_service-9.0.0.tar.gz.

File metadata

  • Download URL: document_merge_service-9.0.0.tar.gz
  • Upload date:
  • Size: 744.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for document_merge_service-9.0.0.tar.gz
Algorithm Hash digest
SHA256 0072afb5845a665348272d078e8ae78af9e9a090793f0392154dc7121c1a398e
MD5 c1590077a8689354bdc26f507d6e0598
BLAKE2b-256 7ba157dedd66c195d66ed4211fe921055a3876dfd84e34a381a29d6d20966ddc

See more details on using hashes here.

File details

Details for the file document_merge_service-9.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for document_merge_service-9.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9380ebb1b33aff13628d5273abfbf4a29874190773701eee46243f5f4d71fd9e
MD5 8f9b985b27feafadd85badb6e89b62f7
BLAKE2b-256 85c79cb4678626a6a74e2bd66aa82929dfcc385135d86167468f46d960688643

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page