Skip to content

CLI

CamScanner CLI is a command-line tool for document processing. It is designed for local terminals, project scripts, test jobs, and automated workflows that need explicit control of inputs, parameters, outputs, and cloud-saving behavior.

When to use it

  • Quickly verify document capabilities in development or testing.
  • Encode fixed processing steps in scripts or project commands.
  • Batch-convert, merge, and organize local documents.
  • Control output formats, paths, and cloud-saving behavior explicitly.

Prerequisites

  • A Node.js environment that can install npm packages.
  • macOS, Linux, or Windows on x64 or arm64.
  • A browser available for CamScanner OAuth sign-in on first use.
  • Ownership of, or permission to process, every input file.

Installation choice

For projects, install locally and use npx so the project can pin a version. Install globally when the command must be available across directories.

Quick setup

Ask an agent to install it

text
Set up CamScanner CLI in this environment using npm install camscanner-cli. First identify the package manager and decide whether a local or global installation is appropriate. Explain which files will change, preserve existing lockfiles, then install and verify with an available help or version command. Tell me how to invoke it afterward.

Install in the current project

bash
npm install camscanner-cli
npx camscanner-cli --version

The package selects a native binary for the current OS and CPU. Do not use --omit=optional, because platform binaries are distributed as optional dependencies.

Install globally

bash
npm install -g camscanner-cli
camscanner-cli --version

Commands below use camscanner-cli; prefix them with npx for a local installation.

Sign in

bash
camscanner-cli auth status
camscanner-cli auth login

The login command opens a browser and waits in the foreground for authorization. Verify with auth status afterward. To sign out:

bash
camscanner-cli auth logout

Command structure

bash
camscanner-cli <group> <command> [file...] [flags]
GroupPurpose
imageScan and image enhancement, OCR, conversion, translation, detection, editing, and multi-image merging
pdfPDF conversion, page rendering, and watermarks
txtText conversion
docCloud document search, download, movement, and folder queries
authSign-in status and authorization
bash
camscanner-cli --help
camscanner-cli image --help
camscanner-cli pdf --help

Common commands

Image OCR

bash
camscanner-cli image ocr document.jpg
camscanner-cli image ocr document.jpg > result.txt

Image to Word or Excel

bash
camscanner-cli image convert document.jpg --format word -o result.docx
camscanner-cli image convert table.png --format excel -o result.xlsx

PDF to Word or Markdown

bash
camscanner-cli pdf convert report.pdf --format word -o report.docx
camscanner-cli pdf convert paper.pdf --format md -o paper.md

Remove scan shadows

bash
camscanner-cli image enhance scan.jpg --mode 5 -o enhanced.jpg

Merge images into PDF

bash
camscanner-cli image merge-pdf "page1.jpg" "page2.jpg" "page3.jpg" -o merged.pdf

List files explicitly and confirm the order. A run accepts up to 100 images; avoid unordered *.jpg wildcards.

Translate an image

bash
camscanner-cli image translate menu.jpg --lang en -o menu-en.jpg

Recognize an invoice or receipt

bash
camscanner-cli image receipt invoice.jpg

Search cloud documents

bash
camscanner-cli doc search "contract"

Show search results and confirm the target before downloading or moving a document.

Local and cloud output

OptionBehavior
-o, --output <path>Save to a specified local path
-s, --saveSave to CamScanner cloud
--save-title <title>Set the cloud document title
--save-dir <name>Select a cloud folder by name
--save-dir-id <id>Select a cloud folder by ID

Local and cloud output can be combined:

bash
camscanner-cli pdf convert contract.pdf \
  --format word \
  -o contract.docx \
  -s \
  --save-title "Purchase contract-editable"

With only -s, the result is saved only to the cloud; with only -o, it is saved only locally. Not every output type supports -s; check the command's --help.

Existing files

An -o path may overwrite an existing file. Check the path first or generate a non-conflicting filename.

Use in scripts

The CLI reports success through exit codes and can be used in Shell or CI workflows. Specify input and output paths explicitly and retain error output for diagnosis.

The first run requires browser OAuth. For unattended environments, authorize securely beforehand; never commit credentials, access tokens, or authentication directories. The public setup flow does not support plaintext tokens in documentation or configuration.

Update and uninstall

Project installation:

bash
npm update camscanner-cli
npm uninstall camscanner-cli

Global installation:

bash
npm install -g camscanner-cli@latest
npm uninstall -g camscanner-cli

After updating, run camscanner-cli --version. If both local and global copies exist, compare npx camscanner-cli --version with camscanner-cli --version.

Troubleshooting

Installed but command not found

Use npx camscanner-cli for a local installation. For a global installation, ensure npm's global binary directory is in PATH.

Missing binary for this platform

Confirm the OS and architecture and reinstall without omitting optional dependencies.

Login keeps waiting

auth login waits for browser authorization. Complete sign-in in the browser; if the page does not open, check the default browser and network.

File processing fails

Run the command's --help, then verify the format, size, and file integrity. Do not repeatedly retry an invalid parameter.

Cloud result was saved to the root directory

When a folder specified by --save-dir is not found, the CLI may fall back to root and print a warning. Run camscanner-cli doc dirs or use an explicit --save-dir-id.

Limits and security

  • A single upload should not exceed 40 MB.
  • Image input supports JPG, JPEG, and PNG; document input supports PDF, TXT, and Markdown.
  • PDF watermark operations support up to 100 pages; password-protected PDFs are unsupported.
  • Inputs are uploaded to CamScanner servers; -s saves results to the signed-in account.
  • Never expose or commit sign-in tokens.
  • Confirm the scope, page order, and output path before batch, overwrite, download, or move operations.

Next steps

  • See Skill for natural-language capability selection and command composition.
  • See MCP for a standard agent, AI IDE, or workflow connection.
  • See Supported capabilities for the documented capability scope.