Skip to content
contract.cli

Tool · Node.js

docx2pdf-cli

docx2pdf-cli v0.2.1 0 342/wk on npm Latest from npm · checked Mon, 11 May 2026

Convert Word documents to PDF, one file at a time or by the thousand. Hybrid backend strategy picks the right converter for what's installed on your machine. No silent fallbacks; missing fonts get flagged before they cost you a re-render.

TL;DR — npm i -g docx2pdf-cli, then docx2pdf input.docx output.pdf. Run --doctor first to see which backends are detected on your machine.
docx2pdf-cli — doctor + batch convert

What it does

  • Single-file or batch conversion. One file in, one file out — or point at a folder of .docx files and an output directory.
  • Parallel processing. --concurrency N runs N conversions simultaneously, useful for large batches.
  • Hybrid backends. LibreOffice, Microsoft Word (where licensed), Pandoc, and Gotenberg are all supported; the tool picks the best available unless you override with --backend.
  • Font validation. --check-fonts verifies the document's referenced fonts are present before converting, so you don't get silent substitutions in the rendered PDF.
  • Doctor probe. --doctor walks every backend candidate and reports which are usable on this machine, with explanations for the ones that aren't.
  • Honest failure. If a backend can't render a file, the tool exits non-zero and tells you why. Nothing gets quietly mangled.

Quickstart

install + run
# Install
npm i -g docx2pdf-cli
docx2pdf --version

# What backends does this machine have?
docx2pdf --doctor
docx2pdf --list-backends

# Single file
docx2pdf contract.docx contract.pdf

# Whole folder, in parallel, into a different output directory
docx2pdf --concurrency 4 --out-dir ./pdfs ./drafts/*.docx

# Pin a specific backend
docx2pdf --backend gotenberg contract.docx contract.pdf

# Check fonts before rendering
docx2pdf --check-fonts contract.docx

Why hybrid backends matter

There is no single DOCX-to-PDF converter that works perfectly everywhere. LibreOffice is the most reliable open-source option but produces slightly different output than Word. Pandoc is great for content-heavy documents but has known limitations with complex Word features. Gotenberg is a containerized service that's perfect when you need consistent output across a fleet, but requires running a server.

Rather than pretend any single backend is universally correct, this tool lets you pick. The --doctor probe makes the choice explicit; the --backend flag makes it auditable.

For agents and automation

The tool ships with an AGENTS.md guide and JSON schemas for the output format. AI agents driving a contract pipeline (review → convert → sign) can call docx2pdf-cli as the conversion step and parse structured success or failure information programmatically.

Where it fits in the workflow

The middle step in the three-CLI workflow: take the agreed .docx from nda-review-cli's finalize step and produce a PDF for sign-cli to sign. See the full workflow for the chained commands.

It's also useful on its own for any DOCX-to-PDF need — invoices, board materials, internal docs, anything. The contract pipeline is just one application.

Repo

github.com/DrBaher/docx2pdf-cli · MIT licensed · Node.js · npm-installable.

Edit this page on GitHub