Wahid_NAPS2.Sdk 2.0.0

dotnet add package Wahid_NAPS2.Sdk --version 2.0.0                
NuGet\Install-Package Wahid_NAPS2.Sdk -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Wahid_NAPS2.Sdk" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Wahid_NAPS2.Sdk --version 2.0.0                
#r "nuget: Wahid_NAPS2.Sdk, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Wahid_NAPS2.Sdk as a Cake Addin
#addin nuget:?package=Wahid_NAPS2.Sdk&version=2.0.0

// Install Wahid_NAPS2.Sdk as a Cake Tool
#tool nuget:?package=Wahid_NAPS2.Sdk&version=2.0.0                

NAPS2.Sdk

NuGet

NAPS2.Sdk is a fully-featured scanning library, supporting WIA, TWAIN, SANE, and ESCL scanners on Windows, Mac, and Linux.

Packages

NAPS2.Sdk is modular, and depending on your needs you may have to reference a different set of packages.

Required Packages

Optional Packages

Usage

See the Samples for more examples and description.

// Set up
using var scanningContext = new ScanningContext(new GdiImageContext());
var controller = new ScanController(scanningContext);

// Query for available scanning devices
var devices = await controller.GetDeviceList();

// Set scanning options
var options = new ScanOptions
{
    Device = devices.First(),
    PaperSource = PaperSource.Feeder,
    PageSize = PageSize.A4,
    Dpi = 300
};

// Scan and save images
int i = 1;
await foreach (var image in controller.Scan(options))
{
    image.Save($"page{i++}.jpg");
}

// Scan and save PDF
var images = await controller.Scan(options).ToListAsync();
var pdfExporter = new PdfExporter(scanningContext);
await pdfExporter.Export("doc.pdf", images);

Drivers

Windows Mac Linux
WIA X
TWAIN X *
Apple X
SANE X X
ESCL X X X

WIA (Windows Image Acquisition) is a Microsoft technology for scanners (and cameras). Many scanners provide WIA drivers for Windows.

TWAIN is a cross-platform standard for image acquisition. Many scanners provide TWAIN drivers for Windows and/or Mac.

Apple's ImageCaptureCore provides access to TWAIN and ESCL scanners on Mac devices.

SANE is an open-source API and set of backends for various scanners. Primarily for Linux, supported devices use backends made by open-source contributors or the manufacturer themselves.

ESCL, also known as Apple AirScan, is a standard protocol for scanning over a network. Many modern scanners support ESCL, and as it's a network protocol, specific drivers aren't required. ESCL can also be used over a USB connection in some cases.

Choosing a Driver

Each platform has a default driver (WIA on Windows, Apple on Mac, and SANE on Linux). To use another driver, you only need to specify it:

var devices = await controller.GetDeviceList(Driver.Twain);
...
options.Driver = Driver.Twain;

Worker Processes

Using the TWAIN driver on Windows usually requires the calling process to be 32-bit. If you want to use TWAIN from a 64-bit process, NAPS2 provides a 32-bit worker process:

// Reference the NAPS2.Sdk.Worker.Win32 package and call this method
scanningContext.SetUpWin32Worker();

Contributing

Looking to contribute to NAPS2 or NAPS2.Sdk? Have a look at the wiki.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-macos10.15 is compatible.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Framework net is compatible.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 798 11/27/2023
1.0.0 176 11/22/2023