All posts

PPTX to PDF via CLI

Headless LibreOffice Impress converts PowerPoint to PDF.

Open online converter

Packages to install

Install libreoffice-impress-nogui and fonts-liberation so slides render predictably.

libreoffice-impress-nogui
fonts-liberation
apt install
sudo apt-get update
sudo apt-get install -y libreoffice-impress-nogui fonts-liberation

How to run the command

soffice --headless --convert-to pdf --outdir . slides.pptx. The same command works for .ppt. On a server, set a private profile with -env:UserInstallation so parallel runs do not clash.

soffice
soffice --headless --nologo --nofirststartwizard --norestore --convert-to pdf --outdir . slides.pptx

Dockerfile example

Build a minimal Ubuntu image with the required packages and run the conversion inside the container.

Dockerfile
FROM ubuntu:24.04

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        libreoffice-impress-nogui \
        fonts-liberation && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /work
docker build && docker run
docker build -t pptx-to-pdf .
docker run --rm -v "$PWD:/work" -w /work pptx-to-pdf \
  soffice --headless --nologo --nofirststartwizard --norestore --convert-to pdf --outdir . slides.pptx

Example commands

Run these locally after installing the packages, or inside the container from the Dockerfile.

Example 1
soffice --headless --nologo --nofirststartwizard --norestore --convert-to pdf --outdir . slides.pptx
Example 2
soffice -env:UserInstallation=file:///tmp/lo-profile --headless --convert-to pdf --outdir /tmp deck.ppt