Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cyanfish/naps2-wia
Low-level WIA 2.0/1.0 application library for .NET
https://github.com/cyanfish/naps2-wia
wia
Last synced: about 2 months ago
JSON representation
Low-level WIA 2.0/1.0 application library for .NET
- Host: GitHub
- URL: https://github.com/cyanfish/naps2-wia
- Owner: cyanfish
- License: mit
- Created: 2020-08-15T19:30:54.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-08-30T03:33:08.000Z (over 1 year ago)
- Last Synced: 2024-10-28T16:12:10.566Z (2 months ago)
- Topics: wia
- Language: C#
- Homepage:
- Size: 649 KB
- Stars: 17
- Watchers: 5
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NAPS2.Wia
[![NuGet](https://img.shields.io/nuget/v/NAPS2.Wia)](https://www.nuget.org/packages/NAPS2.Wia/)
NAPS2.Wia is a standalone component that acts as a low-level wrapper around [Windows Image Acquisition (WIA)](https://docs.microsoft.com/en-us/windows/win32/wia/-wia-startpage).
Compared to the COM-based [wiaaut.dll](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/wiaaut/-wiaaut-startpage), you get:
- WIA 2.0 support
- Better feeder compatibility
- Idiomatic .NET interfaceIf you're looking for a higher-level and easier-to-use scanning interface, check out [NAPS2.Sdk](https://github.com/cyanfish/naps2/tree/master/NAPS2.Sdk).
## Example
```c#
using var deviceManager = new WiaDeviceManager();// Prompt the user to select a scanner
using var device = deviceManager.PromptForDevice();// Select either "Flatbed" or "Feeder"
using var item = device.FindSubItem("Feeder");// Scan all pages in the feeder at once
item.SetProperty(WiaPropertyId.IPS_PAGES,
WiaPropertyValue.ALL_PAGES);// Enable duplex scanning
item.SetProperty(WiaPropertyId.IPS_DOCUMENT_HANDLING_SELECT,
WiaPropertyValue.DUPLEX);// 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.6.2+ (Windows)
- .NET 6.0+ (Windows)## License
Unlike most of NAPS2.Sdk which is licensed under the LGPL, NAPS2.Wia uses the more permissive MIT license.