←Select platform

TransferMechanism Property

Summary
Gets or sets transfer mode to be used by the TWAIN source.

Syntax
C#
C++/CLI
Python
public TwainTransferMechanism TransferMechanism { get; set; } 
public: 
property TwainTransferMechanism TransferMechanism { 
   TwainTransferMechanism get(); 
   void set (    TwainTransferMechanism ); 
} 
TransferMechanism # get and set (TwainDataTransferProperties) 

Property Value

Transfer mode to be used by the TWAIN source. Possible values are (according to the TWAIN specification):

If you set the TransferMode property to TransferMechanismMemory and set DumpMemoryBuffersToFile to true, then the Acquire method will write the received buffers (either compressed or uncompressed) to the output directly to the output file specified by the FileName property. If you set the TransferMode property to TransferMechanismMemory and a compression is specified by setting the BufferedMemoryCompression property, and you set the DumpMemoryBuffersToFile property to false, then the Acquire method will decompress the acquired data and generate a result image.

Example
C#
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"; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Twain Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.