
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
pdf-ocr-cli
Advanced tools
A CLI tool for OCR processing of PDF files using Mistral API with optional LLM verification
A powerful TypeScript CLI tool that transforms scanned PDFs into searchable documents by:
Perfect for digitizing paper documents, making image-based PDFs searchable, and extracting text from scanned materials.
# Install globally
npm install -g pdf-ocr-cli
# Or use without installing
npx pdf-ocr-cli --input input.pdf --output output.pdf
Create a .env file in your working directory:
echo "MISTRAL_API_KEY=your_mistral_api_key_here" > .env
echo "TOGETHER_API_KEY=your_together_api_key_here" >> .env
Or set environment variables in your shell:
export MISTRAL_API_KEY=your_mistral_api_key_here
export TOGETHER_API_KEY=your_together_api_key_here
# Process a PDF file
pdf-ocr --input input.pdf --output output.pdf
# With verification to improve OCR quality
pdf-ocr --input input.pdf --output output.pdf --verify
# Process 3 pages at a time
pdf-ocr --input input.pdf --output output.pdf --concurrency 3
# Increase retries and timeout for unstable connections
pdf-ocr --input input.pdf --output output.pdf --retries 5 --timeout 60000
# Process one page at a time with longer pauses and verbose logging
pdf-ocr --input input.pdf --output output.pdf --concurrency 1 --sleep 10000 --verbose
| Option | Alias | Description | Default |
|---|---|---|---|
--input | -i | Input PDF file path | Required |
--output | -o | Output PDF file path | Required |
--concurrency | -c | Pages to process in parallel | 2 |
--max-pages | -m | Maximum pages to process | All |
--help | -h | Display help information | |
--version | -v | Display version information |
| Option | Alias | Description | Default |
|---|---|---|---|
--retries | -r | Maximum OCR retry attempts | 3 |
--retry-delay | -d | Delay between retries (ms) | 1000 |
--timeout | -t | OCR API request timeout (ms) | 30000 |
--sleep | -s | Time between processing pages (ms) | 5000 |
--verbose | -v | Enable detailed logging |
| Option | Description | Default |
|---|---|---|
--verify | Enable LLM verification | |
--max-tokens | Maximum tokens for verification | 1000 |
--temperature | Temperature for verification | 0.7 |
--top-p | Top-p for verification | 0.9 |
# Clone and build
git clone https://github.com/luandro/pdf-ocr.git
cd pdf-ocr
npm install
npm run build
# Set up environment
cp .env.example .env
# Edit .env with your API keys
This project follows Test-Driven Development principles:
# Run tests with coverage
npm test
# Run tests in watch mode
npm run test:watch
# Build the project
npm run build
# Run in development mode
npm run dev -- --input input.pdf --output output.pdf
The project maintains high test coverage (>80%) for quality assurance:
# Run tests with coverage
npm test
# View coverage report
open coverage/lcov-report/index.html
GitHub Actions automates testing and publishing:
The application consists of these key modules:
src/splitPdf.ts): Divides PDFs into individual pagessrc/ocr.ts): Extracts text using Mistral APIsrc/contentVerification.ts): Improves text with LLMsrc/textToPdf.ts): Converts text back to PDFsrc/mergePdfs.ts): Combines processed pagessrc/cli.ts): Provides the command interface.env file contains valid API keys--retries, --timeout, and --retry-delay--verify to improve text with LLM--concurrency and increase --sleep--max-pagesPlease see CONTRIBUTING.md for guidelines on contributing to this project.
This project is licensed under the ISC License - see the LICENSE file for details.
FAQs
A CLI tool for OCR processing of PDF files using Mistral API with optional LLM verification
We found that pdf-ocr-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.