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

Does the PDF-to-Markdown CLI work offline or without an account?

Standard conversion works without an account and can continue when Nutrient is unavailable. Vision requires an API key, saved sign-in, or CLI license key. After Vision connects, it can work offline for one hour and process up to 100 pages before reconnecting.

Can the CLI OCR scanned PDFs?

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

Which platforms does the CLI support?

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.

Does the CLI create a searchable PDF?

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

Is the PDF-to-Markdown CLI free?

Standard conversion and the query command are free, and every plan includes Vision pages for scans and complex layouts. See PDF-to-Markdown pricing for Vision allowances.