The viewer controls for the semantic XHTML output, written in Java and compiled to JavaScript by TeaVM.
Website · All repositories · Live output
This Maven project produces XHtmlOcrControls.js - the interactive JavaScript that powers OCR document visualization features like:
- Background image toggle
- Line and word bounding boxes
- Confidence-based color coding
- Layout mode switching
- Keyboard shortcuts (Ctrl+1-5)
- Input: Java source code with TeaVM annotations
- Build Tool: Maven with TeaVM plugin
- Output:
target/generated/js/XHtmlOcrControls.js - Deployment Target: GitHub Pages CDN at
https://oneocr.github.io/semantic_xhtml/
- JDK: 11 or higher
- Maven: 3.6+
- TeaVM: Configured via Maven plugin
- IDE: NetBeans (recommended)
mvn clean compileThe generated JavaScript will be available at:
target/generated/js/XHtmlOcrControls.js
target/generated/js/XHtmlOcrControls.js.map
- Write Java Code: Implement interactive features using TeaVM-compatible Java in NetBeans
- Build: Run Maven to generate JavaScript
- Deploy: Copy generated
XHtmlOcrControls.jsto the web repository for GitHub Pages hosting - Test: Verify functionality with XHTML OCR documents
This project maintains our commitment to pure Java development:
- No Native Code: FFM eliminated the need for C/C++ bindings
- No Manual JavaScript: TeaVM transpiles Java to browser-compatible JavaScript
- No HTML Templating: XHTML documents generated using Java DSL
- Unified Skillset: Pure Java team can contribute across the entire stack
- Type Safety: Catch errors at compile time rather than runtime
- IDE Support: Full NetBeans support with code completion and refactoring
- Team Consistency: Pure Java team maintains productivity without context switching
- Maintainability: Structured OOP approach for complex interactive features
The generated JavaScript is served via GitHub Pages CDN and dynamically loaded by OCR documents, ensuring:
- Backward Compatibility: Existing OCR documents continue to work
- Independent Updates: Controls can be upgraded without touching OCR documents
- Clean Separation: Document generation and presentation remain decoupled
- Stable CDN URL: Consistent access via GitHub Pages hosting
- Web Repository: semantic_xhtml - GitHub Pages hosting for generated JavaScript
- Document Generator: oneocr-cli - Creates XHTML documents
- Core API: oneocr-api - Java FFM bindings for Windows OCR
Part of the OneOCR project (https://github.com/oneocr) - leveraging Windows 11 built-in OCR for Java applications.