Skip to content
/ scanx Public

Scanx allow you to control scanner and printer from web with any browsers

Notifications You must be signed in to change notification settings

balbarak/scanx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started

Installation

  • Download and install the latest scanx app from here here.

    • After installed go to http://localhost:61234 to make sure the protocol is running.
    • This app is must be installed in clients pc in order to control their devices and printers.

To use it in your project

Include:

<script src="/path/to/jquery.js"></script> 

<script src="/path/to/signalr.min.js"></script> 

<script src="/path/to/scanx.js"></script>

files:

Usage

html

<img id="image" alt="scanned image" />

<button type="button" onclick="startScan()">
    Scan
</button>

javascript

<script type="text/javascript">

// declar scanx class
var scan = new ScanX();


//setup on image scan events
scan.connection.on("OnImageScanned", (data) => { 
    console.log('image event');
     var image = document.getElementById('image'); 
     image.src = "data:image/jpeg;base64," + data.imageBytes; 
});

//get installed scanners and select the first id
var firstScannerId = scan.getScanners()[0].deviceId;

//define scan settings
var settings = {
    color: 1, //color mode 1 color, 2 Grayscale, 4 Black and white
    dpi: 200 //dpi
}

//Scan first imaga
function startScan(){
    scan.scanSingle(firstScannerId,settings);
}

//Connect to the protocol
scan.connect();


</script>