Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

Code Tip: New High Level TWAIN in v14.5
Started by Gabe-Forum@LEADTOOLS.com at 11-02-2005 12:09. Topic has 0 replies.

Print Search « Previous Thread Next Thread »
  11-02-2005, 12:09
Gabe-Forum@LEADTOOLS.com is not online. Last active: 7/18/2008 3:15:03 PM Gabe-Forum@LEADTOOLS.com



Top 25 Posts
Joined on 04-27-2005
Posts 237
Code Tip: New High Level TWAIN in v14.5

Attachment: Twain.zip
Reply Quote

This code will use Twain high level functions using LEADTOOLS .NET, this code will show you how to change the transfer options in an easy way, without having to go through setting the capabilities and modify their values.

 

LEADTOOLS .NET high level functions will deal with the capabilities internally and change their values and prepare the  acquire process in a very easy way.

 

The following is the code:

 

      // This function will acquire page and save it to file using file transfer mode

      private void AcquireUsingFileMode(TwainSession session)

      {

         try

         {

            // check if file transfer mode is supported or not

            if (session.IsFileTransferAvailable == false)

            {

               // the file transfer mode is not supported

               MessageBox.Show(this, "File transfer mode is not supported!");

               return;

            }

 

            // get the default transfer options

            session.GetTransferOptions();

 

            // set transfer mode to file

            session.TransferMode = TwainTransferModes.TwainTransferFile;

 

            // set transfer file format

            session.TransferFileFormat = (int)TwainCapabilityValue.FileFormatBmp;

 

            // set transfer file name, the file name will be used to save the acquired page

            session.TransferFileName = @"c:\test.bmp";

 

            // update transfer options

            session.SetTransferOptions();

 

            // Acquire the page from source and save it to file

            session.Acquire(TwainUserInterfaceFlags.Show | TwainUserInterfaceFlags.Modal);

 

            MessageBox.Show(this, "Acquired page is saved to file", "Acquire to File");

         }

         catch (Exception ex)

         {

            // failure occurred

            MessageBox.Show(this, ex.Message);

         }

      }

 


   Report 
Post
LEAD Support Fo... » Developer » Scanning/Captur... » Code Tip: New High Level TWAIN in v14.5

Powered by Community Server, by Telligent Systems