This project has moved and is read-only. For the latest updates, please go here.

Using a IStreamProvider for caching data of acquired image

When acquiring a large number of images or large images may need caching data of acquired image outside the RAM. To do this, you need to implement the IStreamProvider interface and place it to the IoC container. This feature is available starting with a Saraff.Twain.NET

internal sealed class StreamProvider:Component, IStreamProvider {

    public Stream GetStream() {
        return new FileStream(Path.GetTempFileName(),FileMode.Create,FileAccess.ReadWrite,FileShare.Read,64*1024,FileOptions.DeleteOnClose);

_container = new ServiceContainer();

// ...

_twain32 = _container.CreateInstance<Twain32>();

// ...


For more details see a Saraff.Twain.Sample2 (Saraff.Twain.NET CS Samples).

Last edited Nov 26, 2016 at 9:17 PM by SARAFF, version 2