Skip to main content
Version: 9.x

Archive office documents as one PDF/A

You have a few Word documents that belong together. You want one small PDF/A to archive, in a single request.

Request​

curl \
--request POST http://localhost:3000/forms/libreoffice/convert \
--form files=@report.docx \
--form files=@annex.docx \
--form 'stages=[
{ "op": "merge" },
{ "op": "remediate", "profile": "PDF/A-2b" },
{ "op": "optimize" }
]' \
-o archive.pdf
Response
HTTP/1.1 200 OK
Content-Type: application/pdf
Gotenberg-Remediation-Residual: 0
Gotenberg-Remediation-Rolled-Back: 0

Result​

One PDF/A-2b of four pages: the annex, then the report.

How it works​

  • LibreOffice converts each document, then the stages run on the PDFs in order: see Convert office documents.
  • merge joins them in the alphanumeric order of their names. Name them 1-report.docx and 2-annex.docx to pick another order.
  • remediate makes the merged PDF conform to PDF/A-2b.
  • optimize comes after: it shrinks the file and keeps it conformant.

Variations​

  • One PDF/A per document: drop merge, and the answer is a ZIP.
  • Keep the sources with the archive: make it PDF/A-3b, then attach the .docx files in a second request, with relationship: "Source" to keep the conformance. In the same request they wouldn't be converted, and attach can't follow remediate.
  • Mixed formats: LibreOffice takes spreadsheets, presentations and over a hundred other formats in the same request.