Skip to content

Instantly share code, notes, and snippets.

@revolunet
Last active May 8, 2020 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save revolunet/3303f60e394f92575056adff0af03021 to your computer and use it in GitHub Desktop.
Save revolunet/3303f60e394f92575056adff0af03021 to your computer and use it in GitHub Desktop.
Convert Docx to ODT using docker + converter-service

Using https://gitlab.com/zaaksysteem/converter-service

# Build and run converter server
docker run --rm -p 5032:5032 converter
 
# Magic oneliner for input.docx -> output.odt
jq -n --arg content `cat input.docx | base64` \
  '{ "to_type": "application/vnd.oasis.opendocument.text", "content": $content }' \
  | curl -X POST -H "Content-Type: application/json" -d @- http://127.0.0.1:5032/v1/convert \
  | jq -r '.content' \
  | base64 -D > output.odt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment