Support Center

Fetch MICR data using TWAIN driver

Vivek Jan 07, 2013 04:52AM EST

Hi

I want to fetch MICR data through TWAIN using C#. Please assist me.
I knew we need to use Extended Image info functions but i would like to how to use it.

Thanks,
Vivek

2 Data Techniques Responses and 2 Community Responses

Up 0 Rated Down
Vivek  Data Techniques Employee Jan 07, 2013 05:12AM EST

Hi,

Below is my snippet, kindly correct me if I am wrong.

Hashtable ht = new Hashtable();
int []infoids = new int[2];
infoids[0]=4675; //MAGDATA
infoids[1]=4676; //MAGType
objTWAINControl.RequestExtendedImageInfo(infoids);
ht = objTWAINControl.ExtendedImageInfo;

Thanks,
Vivek

Up 0 Rated Down
DTI Support  Data Techniques Employee Jan 07, 2013 09:57AM EST

Hi,

Thats basically correct, here's some complete sample code showing the proper sequence of getting the attributes:

System.Drawing.Image img;
// Create an array of the ExtImageInformation items we are interested in
ExtImageInformation[] items = new ExtImageInformation[] { ExtImageInformation.BarcodeText, ExtImageInformation.BarcodeType };
Twain.RequestExtendedImageInfo( items );
imgs = new ArrayList();
Twain.MaxPages = 4;
img = Twain.ScanPage();
while (img != null)
{
imgs.Add(img);
// Process the ExtImageInformation items - Note that we may not get all the requested items as the scanner may not
// support all the items we requested. So we need to look at the Key value which is the ExtImageInformation and then the
// Value field which contains the returned value. In some cases the returned value may be an array if the scanner returned
// multiple values such as in the case of multiple barcodes on a page.
foreach (DictionaryEntry o in Twain.ExtendedImageInfo)
{
ExtImageInformation info = (ExtImageInformation)int.Parse(o.Key.ToString());
Console.WriteLine(string.Format("{0} = {1}", info.ToString("g"), o.Value));
}
img = Twain.ScanPage();
}
Twain.CloseSource();

Let me know if you have any questions.

John
Data Techniques

Up 3 Rated Down
Vivek  Data Techniques Employee Jan 09, 2013 03:42AM EST

Thanks a lot,

Could you please let me know that can I be able to Check number, account number from Check using ImageMan.

I have enabled MICR and also added the imageextinfo too

Code snippet
Scan:
public void Scan()
{
try
{
System.Drawing.Image img;
int cnt = 0;
objTWAINControl.BeginInit();
ExtImageInformation[] items = new ExtImageInformation[] { ExtImageInformation.MagData, ExtImageInformation.MagType };
objTWAINControl.RequestExtendedImageInfo(items);
objTWAINControl.UserInterface = UserInterfaces.None;
objTWAINControl.ShowIndicators = true;
objTWAINControl.MaxPages = 2;
objTWAINControl.UseDuplex = true;
objTWAINControl.Duplex = Duplexes.SinglePass;
img = objTWAINControl.ScanPage();

while (img != null)
{
img.Save(@"C:\TWAIN\Test"+cnt+".jpg");

MessageBox.Show("objTWAINControl.ExtendedImageInfo" + objTWAINControl.ExtendedImageInfo.Count.ToString());
foreach (DictionaryEntry o in objTWAINControl.ExtendedImageInfo)
{
ExtImageInformation info = (ExtImageInformation)int.Parse(o.Key.ToString());
MessageBox.Show(string.Format("{0} = {1}" + " - " + info.ToString("g") + " - " + o.Value));
}
img = null;
cnt++;
img = objTWAINControl.ScanPage();
}
}
catch (Exception ex)
{
throw ex;
}
}

MICR
public void setCapbability()
{
try
{
Capabilities capa = new Capabilities();
capa = Capabilities.MicrEnabled;
objTWAINControl.SetCapability(capa, true, DataType.Bool);

}
catch (Exception ex)
{
throw ex;
}
}


Please assist me to get MICR data from check.

Thanks,
Vivek

Up 5 Rated Down
DTI Support  Data Techniques Employee Jan 09, 2013 11:12AM EST

Hello Vivek,

I have responded to the email you sent on this issue.

Thanks for your interest in our products and please let us know if you have any questions.

Sincerely,
Sean
Data Techniques Support

This question is closed to new answers.

Contact Us