Table of Contents

Class ScanningContext

Namespace
NAPS2.Scan
Assembly
NAPS2.Sdk.dll

A ScanningContext object is needed for most NAPS2 operations. Set it up with the corresponding ImageContext type for image type you expect (e.g. GdiImageContext for System.Drawing.Bitmap, if you're using Windows Forms). You can also set various other properties that affect scanning and image processing.

When the ScanningContext is disposed, all ProcessedImage objects that were generating from scanning or importing with that ScanningContext object will be automatically disposed.
public class ScanningContext : IDisposable
Inheritance
ScanningContext
Extension Methods

Constructors

ScanningContext(ImageContext)

Initializes a new instance of the ScanningContext class with the specified ImageContext.

public ScanningContext(ImageContext imageContext)

Parameters

imageContext ImageContext

The corresponding ImageContext type for the image type you expect (e.g. GdiImageContext for System.Drawing.Bitmap, if you're using Windows Forms).

Properties

FileStorageManager

Gets or sets the context's FileStorageManager. If non-null, ProcessedImage objects from scanning or importing with this ScanningContext will store the actual image data on disk instead of in memory.

public FileStorageManager? FileStorageManager { get; set; }

Property Value

FileStorageManager?

ImageContext

Gets the context's ImageContext. This corresponds to the image type used (e.g. GdiImageContext for System.Drawing.Bitmap, if you're using Windows Forms).

public ImageContext ImageContext { get; }

Property Value

ImageContext

Logger

Gets or sets the logger used for detailed diagnostics.

public ILogger Logger { get; set; }

Property Value

ILogger

OcrEngine

Gets or sets the context's OcrEngine. This is used to perform the OCR (optical character recognition) operation if OCR is requested for PDF export.

public IOcrEngine? OcrEngine { get; set; }

Property Value

IOcrEngine

TempFolderPath

Gets or sets the path to a temp folder where transient files can be stored. Defaults to Path.GetTempPath().

public string TempFolderPath { get; set; }

Property Value

string

Methods

Dispose()

public void Dispose()