Leadtools.Twain Namespace > TwainSession Class : StopFeeder Method |
public void StopFeeder()
'Declaration Public Sub StopFeeder()
'Usage Dim instance As TwainSession instance.StopFeeder()
public void StopFeeder()
function Leadtools.Twain.TwainSession.StopFeeder()
public: void StopFeeder();
In order to stop acquiring images with the Acquire or AcquireToImage, call this method in the Leadtools.Twain.TwainSession.AcquirePage event when it is fired.
In order to stop acquire images by calling the AcquireFast, call this method in the Leadtools.Twain.TwainSession.AcquireMultiPage event when it is fired.
If the TWAIN source has no feeder, then this method will fail and an exception is thrown.
Dim acq_session As TwainSession Private Sub twain_AcquirePage(ByVal sender As Object, ByVal e As TwainAcquirePageEventArgs) ' get acquired image here ' call StopFeeder method here if you need to stop the feeder acq_session.StopFeeder() End Sub Public Sub AcquireExample(ByVal parent As IWin32Window) acq_session = New TwainSession() acq_session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None) acq_session.SelectSource(String.Empty) Dim props As TwainProperties = acq_session.Properties Dim dataProps As TwainDataTransferProperties = props.DataTransfer dataProps.FileName = Path.Combine(LEAD_VARS.ImagesDir, "twain.bmp") dataProps.MemoryBufferSize = dataProps.MemoryBufferSize * 2 props.DataTransfer = dataProps acq_session.Properties = props Dim opts As TwainTransferOptions = acq_session.TransferOptions AddHandler acq_session.AcquirePage, AddressOf twain_AcquirePage If acq_session.Acquire(TwainUserInterfaceFlags.Show) <> DialogResult.OK Then MessageBox.Show("Error Acquiring From Source") End If acq_session.Shutdown() End Sub Public NotInheritable Class LEAD_VARS Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" End Class
TwainSession acq_session; private void twain_AcquirePage(object sender, TwainAcquirePageEventArgs e) { // get acquired image here // call StopFeeder method here if you need to stop the feeder acq_session.StopFeeder(); } public void AcquireExample(IWin32Window parent) { acq_session = new TwainSession(); acq_session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None); acq_session.SelectSource(String.Empty); TwainProperties props = acq_session.Properties; TwainDataTransferProperties dataProps = props.DataTransfer; dataProps.FileName = Path.Combine(LEAD_VARS.ImagesDir, "twain.bmp"); dataProps.MemoryBufferSize = dataProps.MemoryBufferSize * 2; props.DataTransfer = dataProps; acq_session.Properties = props; TwainTransferOptions opts = acq_session.TransferOptions; acq_session.AcquirePage += new EventHandler<TwainAcquirePageEventArgs>(twain_AcquirePage); if (acq_session.Acquire(TwainUserInterfaceFlags.Show) != DialogResult.OK) MessageBox.Show("Error Acquiring From Source"); acq_session.Shutdown(); } static class LEAD_VARS { public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2