This guide covers the command-line interface (CLI) features of Docen.
Install Docen CLI globally:
# Using npm
npm install -g docen
# Using pnpm (recommended)
pnpm add -g docen
Convert between supported formats:
# Basic conversion
docen convert input.pdf output.docx
# With options
docen convert input.pdf output.docx --ocr --language eng
View available format support:
docen formats list
Manage document processors:
# List installed processors
docen processor list
# Install new processor
docen processor install pdf
# Update processor
docen processor update pdf
Process multiple files:
# Convert all PDFs in a directory
docen convert *.pdf --output-dir ./converted --format docx
# Process with pattern
docen convert "documents/*.pdf" --output-dir ./converted
Manage CLI configuration:
# Set default options
docen config set --ocr true --language eng
# View current config
docen config list
# Reset config
docen config reset
Monitor directory for changes:
# Watch directory
docen watch ./documents --output-dir ./converted
# With specific patterns
docen watch ./documents "*.pdf" --output-dir ./converted
Available for all commands:
--verbose Enable detailed output
--quiet Suppress all output
--config <path> Use custom config file
--help Show help information
Specific to conversion command:
--ocr Enable OCR processing
--language <lang> Set OCR language
--quality <level> Set output quality
--preserve-meta Keep original metadata
Configure Docen through environment:
DOCEN_CONFIG_PATH Custom config path
DOCEN_TEMP_DIR Temporary file directory
DOCEN_LOG_LEVEL Logging detail level
DOCEN_MAX_MEMORY Maximum memory usage
docen convert report.pdf report.docx --ocr --language eng
docen convert "images/*.png" --output-dir ./compressed --format jpg --quality high
docen watch ./incoming --output-dir ./processed --format pdf
Common issues and solutions:
-
Command Not Found
# Verify installation npm list -g docen # Reinstall if needed npm install -g docen
-
Conversion Errors
# Enable verbose logging docen convert input.pdf output.docx --verbose
-
Memory Issues
# Set memory limit DOCEN_MAX_MEMORY=4096 docen convert large.pdf output.docx
- Check the API Reference
- Read the Contributing Guide
- Review Core Concepts