naps2/NAPS2.Wia
2020-02-08 17:30:51 -05:00
..
.gitignore Make a separate NAPS2.Wia project 2020-01-31 22:54:22 -05:00
Hresult.cs Make a separate NAPS2.Wia project 2020-01-31 22:54:22 -05:00
IWiaDeviceProps.cs Make a separate NAPS2.Wia project 2020-01-31 22:54:22 -05:00
LICENSE Add NAPS2.Wia readme and license 2020-01-31 23:12:06 -05:00
NAPS2.Wia.csproj Enable nullable checking for a few projects 2020-02-08 17:30:51 -05:00
NativeStreamWrapper.cs Make a separate NAPS2.Wia project 2020-01-31 22:54:22 -05:00
NativeWiaMethods.cs Fix nullable issues in NAPS2.Wia 2020-02-04 21:47:54 -05:00
NativeWiaObject.cs Make a separate NAPS2.Wia project 2020-01-31 22:54:22 -05:00
README.md Add a NAPS2.Sdk link to the NAPS2.Wia readme 2020-01-31 23:36:37 -05:00
WiaDevice.cs Fix nullable issues in NAPS2.Wia 2020-02-04 21:47:54 -05:00
WiaDeviceInfo.cs Make a separate NAPS2.Wia project 2020-01-31 22:54:22 -05:00
WiaDeviceManager.cs Fix nullable issues in NAPS2.Wia 2020-02-04 21:47:54 -05:00
WiaErrorCodes.cs Make a separate NAPS2.Wia project 2020-01-31 22:54:22 -05:00
WiaException.cs Make a separate NAPS2.Wia project 2020-01-31 22:54:22 -05:00
WiaExtensions.cs Fix nullable issues in NAPS2.Wia 2020-02-04 21:47:54 -05:00
WiaItem.cs Make a separate NAPS2.Wia project 2020-01-31 22:54:22 -05:00
WiaItemBase.cs Fix nullable issues in NAPS2.Wia 2020-02-04 21:47:54 -05:00
WiaProperty.cs Fix nullable issues in NAPS2.Wia 2020-02-04 21:47:54 -05:00
WiaPropertyAttributes.cs Fix nullable issues in NAPS2.Wia 2020-02-04 21:47:54 -05:00
WiaPropertyCollection.cs Fix nullable issues in NAPS2.Wia 2020-02-04 21:47:54 -05:00
WiaPropertyFlags.cs Make a separate NAPS2.Wia project 2020-01-31 22:54:22 -05:00
WiaPropertyId.cs Make a separate NAPS2.Wia project 2020-01-31 22:54:22 -05:00
WiaPropertyType.cs Make a separate NAPS2.Wia project 2020-01-31 22:54:22 -05:00
WiaPropertyValue.cs Make a separate NAPS2.Wia project 2020-01-31 22:54:22 -05:00
WiaTransfer.cs Fix nullable issues in NAPS2.Wia 2020-02-04 21:47:54 -05:00
WiaVersion.cs Make a separate NAPS2.Wia project 2020-01-31 22:54:22 -05:00

NAPS2.Wia

NAPS2.Wia is a standalone component that acts as a low-level wrapper around Windows Image Acquisition (WIA).

Compared to the COM-based wiaaut.dll, you get:

  • WIA 2.0 support
  • Better feeder compatibility
  • Idiomatic .NET interface

If you're looking for a higher-level and easier-to-use scanning interface, check out NAPS2.Sdk.

Example

using var deviceManager = new WiaDeviceManager();

// Prompt the user to select a scanner
using var device = deviceManager.PromptForDevice(parentForm.Handle);

// Select between Flatbed/Feeder
using var item = device.FindSubItem("Feeder");

// Enable duplex scanning
item.SetProperty(WiaPropertyId.IPS_DOCUMENT_HANDLING_SELECT,
                 WiaPropertyValue.DUPLEX | WiaPropertyValue.FRONT_FIRST);

// Set up the scan
using var transfer = item.StartTransfer();
transfer.PageScanned += (sender, args) =>
{
    using (args.Stream)
    {
        var bitmap = new Bitmap(args.Stream);
        // Do something with the image
    }
};

// Do the actual scan
transfer.Download();

Known issues

  • Native acquisition with WIA 1.0 only works in 32-bit processes. NAPS2.Sdk provides a 32-bit worker process that can be used from 64-bit applications. Most users shouldn't be affected since WIA 2.0 has no such issue.

Supported Platforms

  • .NET Framework 4.0 (Windows XP+)
  • .NET Core 2.0+ (Windows)
  • .NET Standard 2.0+ (Windows)

License

Unlike most of NAPS2.Sdk which is licensed under the LGPL, NAPS2.Wia uses the more permissive MIT license.