I nostri Prodotti
English Version
Servoy Scanner Plugin
Plugin per Servoy, permette di acquisire immagini da scanner e fotocamere TWAIN.
E' possibile pilotare completamente la scansione o lasciare all'utente la possibilità di usare la finestra generata dal driver TWAIN.
Compatibile con MacOSX e Windows 2000/XP/Vista.
 |
SintPro Scanner Plugin è un plugin per Servoy scritto in Java che permette di pilotare una qualunque sorgente TWAIN (scanner o fotocamera digitale ) direttamente da una soluzione Servoy.
L'immagine ottenuta dalla scansione potrà essere acquisita in formato JPG, GIF o PNG e potrà essere processata e salvata nel database o direttamente su disco.
Il plugin fornisce la possbilità di utilizzare l'interfaccia del driver TWAIN e specificare di volta in volta i settaggi da utilizzare per l'acquisizione oppure di procedere direttamente all'acquisizione utilizzando i parametri specificati via method dalla soluzione Servoy. E' possibile specificare la sorgente TWAIN dalla quale acquisire l'immagine, la risoluzione in dpi, la profondità colore in bits, il formato e i bordi che delimitano l'area da acquisire.
Utilizzando i seguenti methods è possibile acquisire la lista di tutti i driver Twain installati sulla macchina client e ottenerne le caratteristiche:
|
// Returns the names of the TWAIN sources available as an Array
var srcArray = plugins.sintproScannerPlugin.GetTwainSources();
// Returns an Object with the capabilities of a given TWAIN source
var sourceObject = plugins.sintproScannerPlugin.GetSourceInfo('source');
var supportedXResArray = sourceObject[0];
var supportedYResArray = sourceObject[1];
var supportedPixelTypesArray = sourceObject[2];
var supportedBitDepthsArray = sourceObject[3];
var supportedUnitsArray = sourceObject[4]; |
L'acquisizione dell'immagine vera e propria può essere può essere lasciata alla discrezione del'utente o svolta automaticamente dal plugin :
// Scan from the user selected source in the specified format (jpg/png/gif)
var scanObject = plugins.sintproScannerPlugin.Scan('license_key','png');
// Scan from the specified source in the specified format (jpg/png/gif)
var scanObject = plugins.sintproScannerPlugin.QuickScan('license_key',srcArray[0],'jpg');
// Scan using the specified parameters without user interaction
// The following line returns a RGB color image in jpg format at 300dpi in 8bit from the first Twain source
// And sets 0 (=inches) as unit for border measuring
// PixelTypes: b/w=0, grayscale=1, color=2
// The frame values need to be passed in the proper order: l,t,r,b
var scanObject = plugins.sintproScannerPlugin.AutoScan('license_key',srcArray[0],300,2,8,'jpg',0,0,0,0,0));
|
SintPro Scanner Plugin ritornerà come risultato un oggetto contenente l'immagine acquisita e le sue caratteristiche:
// The returned scanObject can be processed with Servoy's standard functions
var img = plugins.images.getImage(scanObject[0]);
var xRes = scanObject[1]
var yRes = scanObject[2]
var pixelType = scanObject[3]
var bitDepth = scanObject[4]
// Process the image using the images plugin
var height = img.getHeight();
var width = img.getWidth();
var contentType = img.getContentType();
var scaled_image = img.resize(150,150); |
Se lo scanner utilizzato supporta un sistema di Autofeed in grado di acquisire automaticamente più immagini è possibile sfruttarlo con il seguente method:
// Scan multiple pages using the specified parameters without user interaction
// The following line returns a RGB color image in jpg format at 300dpi in 8bit from the first Twain source
// PixelTypes: b/w=0, grayscale=1, color=2
var resultsArray = plugins.sintproScannerPlugin.MultipageScan('license_key',source,300,2,8,'jpg',
'/tmp/my_image_');
var imageFilesArray = resultsArray[0] // Array with the file names of acquired images
var xRes = resultsArray[1]
var yRes = resultsArray[2]
var pixelType = resultsArray[3]
var bitDepth = resultsArray[4]
// Load the images using File and Image plugin
for ( var i = 0 ; i < imageFilesArray.length ; i++ )
{
var imageData = plugins.file.readFile(imageFilesArray[i]);
var image = plugins.images.getImage(imageData);
var height = image.getHeight();
var width = imgage.getWidth();
var contentType = image.getContentType();
// Do all your stuff on this image and get the next one...
} |
SintPro Scanner Plugin diventa open source!
Visita la pagina del progetto su ServoyForge per ulteriori dettagli.
Vuoi scoprire cosa possiamo fare per la tua azienda? Contattaci all'indirizzo info@sintpro.com !