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
-
Start the container:
docker run --rm -p 3000:3000 philiplehmann/office-pdf
-
Post a document, get a PDF back:
curl --data-binary @report.docx -o report.pdf http://localhost:3000/v1/convert
-
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
| Before | office-pdf |
|---|---|
unoserver POST /convert, /direct, /direct-fs | POST /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/readiness | unchanged |
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
Office document to PDF: throughput with 8 parallel requests
PDF tools: median latency
Container footprint
| office-pdf | unoserver, LibreOffice running | unoserver, per file | |
|---|---|---|---|
| Image download (compressed, amd64) | 97 MB | 713 MB | 713 MB |
| Image on disk | 351 MiB | 2,551 MiB | 2,551 MiB |
| Start to ready | 0.1 s | 7.3 s | 0.2 s |
| Memory when idle | 11 MiB | 352 MiB | 15 MiB |
| Memory 15 s after the load | 63 MiB | n/a (crashed) | 30 MiB |
| Peak memory, Word documents | 20–81 MiB | 585 MiB | 632–703 MiB |
| Peak memory, presentation | 607 MiB | 653 MiB | 578 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
PageRangerenders 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.