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.
mergejoins them in the alphanumeric order of their names. Name them1-report.docxand2-annex.docxto pick another order.remediatemakes the merged PDF conform to PDF/A-2b.optimizecomes 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.docxfiles in a second request, withrelationship: "Source"to keep the conformance. In the same request they wouldn't be converted, andattachcan't followremediate. - Mixed formats: LibreOffice takes spreadsheets, presentations and over a hundred other formats in the same request.