The docker API allows you to run all docxtemplater modules contained in the ENTREPRISE plan, without having to configure them. The modules are already configured to good defaults and work well with each other.
The API exposes an HTTP POST
route to do the generation that takes as input the template file and the data to be used for the generation.
The API outputs the generated file.
The docker image can be used to generate documents from other languages (Java, .Net, Ruby, …), since it only requires to do one HTTP Call.
It is possible to configure your instance using the configuration.js
file which is present since version 3.9.6
This example requires you to have input.docx, data.json and it exports output.docx
#creates a new file descriptor 3 that redirects to 1 (STDOUT)
exec 3>"output.docx"
# Run curl in a separate command,
# capturing output of -w "%{http_code}" into HTTP_STATUS
# and sending the content to this command's STDOUT with -o >(cat >&3)
curl --silent \
-X POST \
-F "data=@data.json" \
-F "filecomment=This is an image file" \
-F "doc=@input.docx" \
-w "%{http_code}" \
"$host/api/v1/generate" \
-o >(cat >&3) >/tmp/httpstatus || code="$?"
Fix vulnerability CVE-2020-5219, see advisory and github issue for more detail.
subloop
filter (for xlsx module)First released version
Edgar Hipp