Convert DOCX to PDF from the command line, without LibreOffice
deft doc to-pdf typesets a Word, OpenDocument or RTF file as a PDF. It needs no LibreOffice or Word: the typesetting is built into deft.
deft doc to-pdf demo.docx -o demo.pdf
Options
--page-size a4|letter|legal|a3|a5- Paper size, A4 by default.
--margin 25mm- Page margin.
--font-size 11- Body text size in points.
--font NAME- A font family installed on the machine.
-o FILE|DIR- Where to write. Without it,
letter.docxbecomesletter.pdf.
All options: deft doc to-pdf --help. Add --json for a structured result.
A real run
The released deft on a real file. This is exactly what it printed:
$ deft doc to-pdf demo.docx -o demo.pdf
ok doc.to-pdf demo.docx -> demo.pdf 6 pages 0.51s
demo.docx: Word document with tables, images, lists and footnotes (calibre demo). The file, GPL-3.0 (calibre demo document).
Limits
- It keeps the content, not the layout: headings, lists, tables and images survive; the document's fonts, columns and colours do not. For a PDF that looks exactly like the Word file, use Word or LibreOffice. The command is marked beta.
- It reads .docx, .odt and .rtf. Old binary .doc files are not read; save them as .docx first.
- Checked without LibreOffice: the example below also ran in a fresh Alpine Linux container with no LibreOffice installed, and deft's source never calls it.
What it saves an AI agent
Every task in the deft benchmark that uses this command, run by Claude Code (Opus 5.5, medium effort) once without deft and once with deft and its skill installed. The prompt never mentions deft. Each cell reads without → with deft; click a task for the agent's full trace. On 1 of the 5 tasks deft used more tokens: on a short job the agent reads deft's help first.
| Task | Solved | Time | New tokens | Failed commands |
|---|---|---|---|---|
| Fill a party name into a contract and send itFill in our company name in the SAFE form safe.docx. We are Acme Robotics, Inc. Put it everywhere the form asks for the company name, in capitals where the form uses capitals, and keep the formatting. Save it as acme-safe.docx and make acme-safe.pdf to send to the investor. | no → yes | 40 s → 87 s | 20.8k → 34.1k | 0 → 2 |
| Resume for a job portal and a websiteI'm applying for jobs. The portal wants a PDF, so make resume.pdf from my resume.docx. I also want a Markdown copy, resume.md, for my personal site. | no → yes | 78 s → 22 s | 25.5k → 12.5k | 4 → 0 |
| RTF report to PDF with its word countreview.rtf is going into the board pack. Make review.pdf from it, and check it is under the 4,000-word limit: write its word count to words.txt. | yes → yes | 85 s → 63 s | 25.2k → 20.8k | 5 → 1 |
| Word to PDFConvert demo.docx to demo.pdf. | yes → yes | 59 s → 9 s | 19.3k → 9.5k | 3 → 0 |
| Assemble an application from mixed filesPut together one application.pdf for a portal: letter.docx first, then the photo DSCN0010.jpg, then fw9.pdf. Number the pages at the bottom. The portal rejects anything over 1MB. | yes → yes | 95 s → 29 s | 30.3k → 14.6k | 1 → 0 |
| All 5 tasks | 3 → 5 | 357 s → 211 s | 121.2k → 91.5k | 13 → 3 |
One run per task and arm, on 2026-11-15. Deft was improved against these same tasks, so this is a development benchmark, not a held-out test. New tokens are input not served from the prompt cache, plus output. Failed commands are the agent's tool calls that returned an error: shell commands, and file reads and writes. All tasks: the benchmark.
Install
curl -fsSL https://deftcli.com/install.sh | sh
Or brew install firstprayer/tap/deft. One binary for macOS and Linux;
the script also sets up the skill for Claude Code and Codex. Install guide.