Get input from a scanner connected to a USB port or serial port in .net

I am working on an application where my application should receive input from a scanner in image format.

This is a wpf application, the scanner is connected to the system, the user puts the document in the scanner and prints a button in the application to scan the document, and then the application should save the scanned document as an image in the system.

I do not want to use any paid component, I believe that there should be a built-in way to read input from ports.

+4
source share
2 answers

, Windows Image Acquisition. , , .

 //Reference "Windows Image Acquisition Library v2.0" on the COM tab.

private void Button1_Click(object sender, EventArgs e)
{
    var dialog = new WIA.CommonDialog();
    var file = dialog.ShowAcquireImage(WIA.WiaDeviceType.ScannerDeviceType);
    file.SaveFile("C:\Temp\WIA." + file.FileExtension);
}

- , , WIAScanner: http://miljenkobarbir.com/using-a-scanner-without-dialogs-in-net/

, , , , :

private void Button1_Click(object sender, EventArgs e)
{
    var scannerIds = WIAScanner.GetDevices();

    if(scannerIds.Count > 0) {
        var images = WIAScanner.Scan(scannerIds[0]);

        //Process the images here.
    }
}

, .

+4

:

1) TWAIN

API, " " LGPL,  . Wikipedia  .

2) Windows

Microsoft. " WIA / ".

. Wikipedia  .

3) (ISIS)

SDK .NET, , , , , . Wikipedia .

4)

, , USB-. , (.. ++), API- ++, -, # .

0

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


All Articles