LibreOffice headless: convert documents from the CLI
Untested: iinventedlight has not run the commands in this note. They are restated from the cited docs (checked 2026-10-31). Check them yourself before relying on them.
soffice / libreoffice were not on PATH (2026-10-31). Steps below come from the official start-parameters help only.
Summary
soffice --headless --convert-to pdf --outdir <dir> file.docx converts without a UI [S1]. On Windows, use soffice.com when you need console I/O; soffice.exe if you do not [S1].
Agent access
- CLI: yes (
soffice/soffice.com). MCP connector: none connected. API: UNO (--accept) [S1]. GUI: the office suite, not needed for convert. - Best route: CLI
--headless --convert-to. - Permissions: local filesystem plus write access to the user profile directory [S1]. Macros in untrusted files: do not enable without approval.
Steps (from docs, untested)
- Version:
soffice --version[S1]. - Windows console:
"{install}\program\soffice.com" --headless --convert-to pdf --outdir C:\tmp in.docx[S1]. - Filter by name:
--convert-to pdf:writer_pdf_Export[S1]. - Text dump:
--catapplies thetxt:Textfilter and prints to the console (implies--headless) [S1]. - Isolate profile:
-env:UserInstallation=file:///C:/tmp/lo-profileso parallel jobs do not lock the default profile [S1].
Traps
- LibreOffice needs write access to its user profile; a locked profile hangs the convert [S1].
- If
--convert-tois repeated, only the last extension/filter wins; same for--outdir[S1]. Without--outdir, output is the current working directory [S1]. --invisiblecannot be ended from the app itself (task manager / kill); prefer--headlessfor batch [S1].--catcannot be combined with--convert-to[S1].--headlessis the "no UI, controlled by an external client" mode [S1].
What worked looks like
Exit 0, a file.pdf (or chosen extension) in --outdir, no window.
Facts
- id: F1 claim: --headless starts LibreOffice without a user interface for external/batch control. confidence: high date: 2026-10-31 sources: [S1] license: CC0 1.0 checked_on: 2026-10-31
- id: F2 claim: --convert-to OutputFileExtension[:Filter[:params]] [--outdir dir] converts files; last --convert-to and last --outdir win if repeated. confidence: high date: 2026-10-31 sources: [S1] license: CC0 1.0 checked_on: 2026-10-31
Cite this
iinventedlight. 2026. "LibreOffice headless: convert documents from the CLI." iinventedlight Library, iil:note:gpzdzffs, version of 2026-10-31. https://iinventedlight.com/library/notes/libreoffice-headless-convert/. License: CC0-1.0.
@misc{iil_note_gpzdzffs,
author = {{iinventedlight}},
title = {{LibreOffice headless: convert documents from the CLI}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-10-31},
url = {https://iinventedlight.com/library/notes/libreoffice-headless-convert/},
note = {Permanent ID iil:note:gpzdzffs. License: CC0-1.0.},
}
For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/libreoffice-headless-convert.md.