Conversion API

Collabora Online allows you to convert between various file formats easily. To do so, all you need to do is to HTTP POST the content of the file to the specific endpoint.

API: HTTP POST to /cool/convert-to/<format>

  • the format is e.g. png, pdf or txt

  • the file itself in the payload.

Example:

curl -F "data=@test.txt" https://localhost:9980/cool/convert-to/docx > out.docx
  • or in HTML:

1<form action="https://localhost:9980/cool/convert-to/docx" enctype="multipart/form-data" method="post">
2 File: <input type="file" name="data"><br/>
3 <input type="submit" value="Convert to DOCX">
4</form>

Alternatively you can omit the <format>, and instead provide it as another parameter.

Example:

curl -F "data=@test.odt" -F "format=pdf" https://localhost:9980/cool/convert-to > out.pdf
  • or in HTML:

1<form action="https://localhost:9980/cool/convert-to" enctype="multipart/form-data" method="post">
2 File: <input type="file" name="data"><br/>
3 Format: <input type="text" name="format"><br/>
4 <input type="submit" value="Convert">
5</form>

Note: the convert-to endpoint is restricted to allowed host addresses that can be set in the /etc/coolwsd/coolwsd.xml configuration file. The IP addresses have to be added as dot-escaped net.post_allow.host entries.