Skip to main content
Version: 6.x

Office

Gotenberg provides the endpoint /convert/office for Office document conversions.

It accepts POST requests with a multipart/form-data Content-Type.

Basic

You may send one or more Office documents. Following file extensions are accepted:

  • .txt
  • .rtf
  • .fodt
  • .doc
  • .docx
  • .odt
  • .xls
  • .xlsx
  • .ods
  • .ppt
  • .pptx
  • .odp

All files will be merged into a single resulting PDF.

caution

Gotenberg merges the PDF files alphabetically.

curl --request POST \
--url http://localhost:3000/convert/office \
--header 'Content-Type: multipart/form-data' \
--form files=@document.docx \
--form files=@document2.docx \
-o result.pdf

Orientation

You may also customize the resulting PDF format.

By default, it will be rendered with portrait orientation.

curl --request POST \
--url http://localhost:3000/convert/office \
--header 'Content-Type: multipart/form-data' \
--form files=@document.docx \
--form landscape=true \
-o result.pdf

Page ranges

You may specify the page ranges to convert.

The format is the same as the one from the print options of LibreOffice, e.g. 1-1 or 1-4.

caution

if more than one document, the page ranges will be applied for each document.

curl --request POST \
--url http://localhost:3000/convert/office \
--header 'Content-Type: multipart/form-data' \
--form files=@document.docx \
--form pageRanges='1-3' \
-o result.pdf