private void PopulateCommon() { _listViewCommonFields.Items.Clear(); //First Name ListViewItem firstNameItem = new ListViewItem(); firstNameItem.Text = "First Name"; AAMVANameResult firstNameRes = _id.FirstName; firstNameItem.SubItems.Add(firstNameRes == null ? "" : firstNameRes.Value); _listViewCommonFields.Items.Add(firstNameItem); //LastName ListViewItem lastNameItem = new ListViewItem(); lastNameItem.Text = "Last Name"; AAMVANameResult lastNameRes = _id.LastName; lastNameItem.SubItems.Add(lastNameRes == null ? "" : lastNameRes.Value); _listViewCommonFields.Items.Add(lastNameItem); //DOB ListViewItem dobItem = new ListViewItem(); dobItem.Text = "Date Of Birth (YYYYMMDD)"; string dob = _id.DateOfBirth; dobItem.SubItems.Add(dob == null ? "" : dob); _listViewCommonFields.Items.Add(dobItem); AAMVARegion region = _id.AddressRegion; //OverXX depending on region if (_id.Over18Available) { ListViewItem item18 = new ListViewItem(); item18.Text = "Over 18?"; item18.SubItems.Add(_id.Over18.ToString()); _listViewCommonFields.Items.Add(item18); } if ((region == AAMVARegion.Canada && _id.Over19Available) || (region == AAMVARegion.Unknown && _id.Over19Available)) { ListViewItem item19 = new ListViewItem(); item19.Text = "Over 19?"; item19.SubItems.Add(_id.Over19.ToString()); _listViewCommonFields.Items.Add(item19); } if ((region == AAMVARegion.UnitedStates && _id.Over21Available) || (region == AAMVARegion.Unknown && _id.Over21Available)) { ListViewItem item21 = new ListViewItem(); item21.Text = "Over 21?"; item21.SubItems.Add(_id.Over21.ToString()); _listViewCommonFields.Items.Add(item21); } //ID Number ListViewItem numberItem = new ListViewItem(); numberItem.Text = "ID Number"; string number = _id.Number; numberItem.SubItems.Add(number == null ? "" : number); _listViewCommonFields.Items.Add(numberItem); //Address Street 1 ListViewItem addressStreet1Item = new ListViewItem(); addressStreet1Item.Text = "Address Street 1"; string addressStreet1 = _id.AddressStreet1; addressStreet1Item.SubItems.Add(addressStreet1 == null ? "" : addressStreet1); _listViewCommonFields.Items.Add(addressStreet1Item); //Address Street 2 ListViewItem addressStreet2Item = new ListViewItem(); addressStreet2Item.Text = "Address Street 2"; string addressStreet2 = _id.AddressStreet2; addressStreet2Item.SubItems.Add(addressStreet2 == null ? "" : addressStreet2); _listViewCommonFields.Items.Add(addressStreet2Item); //Address City ListViewItem addressCityItem = new ListViewItem(); addressCityItem.Text = "Address City"; string addressCity = _id.AddressCity; addressCityItem.SubItems.Add(addressCity == null ? "" : addressCity); _listViewCommonFields.Items.Add(addressCityItem); //Address State Abbreviation ListViewItem addressStateAbbrItem = new ListViewItem(); addressStateAbbrItem.Text = "Address State Abbreviation"; string addressStateAbbr = _id.AddressStateAbbreviation; addressStateAbbrItem.SubItems.Add(addressStateAbbr == null ? "" : addressStateAbbr); _listViewCommonFields.Items.Add(addressStateAbbrItem); //Address Postal Code ListViewItem addressPostalCodeItem = new ListViewItem(); addressPostalCodeItem.Text = "Address Postal Code"; string addressPostalCode = _id.AddressPostalCode; addressPostalCodeItem.SubItems.Add(addressPostalCode == null ? "" : addressPostalCode); _listViewCommonFields.Items.Add(addressPostalCodeItem); //Region ListViewItem addressRegionItem = new ListViewItem(); addressRegionItem.Text = "Address Region"; addressRegionItem.SubItems.Add(region.ToString()); _listViewCommonFields.Items.Add(addressRegionItem); //Expiration Date ListViewItem expirationDateItem = new ListViewItem(); expirationDateItem.Text = "Expiration Date (YYYYMMDD)"; string expirationDate = _id.ExpirationDate; expirationDateItem.SubItems.Add(expirationDate == null ? "" : expirationDate); _listViewCommonFields.Items.Add(expirationDateItem); //Issue Date ListViewItem issueDateitem = new ListViewItem(); issueDateitem.Text = "Issue Date (YYYYMMDD)"; string issueDate = _id.IssueDate; issueDateitem.SubItems.Add(issueDate == null ? "" : issueDate); _listViewCommonFields.Items.Add(issueDateitem); //Expired if (_id.ExpirationAvailable) { ListViewItem itemExpired = new ListViewItem(); itemExpired.Text = "Expired?"; itemExpired.SubItems.Add(_id.Expired.ToString()); _listViewCommonFields.Items.Add(itemExpired); } //EyeColor ListViewItem eyeColorItem = new ListViewItem(); eyeColorItem.Text = "Eye Color"; AAMVAEyeColor eyeColor = _id.EyeColor; eyeColorItem.SubItems.Add(eyeColor.ToString()); _listViewCommonFields.Items.Add(eyeColorItem); //HairColor ListViewItem hairColorItem = new ListViewItem(); hairColorItem.Text = "Hair Color"; AAMVAHairColor hairColor = _id.HairColor; hairColorItem.SubItems.Add(hairColor.ToString()); _listViewCommonFields.Items.Add(hairColorItem); //Sex ListViewItem sexItem = new ListViewItem(); sexItem.Text = "Sex"; AAMVASex sex = _id.Sex; sexItem.SubItems.Add(sex.ToString()); _listViewCommonFields.Items.Add(sexItem); }
static void Main(string[] args) { // provide drivers license file with PDF417 barcode to recognize string inputFilePath = @"PATH TO IMAGE"; RasterSupport.SetLicense(@"C:\LEADTOOLS 20\Common\License\LEADTOOLS.LIC", System.IO.File.ReadAllText(@"C:\LEADTOOLS 20\Common\License\LEADTOOLS.LIC.KEY")); using (RasterCodecs codecs = new RasterCodecs()) using (RasterImage inputImage = codecs.Load(inputFilePath)) { BarcodeEngine engine = new BarcodeEngine(); BarcodeData data = engine.Reader.ReadBarcode(inputImage, LeadRect.Empty, BarcodeSymbology.PDF417); if (data != null) { using (AAMVAID id = BarcodeData.ParseAAMVAData(data.GetData(), false)) { if (id != null) { Console.WriteLine("Issuer Identification Number: " + id.IssuerIdentificationNumber); Console.WriteLine("Jurisdiction: " + id.Jurisdiction.ToString()); Console.WriteLine("AAMVA CDS Version: " + id.Version.ToString()); Console.WriteLine("Jurisdiction Version: " + id.JurisdictionVersion); Console.WriteLine("Number of Entries: " + id.NumberOfEntries.ToString()); AAMVANameResult firstNameResult = id.FirstName; if (firstNameResult != null) { Console.WriteLine("First Name: " + firstNameResult.Value + ", Inferred?: " + firstNameResult.InferredFromFullName); } AAMVANameResult lastNameResult = id.LastName; if (lastNameResult != null) { Console.WriteLine("Last Name: " + lastNameResult.Value + ", Inferred?: " + lastNameResult.InferredFromFullName); } string addressStreet1 = id.AddressStreet1; if (addressStreet1 != null) { Console.WriteLine("Address Street 1: " + addressStreet1); } string addressStreet2 = id.AddressStreet2; if (addressStreet2 != null) { Console.WriteLine("Address Street 2: " + addressStreet2); } string addressStateAbbreviation = id.AddressStateAbbreviation; if (addressStateAbbreviation != null) { Console.WriteLine("Address State Abbreviation: " + addressStateAbbreviation); } string addressCity = id.AddressCity; if (addressCity != null) { Console.WriteLine("Address City: " + addressCity); } string addressPostalCode = id.AddressPostalCode; if (addressPostalCode != null) { Console.WriteLine("Address Postal Code: " + addressPostalCode); } AAMVARegion addressRegion = id.AddressRegion; Console.WriteLine("Address Region: " + addressRegion.ToString()); string dateOfBirth = id.DateOfBirth; if (dateOfBirth != null) { Console.WriteLine("Date of Birth: " + dateOfBirth); } if (id.Over18Available) { Console.WriteLine("Over 18?: " + id.Over18); } if (id.Over19Available) { Console.WriteLine("Over 19?: " + id.Over19); } if (id.Over21Available) { Console.WriteLine("Over 21?: " + id.Over21); } if (id.ExpirationAvailable) { Console.WriteLine("Expired?: " + id.Expired); } string expirationDate = id.ExpirationDate; if (expirationDate != null) { Console.WriteLine("Expiration Date: " + expirationDate); } string issueDate = id.IssueDate; if (issueDate != null) { Console.WriteLine("Issue Date: " + issueDate); } string idNumber = id.Number; if (idNumber != null) { Console.WriteLine("ID Number: " + idNumber); } AAMVAEyeColor eyeColor = id.EyeColor; Console.WriteLine("Eye Color: " + eyeColor.ToString()); AAMVAHairColor hairColor = id.HairColor; Console.WriteLine("Hair Color: " + hairColor.ToString()); AAMVASex sex = id.Sex; Console.WriteLine("Sex: " + sex.ToString()); Console.ReadLine(); } } } } }