public TwainCompressionMode BufferedMemoryCompression { get; set; }
The compression to be used when having the transfer mode set to be memory. Possible values are (according to the TWAIN specification): TwainCapabilityValue.CompressionNone No compression is to be used. TwainCapabilityValue.CompressionPackBits Pack Bits compression. TwainCapabilityValue.CompressionGroup31D CCITT Group 3 compression with no End of Line. TwainCapabilityValue.CompressionGroup31DEol CCITT Group 3 compression with End of Line. TwainCapabilityValue.CompressionGroup32D CCITT Group 3 compression (use cap for K Factor). TwainCapabilityValue.CompressionGroup4 CCITT Group 4 compression. TwainCapabilityValue.CompressionJpeg JPEG compression. TwainCapabilityValue.CompressionLzw LZW compression (like gifs). TwainCapabilityValue.CompressionJbig JBIG compression, used mostly for bitonal images. TwainCapabilityValue.CompressionPng PNG compressed. TwainCapabilityValue.CompressionRle4 RLE4 compression. TwainCapabilityValue.CompressionRle8 RLE8 compression. TwainCapabilityValue.CompressionBitFields Bit Fields compression.
using Leadtools;
using Leadtools.Twain;
public void DataTransferPropertyExample(IntPtr parent)
{
try
{
TwainSession session = new TwainSession();
session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None);
TwainProperties props = session.Properties;
TwainDataTransferProperties dataTransfer = props.DataTransfer;
dataTransfer.FillOrder = TwainDataTransferFillOrder.LsbFirst;
dataTransfer.BufferedMemoryCompression = TwainCompressionMode.None;
dataTransfer.TransferMechanism = TwainTransferMechanism.Memory;
dataTransfer.ScanFileFormat = TwainFileFormat.Bmp;
dataTransfer.MemoryBufferSize = 1024;
dataTransfer.SaveToOneFile = true;
dataTransfer.AppendToFile = false;
dataTransfer.DumpMemoryBuffersToFile = true;
dataTransfer.FileName = Path.Combine(LEAD_VARS.ImagesDir, "test.bmp");
props.DataTransfer = dataTransfer;
session.Properties = props;
session.Shutdown();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";
}