Convert to PDF/A via LibreOffice Command Line

This guide explains how to convert office documents to ISO-compliant PDF/A archival formats using the LibreOffice command-line interface. It covers the required headless parameters, the JSON-based filter options for LibreOffice, and the exact profile values needed to output PDF/A-1b, PDF/A-2b, and PDF/A-3b files without launching the graphical user interface.

Command-Line Syntax

LibreOffice uses the --headless and --convert-to flags to process files in batch or terminal environments. To apply a specific PDF/A profile, you must append an export filter configuration to the pdf format string.

The basic command structure is:

soffice --headless --convert-to 'pdf:writer_pdf_Export:{"SelectPdfVersion":{"type":"long","value":"<PROFILE_NUMBER>"}}' input.docx

Note: On some systems, soffice may be invoked as libreoffice.

PDF/A Profile Values

The SelectPdfVersion property accepts an integer corresponding to standard PDF and PDF/A versions:

Practical Examples

Convert to PDF/A-1b

libreoffice --headless --convert-to 'pdf:writer_pdf_Export:{"SelectPdfVersion":{"type":"long","value":"1"}}' document.docx

Convert to PDF/A-2b

libreoffice --headless --convert-to 'pdf:writer_pdf_Export:{"SelectPdfVersion":{"type":"long","value":"2"}}' presentation.pptx

Convert to PDF/A-3b

libreoffice --headless --convert-to 'pdf:writer_pdf_Export:{"SelectPdfVersion":{"type":"long","value":"3"}}' spreadsheet.xlsx

Batch Processing and Output Directory

You can specify an alternate output directory using the --outdir parameter:

libreoffice --headless --convert-to 'pdf:writer_pdf_Export:{"SelectPdfVersion":{"type":"long","value":"1"}}' *.docx --outdir ./pdfa_output/

This processes all matching documents in the current directory and places the validated PDF/A files into the ./pdfa_output/ folder.