Convert a folder of documents
You have a folder of Word documents. You want a PDF of each, in one request.
Request
Zip the folder, and upload the ZIP under archives:
curl \
--request POST http://localhost:3000/forms/libreoffice/convert \
--form archives=@documents.zip \
-o documents.zip
Result
A ZIP of annex.docx.pdf and report.docx.pdf.
How it works
- Gotenberg unpacks
archivesas if you had uploaded each entry: see How requests work. - LibreOffice converts each document to a PDF named after it, and several PDFs come back in a ZIP: see Convert office documents.
Variations
- One PDF: add
stages: [{"op": "merge"}]. - Large folders: LibreOffice converts one document at a time, and the request must finish within
--api-timeout. Split the folder across requests, and containers: see Run in production. - No waiting: add the webhook headers, and Gotenberg uploads the ZIP when it's done.
- Files on a server: list them in
downloadFrominstead of uploading.