A standalone Node.js server that turns Chinese invoice PDFs into structured CSV data — combining OCR, QR decoding, and an Ollama vision model in one seamless pipeline.
What is XteVision Invoice Extractor and who is it for?
XteVision Invoice Extractor is a standalone Node.js server for extracting structured data from Chinese invoice PDFs and saving the results to CSV files. This version runs independently — without ComfyUI — so it can be deployed on any machine with Node.js and, optionally, an Ollama vision model.
qwen2.5vl:latest) for intelligent field extractionData flow from PDF invoice to CSV output
┌─────────────────────────────────────────────────────────────┐ │ XteVision Invoice Extractor │ ├─────────────────────────────────────────────────────────────┤ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │ │ PDF │──▶│ QR │──▶│ Ollama │──▶│ CSV │ │ │ │Processor │ │ Decoder │ │Extractor │ │ Writer │ │ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │ │ │ │ │ │ │ │ ▼ ▼ ▼ ▼ │ │ ┌──────────────────────────────────────────────────────┐ │ │ │ Invoice Data Merger │ │ │ │ (QR data = Ground Truth for amounts & numbers) │ │ │ └──────────────────────────────────────────────────────┘ │ └─────────────────────────────────────────────────────────────┘
The server is designed for self-hosted, standalone operation:
OLLAMA_URL)What the standalone version can do
Convert PDF invoices to high-resolution images and extract text with Tesseract OCR (Chinese + English).
Read the Chinese tax-authority QR code, which is treated as ground truth for amounts and invoice numbers.
An Ollama vision model extracts structured fields such as company name, tax rate, and product description.
Writes UTF-8 BOM CSV files with full Chinese character support and Excel compatibility.
Drag-and-drop interface for single invoices or folder-based batch processing.
Process an entire folder of invoices in a single request and merge results into one CSV.
Software and system packages you need before installing
qwen2.5vl:latest)# Install Homebrew packages
brew install tesseract tesseract-lang poppler
# Install Chinese language data
brew install tesseract-lang
# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
# Pull a vision model
ollama pull qwen2.5vl:latest
# Install system packages
sudo apt-get update
sudo apt-get install -y tesseract-ocr tesseract-ocr-chi-sim poppler-utils
# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
# Pull a vision model
ollama pull qwen2.5vl:latest
# Install via Chocolatey
choco install tesseract poppler
# Or download from:
# Tesseract: https://github.com/UB-Mannheim/tesseract/wiki
# Poppler: https://blog.alivate.com.au/poppler-windows/
# Install Ollama from https://ollama.com
ollama pull qwen2.5vl:latest
Get the server running on your machine
# Navigate to the project directory
cd XteVision-standalone
# Install dependencies
npm install
# Copy environment configuration
cp .env.example .env
# Edit .env to match your setup
# Especially OLLAMA_URL if Ollama is running on a different host
# Start the server
npm start
# Or with auto-reload for development
npm run dev
The server will start at http://localhost:3000.
OLLAMA_URL and that the chosen vision model is installed.Runtime settings in the .env file
Edit the .env file to match your deployment. The following keys are supported:
| Key | Default | Description |
|---|---|---|
| PORT | 3000 | HTTP server port |
| UPLOAD_DIR | ./uploads | Directory for uploaded invoices |
| OUTPUT_DIR | ./output | Directory for generated CSV files |
| OLLAMA_URL | http://localhost:11434 | Base URL of the Ollama service |
| OLLAMA_MODEL | qwen2.5vl:latest | Vision model used for extraction |
| DPI | 300 | Resolution for PDF-to-image rendering |
| MAX_FILE_SIZE | 52428800 | Maximum upload size in bytes (50 MB) |
API routes and their purpose
| Endpoint | Method | Purpose |
|---|---|---|
| /api/health | GET | Health check |
| /api/models | GET | List available Ollama models |
| /api/process | POST | Process a single invoice file |
| /api/process-folder | POST | Process a folder of invoices |
| /api/files | GET | List output CSV files |
| /api/download/:filename | GET | Download a CSV file |
Process a single invoice:
curl -X POST http://localhost:3000/api/process \
-F "invoice=@/path/to/invoice.pdf" \
-F "model=qwen2.5vl:latest" \
-F "filenamePrefix=invoice_data"
Process a folder of invoices:
curl -X POST http://localhost:3000/api/process-folder \
-H "Content-Type: application/json" \
-d '{
"folderPath": "/path/to/invoices",
"model": "qwen2.5vl:latest",
"filenamePrefix": "batch_invoices"
}'
The extraction pipeline from image to CSV
| Column | Description |
|---|---|
| 流水号 | Serial number |
| 月份 | Month |
| 收票日期 | Invoice date (YYYY-MM-DD) |
| 公司名称 | Company name (seller) |
| 产品内容 | Product/service description |
| 未税金额 | Amount before tax |
| 税额 | Tax amount |
| 金额合计 | Total amount |
| 增值税 (%) | Tax rate percentage |
| 附件数 | Number of attachments |
| 发票号码 | Invoice number |
| 经办人 | Handler |
| 状态 | Status |
| 付款日期 | Payment date |
| 备注 | Remarks |
| source_file | Source PDF filename |
Common issues and solutions
# Check if Ollama is running
ollama list
# Check Ollama API
curl http://localhost:11434/api/tags
# If using remote Ollama, set OLLAMA_URL in .env
OLLAMA_URL=http://192.168.1.100:11434
# Check Tesseract installation
tesseract --version
# List available languages
tesseract --list-langs
# Install Chinese language if missing
# Ubuntu/Debian:
sudo apt-get install tesseract-ocr-chi-sim
# macOS:
brew install tesseract-lang
# Ensure poppler is installed
# Ubuntu/Debian:
sudo apt-get install poppler-utils
# macOS:
brew install poppler
Standalone version vs. ComfyUI version
| Feature | ComfyUI Version | Standalone Version |
|---|---|---|
| Dependencies | ComfyUI + PyTorch | Node.js only |
| Setup Complexity | High | Low |
| Memory Usage | High (GPU) | Low (CPU) |
| Performance | GPU accelerated | GPU accelerated, fallback to CPU |
| Deployment | Requires ComfyUI | Independent |
| API | ComfyUI nodes | REST API |