RapidScanner 1.0.9

dotnet add package RapidScanner --version 1.0.9                
NuGet\Install-Package RapidScanner -Version 1.0.9                
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="RapidScanner" Version="1.0.9" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RapidScanner --version 1.0.9                
#r "nuget: RapidScanner, 1.0.9"                
#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 RapidScanner as a Cake Addin
#addin nuget:?package=RapidScanner&version=1.0.9

// Install RapidScanner as a Cake Tool
#tool nuget:?package=RapidScanner&version=1.0.9                

RapidScanner .NET SDK

A modern, high-performance document scanning solution for .NET applications with AI-powered document processing capabilities.

Features

Core Scanning Features

  • High-performance scanning with memory pooling
  • Async/await support throughout
  • Multiple color modes (Color, Grayscale, BlackAndWhite)
  • Various paper sizes support
  • Multiple page scanning
  • Preview support
  • Real-time progress tracking

Image Processing

  • Memory-efficient image processing using Span<T>
  • Auto-enhancement and color correction
  • Document bounds detection
  • Deskew and rotation correction
  • Shadow removal
  • Noise reduction
  • Barcode and QR code detection
  • Multiple output formats (PDF, JPEG, PNG, TIFF)

Document AI Capabilities

  • Text extraction (OCR)
  • Document classification
  • Table detection and extraction
  • Form field recognition
  • Signature detection
  • Layout analysis

Installation

Install via NuGet Package Manager:

dotnet add package RapidScanner

Quick Start

Basic Scanning

// Create and configure scanner using fluent API
var scanner = await Scanner.Create()
    .WithResolution(300)
    .WithColorMode(ColorMode.Color)
    .WithSize("A4")
    .WithOutputFormat(ImageFormat.Pdf)
    .BuildAsync();

// Register for progress updates
scanner.ScanProgress += (sender, e) =>
{
    Console.WriteLine($"Scan progress: {e.Progress}%");
};

// Start scanning
var result = await scanner.ScanAsync("output.pdf");

Image Processing

// Create image processor with custom buffer size
using var processor = new ImageProcessor(maxArrayLength: 2 * 1024 * 1024); // 2MB buffer

// Configure processing options
var options = new ImageProcessingOptions
{
    EnableNoiseReduction = true,
    EnableColorCorrection = true,
    EnableSharpening = true,
    Quality = 95
};

// Process image with efficient memory usage
using var fileStream = File.OpenRead("input.jpg");
byte[] processedImage = await processor.ProcessImageAsync(fileStream, options);
await File.WriteAllBytesAsync("output.jpg", processedImage);

Document AI Features

using var docAi = new DocumentAI();

// Extract text with OCR
var text = await docAi.ExtractTextAsync("document.pdf", 
    languages: new[] { "en", "fr" });

// Analyze document layout
var layout = await docAi.AnalyzeLayoutAsync("document.pdf");

// Extract tables
var tables = await docAi.ExtractTablesAsync("document.pdf");

// Detect signatures
var signatures = await docAi.DetectSignaturesAsync("document.pdf");

Advanced Features

Custom Workflow

// Define a custom scanning workflow
var workflow = new ScanWorkflow()
    .AddStep(new ScanStep())
    .AddStep(new ImageProcessingStep
    {
        NoiseReduction = true,
        ColorCorrection = true
    })
    .AddStep(new OcrStep
    {
        Languages = new[] { "en" }
    })
    .AddStep(new SaveStep
    {
        Format = ImageFormat.Pdf,
        Path = "processed_document.pdf"
    });

// Execute workflow
await workflow.ExecuteAsync();

Memory-Efficient Processing

// Use ArrayPool for efficient memory usage
using var processor = new ImageProcessor();
await using var stream = File.OpenRead("large_image.jpg");

// Process image in chunks with minimal allocations
await foreach (var chunk in processor.ProcessStreamAsync(stream))
{
    // Handle each processed chunk
    await outputStream.WriteAsync(chunk);
}

Performance Considerations

  • Use the fluent API for better code readability and compile-time validation
  • Leverage ArrayPool<T> for large image processing operations
  • Use cancellation tokens for long-running operations
  • Implement proper disposal of resources using IAsyncDisposable
  • Consider using memory-mapped files for very large documents

Error Handling

The SDK uses specific exception types for better error handling:

  • ScannerException: For scanner-related errors
  • ImageProcessorException: For image processing errors
  • DocumentAIException: For AI-related errors

Example:

try
{
    await scanner.ScanAsync(settings);
}
catch (ScannerException ex) when (ex.Message.Contains("No devices found"))
{
    Console.WriteLine("Please connect a scanner and try again.");
}
catch (ScannerException ex)
{
    Console.WriteLine($"Scanning failed: {ex.Message}");
}

Contributing

We welcome contributions! Please see our Contributing Guide for details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Created by MohaNed Ghawar

Support

For support, please:

  1. Check the Documentation
  2. Open an issue on the GitHub repository
  3. Contact support@rapidscanner.dev
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-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  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 is compatible.  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. 
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
1.0.9 67 12/22/2024
1.0.8 62 12/22/2024
1.0.7 61 12/22/2024
1.0.6 62 12/22/2024
1.0.5 62 12/22/2024
1.0.4 59 12/22/2024
1.0.3 74 12/22/2024
1.0.2 68 12/22/2024
1.0.1 70 12/22/2024
1.0.0 68 12/22/2024