How to read micr line in C#
can any one help me out i m new to c#
i have scanned a check and from that i want to read micr line and get the details of bank routing number and check number from the MICR line in c# and i m working this in windows application
public static string ReadOneMICR(string file, int page)
{
try
{
string sout = "";
mut.WaitOne(); // Prevent reentrancy
ClearMicr.CcMicrReader reader = new ClearMicr.CcMicrReader();
reader.Image.Open(file, page);
// Do actual reading
reader.FindMICR();
// Display results
if (reader.MicrCount > 0)
{
ClearMicr.CcMicr Micr = reader.get_MicrLine(1);
sout = sout + "MICR Type: " + Micr.DocumentType + Environment.NewLine;
if (Micr.Routing.IsRead)
sout = sout + "Routing = " + Micr.Routing.TextANSI + Environment.NewLine;
if (Micr.AuxOnUs.IsRead)
sout = sout + "AuxOnUs = " + Micr.AuxOnUs.TextANSI + Environment.NewLine;
if (Micr.OnUs.IsRead)
sout = sout + "OnUs = " + Micr.OnUs.TextANSI + Environment.NewLine;
if (Micr.Amount.IsRead)
sout = sout + "Amount = " + Micr.Amount.TextANSI + Environment.NewLine;
if (Micr.Account.IsRead)
sout = sout + "Account = " + Micr.Account.TextANSI + Environment.NewLine;
if (Micr.CheckNumber.IsRead)
sout = sout + "CheckNumber = " + Micr.CheckNumber.TextANSI + Environment.NewLine;
}
else
sout = "No MICR found";
return sout;
}
开发者_如何学Go catch (Exception ex)
{
return ("ERROR: " + ex.ToString());
}
finally
{
mut.ReleaseMutex();
System.GC.Collect();
}
}
here is sample code and i m facing issues in the above code for get_MicrLine and TextANSI lines please clarify me and provide me a bug free code for reading micr line in check
You haven't said what your error is, but you might try this replacement line:
ClearMicr.CcMicr Micr = reader.MicrLine[1];
精彩评论