No description
This commit adds comprehensive image extraction and OCR functionality to the OCR worker:
Features:
- Created image-extractor.js worker module with extractImagesFromPage() function
- Uses pdftoppm (with ImageMagick fallback) to convert PDF pages to high-res images
- Images saved to /uploads/{documentId}/images/page-{N}-img-{M}.png
- Returns image metadata: id, path, position, width, height
OCR Worker Integration:
- Imports image-extractor module and extractTextFromImage from OCR service
- After processing page text, extracts images from each page
- Runs Tesseract OCR on extracted images
- Stores image data in document_images table with extracted text and confidence
- Indexes images in Meilisearch with type='image' for searchability
- Updates document.imageCount and sets imagesExtracted flag
Database:
- Uses existing document_images table from migration 004
- Stores image metadata, OCR text, and confidence scores
Dependencies:
- Added pdf-img-convert and sharp packages
- Uses system tools (pdftoppm/ImageMagick) for reliable PDF conversion
Testing:
- Created test-image-extraction.js to verify image extraction
- Created test-full-pipeline.js to test end-to-end extraction + OCR
- Successfully tested with 05-versions-space.pdf test document
Error Handling:
- Graceful degradation if image extraction fails
- Continues OCR processing even if images cannot be extracted
- Comprehensive logging for debugging
Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
||
|---|---|---|
| client | ||
| docs | ||
| scripts | ||
| server | ||
| test/data | ||
| .gitignore | ||
| ANALYSIS_INDEX.md | ||
| ARCHITECTURE-SUMMARY.md | ||
| BRANDING_CREATIVE_BRIEF.md | ||
| BUILD_COMPLETE.md | ||
| CLEANUP_COMPLETE.sh | ||
| DEVELOPMENT.md | ||
| GITEA_ACCESS.md | ||
| GOOGLE_DRIVE_OCR_QUICKSTART.md | ||
| IMPLEMENTATION_COMPLETE.md | ||
| NAVIDOCS_HANDOVER.md | ||
| navidocs_search_token_test_report.json | ||
| OCR_FINAL_RECOMMENDATION.md | ||
| OCR_PIPELINE_SETUP.md | ||
| PORT_ALLOCATION.md | ||
| PORT_MIGRATION_SUMMARY.md | ||
| QUICK_REFERENCE.md | ||
| QUICKSTART.md | ||
| README.md | ||
| README_NEW.md | ||
| REORGANIZE_FILES.sh | ||
| SERVICES_STATUS.md | ||
| SESSION_STATUS.md | ||
| STACKCP_ARCHITECTURE_ANALYSIS.md | ||
| STACKCP_DEBATE_BRIEF.md | ||
| STACKCP_EVALUATION_REPORT.md | ||
| STACKCP_QUICK_REFERENCE.md | ||
| STACKCP_VERIFICATION_SUMMARY.md | ||
| start-all.sh | ||
| stop-all.sh | ||
| test-backend-e2e.js | ||
| test-e2e.js | ||
| test-manual.pdf | ||
| TEST_RESULTS.md | ||
NaviDocs - Professional Boat Manual Management
Production-ready boat manual management platform with OCR and intelligent search
Built with Vue 3, Express, SQLite, and Meilisearch. Extracted from the lilian1 (FRANK-AI) prototype with clean, professional code only.
Features
- Upload PDFs - Drag and drop boat manuals
- OCR Processing - Automatic text extraction with Tesseract.js
- Intelligent Search - Meilisearch with boat terminology synonyms
- Offline-First - PWA with service worker caching
- Multi-Vertical - Supports boats, marinas, and properties
- Secure - Tenant tokens, file validation, rate limiting
Tech Stack
Backend
- Node.js 20 - Express 5
- SQLite - better-sqlite3 with WAL mode
- Meilisearch - Sub-100ms search with synonyms
- BullMQ - Background OCR job processing
- Tesseract.js - PDF text extraction
Frontend
- Vue 3 - Composition API with
<script setup> - Vite - Fast builds and HMR
- Tailwind CSS - Meilisearch-inspired design
- Pinia - State management
- PDF.js - Document viewer
Quick Start
Prerequisites
# Required
node >= 20.0.0
npm >= 10.0.0
# For OCR
pdftoppm (from poppler-utils)
tesseract >= 5.0.0
# For search
meilisearch >= 1.0.0
# For queue
redis >= 6.0.0
Installation
# Clone repository
cd ~/navidocs
# Install server dependencies
cd server
npm install
cp .env.example .env
# Edit .env with your configuration
# Initialize database
npm run init-db
# Install client dependencies
cd ../client
npm install
# Start services (each in separate terminal)
meilisearch --master-key=masterKey
redis-server
cd ~/navidocs/server && node workers/ocr-worker.js
cd ~/navidocs/server && npm run dev
cd ~/navidocs/client && npm run dev
Visit http://localhost:8080
Architecture
See docs/architecture/ for complete schema and configuration details.
Ship it. Learn from users. Iterate.