office-pdf · Docker image · Open source

Office documents to PDF in milliseconds, without LibreOffice.

office-pdf is a single Rust HTTP server that turns Word, PowerPoint and Excel documents into PDF and images, and does the PDF work of poppler and pdftk on top. One 97 MB image instead of three, the same API as the unoserver image.

Word document to PDF
2 ms
LibreOffice: 108 ms running, 596 ms per file
Image download
97 MB
unoserver + pdftk + poppler: 957 MB
Memory when idle
11 MiB
unoserver with LibreOffice running: 352 MiB
Start to ready
0.1 s
unoserver with LibreOffice running: 7.3 s

What office-pdf does

Documents are laid out by ArtCraft's clean-room Rust office engines, linked into the binary. There is no LibreOffice, JVM, poppler, Python or Node runtime in the image: one process, conversions run in-process and in parallel.

Word & text

docx, docm, dotx, dotm, doc, dot, odt, ott, rtf, html, md, txt, xml to PDF, PNG, JPEG or WebP. Optional tracked changes and comments.

Presentations

pptx, pptm, potx, ppsx, ppt, pps to PDF or a slide as an image. PageRange picks slides.

Spreadsheets

xlsx, xlsm, xltx, xls, xlsb, ods, csv, tsv to PDF.

PDF tools

Text and HTML extraction, page images, compress, encrypt, decrypt, form fields and filling, split, merge, rotate, stamp, background.

Drop-in for unoserver

Same endpoints and query parameters under /v1: /convert, /direct, /direct-fs, /processes. OpenAPI document at /v1/openapi.json.

Safe defaults

Bounded concurrency, request timeouts, size limits, non-root user, and strict=true to refuse output with missing glyphs or pictures.

Alpha layout engines. Fidelity is good for typical business documents but not yet on par with LibreOffice for complex layouts. Compare the output on your own documents, and keep the unoserver image for the cases it doesn't cover yet.

Quick start

  1. Start the container:

    docker run --rm -p 3000:3000 philiplehmann/office-pdf
  2. Post a document, get a PDF back:

    curl --data-binary @report.docx -o report.pdf http://localhost:3000/v1/convert
  3. Or an image of slide 2, or the text of a PDF:

    curl --data-binary @slides.pptx -o slide2.png \
      'http://localhost:3000/v1/convert?outputFilter=impress_png_Export&filterOptions=PageRange%3D2'
    curl --data-binary @report.pdf http://localhost:3000/v1/pdf-to-text

Moving from the unoserver, poppler and pdftk images

Beforeoffice-pdf
unoserver POST /convert, /direct, /direct-fsPOST /v1/convert, /v1/direct, /v1/direct-fs
unoserver /processes/v1/processes
poppler-server /pdf-to-text, /pdf-to-html/v1/pdf-to-text, /v1/pdf-to-html
pdftk /compress, /encrypt, /data/fields, /form/fill, …the same paths under /v1
/health/liveness, /health/readinessunchanged

The full API, configuration and the differences from pdftk and poppler are in the office-pdf README.

Benchmark

office-pdf against the unoserver image in both of its modes: with LibreOffice already running (/convert, one long-lived soffice) and with LibreOffice started for every file (/direct). The PDF tools are compared with the poppler-server and pdftk images. Shorter bars are better for latency, longer bars for throughput. Hover a bar for details.

Office document to PDF: median latency

One request at a time, 20 requests per file, milliseconds (lower is better)

Office document to PDF: throughput with 8 parallel requests

40 requests, 8 in flight, requests per second (higher is better)

PDF tools: median latency

One request at a time, 20 requests per operation, milliseconds (lower is better)

Container footprint

office-pdfunoserver, LibreOffice runningunoserver, per file
Image download (compressed, amd64)97 MB713 MB713 MB
Image on disk351 MiB2,551 MiB2,551 MiB
Start to ready0.1 s7.3 s0.2 s
Memory when idle11 MiB352 MiB15 MiB
Memory 15 s after the load63 MiBn/a (crashed)30 MiB
Peak memory, Word documents20–81 MiB585 MiB632–703 MiB
Peak memory, presentation607 MiB653 MiB578 MiB

What the numbers say

  • Word documents are 51× faster than a running LibreOffice and 91–280× faster than starting it per file, and they scale with the cores: about 2,900 docx and 595 doc conversions per second on 4 CPUs.
  • Presentations are closer: 1.3× faster than a running LibreOffice and 4.4× faster than starting it per file. They are the most memory-hungry case for office-pdf: each slide is rendered as an image, about 130 MB per deck in flight. The memory goes back to the system once the server is idle (63 MiB 15 s after the load), and a PageRange renders only the slides it selects.
  • A running LibreOffice converts one document at a time, so parallel requests queue: throughput stops at about 16 docx per second. Starting it per file runs in parallel but costs ~0.6 s and up to 700 MiB per conversion.
  • PDF tools are 6–80× faster than the poppler and pdftk images, which start a process (and for pdftk, a JVM) per request.
  • Page counts match LibreOffice for every test file; the presentation PDF is larger (275 KiB against 20 KiB).

How it was measured

office-pdf built from this repository on 1 December 2026, with its allocator tuning and slide-range rendering; the unoserver (LibreOffice 26.8.3), poppler-server and pdftk images were the :latest ones from Docker Hub that day. On an Apple silicon Mac (arm64), each container limited to 4 CPUs and 4 GB of memory. Every case had two warm-up requests, 20 requests one at a time, then 40 requests at 1, 4 and 8 in flight; memory was sampled throughout and once more 15 s after the last request. Every response was checked to be a 200 with a PDF body. The test files are the fixtures of the repository's test suites: a 1-page docx, a 10-slide pptx, a 7-page legacy Word .doc and 13 KB–1.1 MB PDFs. They are small, so real documents take longer; the ratios between the images are the point. The scripts and raw results are in docs/benchmark.

All images

Every image is built from this repository for linux/amd64 and linux/arm64, published to Docker Hub as philiplehmann/<name>, runs as a non-root user and has a health check. Sizes are the compressed download.