📜 ⬆️ ⬇️

AIR 2.0. Work with a scanner

As you know, Adobe AIR does not have its own interface to work with the scanner. And sometimes it is necessary ...

Below is a crutch to fix it.

We need:
1- any command-line utility for working with twain
-I wrote to myself on c #, there’s nothing complicated about it
-and you could use the quickscan utility (it is unfortunately paid, but for some, the demo will do)
2- modify the * .xml file with the project settings by writing in it
')
extendedDesktop desktop

3- add twain () function

private function twain():void{
var fileExec:File=new File('c:\\scan.exe'); // twain
var process:NativeProcess;
var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartupInfo.executable = fileExec;
var processArgs:Vector. = new Vector.(); //
processArgs[0] = "SelectScanner"; //
processArgs[1] = "Resolution"; // 300dpi
processArgs[2] = "300"; // quickscan,
nativeProcessStartupInfo.arguments = processArgs;
process = new NativeProcess();
process.addEventListener(NativeProcessExitEvent.EXIT,workWithImg); // ,
process.start(nativeProcessStartupInfo); //
}
private function workWithImg():void {
// ,
// quickscan page001.jpg , exe
}

* This source code was highlighted with Source Code Highlighter.

,
.

.
: Morozov&Sheko inc.

Source: https://habr.com/ru/post/97648/


All Articles