Convert and OCR PDFs from the terminal with Nutrient CLI

Install the CLI, convert PDFs to Markdown or text on your computer, and add Vision OCR for scans, handwriting, and complex layouts.

Three steps

Convert a PDF from your command line

Start with local standard conversion. Add Vision for scans, handwriting, formulas, or complex layouts.

Install the CLI

Install the package from npm, or use the shell installer in the guide.


Convert to Markdown

Run pdf-to-markdown INPUT [OUTPUT]. Standard conversion works without an account.


Add Vision for scans

Add --vision for scans, handwriting, formulas, and complex layouts. Use an API key, saved sign-in, or CLI license key.

Terminal example

Install, convert, OCR, and search

Install the package once. Then choose standard conversion or Vision and search the extracted Markdown from the same terminal.

Shell
npm install -g @pspdfkit/pdf-to-markdown
pdf-to-markdown input.pdf output.md
pdf-to-markdown --vision scan.pdf scan.md
query text output.md "invoice total"

Commands

Convert, search, and manage sign-in

pdf-to-markdown INPUT [OUTPUT] converts a PDF or directory to Markdown. pdf-to-text INPUT [OUTPUT] creates text. query text INPUT QUERY searches an extracted file and is free. Use nutrient auth login, status, and logout to manage sign-in.

Options

Choose Vision and processing settings

--vision improves extraction for scans, handwriting, and complex layouts. --provider auto|cpu|gpu selects Vision processing. --threads sets parallel file conversions. --api-key and --license-key provide credentials. In CI, set NUTRIENT_API_KEY instead of passing the key as an argument. --enable-image-export saves extracted images beside the Markdown output.


Who it’s for

Local document conversion for terminal workflows

Use the CLI from a terminal, a script, or CI. Agents can read its Markdown output. Use --threads to convert folders in parallel. Choose the PDF-to-Markdown API for application integration. See OCR PDFs in Linux for a related command-line workflow.

Frequently asked questions

Standard conversion works without an account. It also works offline unless you use an API key. Vision requires a live API key, a saved sign-in, or a CLI license key. With a sign-in or API key, Vision works offline for up to an hour after the CLI last checked in with Nutrient. Offline, Vision starts a document only if your remaining Vision pages cover it and fewer than 100 Vision pages are waiting to be reported. With a CLI license key, the CLI never contacts Nutrient for licensing or usage reporting. The first Vision conversion still downloads about 1 GB of models, so it requires a connection.

Yes. Add --vision to improve extraction for scans, handwriting, formulas, and complex layouts.

The CLI supports macOS 13 or newer on Apple Silicon, Linux with glibc 2.38 or newer, and Windows. Windows users run shell commands in Git Bash. Minimal Ubuntu 24.04 images also need libcurl4t64, libicu74, and ca-certificates.

No. The CLI creates Markdown or text. Use the PDF OCR API when you need a searchable PDF.

Standard conversion and the query command are free. Vision, for scans and complex layouts, is priced per page in US dollars and paid from your plan’s monthly usage. See API pricing.