Specifies the jurisdiction of the issuing authority.
[SerializableAttribute()]
[DataContractAttribute()]
public enum AAMVAJurisdiction
Value | Member | Description |
---|---|---|
0 | Unknown | Jurisdiction unknown. |
1 | Alabama | Alabama, United States. Abbreviated "AB". IIN 636033. |
2 | Alaska | Alaska, United States. Abbreviated "AK". IIN 636059. |
3 | AmericanSamoa | American Samoa, United States Territory. Abbreviated "AS". IIN 604427. |
4 | Arizona | Arizona, United States. Abbreviated "AZ". IIN 636026. |
5 | Arkansas | Arkansas, United States. Abbreviated "AR". IIN 636021. |
6 | BritishColumbia | British Columbia, Canada. Abbreviated "BC". IIN 636028. |
7 | California | California, United States. Abbreviated "CA". IIN 636014. |
8 | Coahuila | Coahuila, Mexico. Abbreviated "CU". IIN 636056. |
9 | Colorado | Colorado, United States. Abbreviated "CO". IIN 636020. |
10 | Connecticut | Connecticut, United States. Abbreviated "CT". IIN 636006. |
11 | DistrictOfColumbia | Washington D.C., United States Federal District. Abbreviated "DC". IIN 636043. |
12 | Delaware | Delaware, United States. Abbreviated "DE". IIN 636011. |
13 | Florida | Florida, United States. Abbreviated "FL". IIN 636010. |
14 | Georgia | Georgia, United States. Abbreviated "GA". IIN 636055. |
15 | Guam | Guam, United States Territory. Abbreviated "GU". IIN 636019. |
16 | Hawaii | Hawaii, United States. Abbreviated "HI". IIN 636047. |
17 | Hidalgo | Hidalgo, Mexico. Abbreviated "HG". IIN 636057. |
18 | Idaho | Idaho, United States. Abbreviated "ID". IIN 636050. |
19 | Illinois | Illinois, United States. Abbreviated "IL". IIN 636035. |
20 | Indiana | Indiana, United States. Abbreviated "IN". IIN 636037. |
21 | Iowa | Iowa, United States. Abbreviated "IA". IIN 636018. |
22 | Kansas | Kansas, United States. Abbreviated "KS". IIN 636022. |
23 | Kentucky | Kentucky, United States. Abbreviated "KY". IIN 636046. |
24 | Louisiana | Louisiana, United States. Abbreviated "LA". IIN 636007. |
25 | Maine | Maine, United States. Abbreviated "ME". IIN 636041. |
26 | Manitoba | Manitoba, Canada. Abbreviated "MB". IIN 636048. |
27 | Maryland | Maryland, United States. Abbreviated "MD". IIN 636003. |
28 | Massachusetts | Massachusetts, United States. Abbreviated "MA". IIN 636002. |
29 | Michigan | Michigan, United States. Abbreviated "MI". IIN 636032. |
30 | Minnesota | Minnesota, United States. Abbreviated "MN". IIN 636038. |
31 | Mississippi | Mississippi, United States. Abbreviated "MS". IIN 636051. |
32 | Missouri | Missouri, United States. Abbreviated "MO". IIN 636030. |
33 | Montana | Montana, United States. Abbreviated "MT". IIN 636008. |
34 | Nebraska | Nebraska, United States. Abbreviated "NE". IIN 636054. |
35 | Nevada | Nevada, United States. Abbreviated "NV". IIN 636049. |
36 | NewBrunswick | New Brunswick, Canada. Abbreviated "NB". IIN 636017. |
37 | NewHampshire | New Hampshire, United States. Abbreviated "NH". IIN 636039. |
38 | NewJersey | New Jersey, United States. Abbreviated "NJ". IIN 636036. |
39 | NewMexico | New Mexico, United States. Abbreviated "NM". IIN 636009. |
40 | NewYork | New York, United States. Abbreviated "NY". IIN 636001. |
41 | Newfoundland | Newfoundland, Canada. Abbreviated "NF". IIN 636016. |
42 | NorthCarolina | North Carolina, United States. Abbreviated "NC". IIN 636004. |
43 | NorthDakota | North Dakota, United States. Abbreviated "ND". IIN 636034. |
44 | NovaScotia | Nova Scotia, Canada. Abbreviated "NS". IIN 636013. |
45 | Ohio | Ohio, United States. Abbreviated "OH". IIN 636023. |
46 | Oklahoma | Oklahoma, United States. Abbreviated "OK". IIN 636058. |
47 | Ontario | Ontario, Canada. Abbreviated "ON". IIN 636012. |
48 | Oregon | Oregon, United States. Abbreviated "OR". IIN 636029. |
49 | Pennsylvania | Pennsylvania, United States. Abbreviated "PA". IIN 636025. |
50 | PrinceEdwardIsland | Prince Edward Island, Canada. Abbreviated "PE". IIN 604426. |
51 | Quebec | Quebec, Canada. Abbreviated "QC". IIN 604428. |
52 | RhodeIsland | Rhode Island, United States. Abbreviated "RI". IIN 636052. |
53 | Saskatchewan | Saskatchewan, Canada. Abbreviated "SK". IIN 636044. |
54 | SouthCarolina | South Carolina, United States. Abbreviated "SC". IIN 636005. |
55 | SouthDakota | South Dakota, United States. Abbreviated "SD". IIN 636042. |
56 | Tennessee | Tennessee, United States. Abbreviated "TN". IIN 636053. |
57 | StateDeptUsa | State Department, United States. No abbreviation -- AAMVAID.AddressStateAbbreviation will be null. IIN 636027. |
58 | Texas | Texas, United States. Abbreviated "TX". IIN 636015. |
59 | UsVirginIslands | US Virgin Islands, United States Territory. Abbreviated "VI". IIN 636062. |
60 | Utah | Utah, United States. Abbreviated "UT". IIN 636040. |
61 | Vermont | Vermont, United States. Abbreviated "VT". IIN 636024. |
62 | Virginia | Virginia, United States. Abbreviated "VA". IIN 636000. |
63 | Washington | Washington, United States. Abbreviated "WA". IIN 636045. |
64 | WestVirginia | West Virginia, United States. Abbreviated "WV". IIN 636061. |
65 | Wisconsin | Wisconsin, United States. Abbreviated "WI". IIN 636031. |
66 | Wyoming | Wyoming, United States. Abbreviated "WY". IIN 636060. |
67 | Yukon | Yukon, Canada. Abbreviated "YT". IIN 604429. |
68 | Alberta | Alberta, Canada. Abbreviated “AB”. IIN 604432. |
69 | NorthernMarianaIslands | Northern Marianna Islands, USA. Abbreviated “MP”. IIN 604430. |
70 | Nunavut | Nunavut, Canada. Abbreviated “NU”. IIN 604433. |
71 | PuertoRico | Puerto Rico, USA. Abbreviated “PR”. IIN 604431 |
Remarks
For more information, refer to https://www.aamva.org/identity/issuer-identification-numbers-(iin).
using Leadtools;
using Leadtools.Barcode;
using Leadtools.Codecs;
/* This example defines an instance of AAMVAID, sets and reads the data, and finally saves a PDF17 barcode.
* The code is outlined in sections as follows:
*
* 1. Set the members to simulate reading AAMVAID and extract it at a later point
* 2. Build the AAMVAID instance
* 3. Define a hash set and parse to a specific element
* 4. Process AAMAValidCharacters
* 5. Extract AAMVAID properties
* 6. Extract data and write as PDF417 barcode
*/
public void AAMVA_Example()
{
//1. Set the members to simulate reading AAMVAID and extract it at a later point
const string JURISDICTION_VERSION = "00";
const string SUBFILE_TYPE_CODE = "DL";
const int SUBFILES_COUNT = 1;
const int BITS_PER_PIXEL = 24;
const int IMAGE_DPI = 300;
AAMVAID driversLicenseID = null;
AAMVANameResult nameResult = null;
DateTime birthday = new DateTime(DateTime.Now.Year - 16, DateTime.Now.Month, DateTime.Now.Day);
string[,] driversLicenseData = new string[,] {{"DDF", "N"}, // First name truction (N = not truncated)
{"DDE", "N"}, // Last name truction (N = not truncated)
{"DCG", "USA"}, // Country identification
{"DCF", "NONE"}, // Document discriminator
{"DAQ", "1234567890"}, // ID Number
{"DAK", "123456 "}, // Postal code
{"DAJ", "PA"}, // Address Jurisdiction Code
{"DAI", "Any Town"}, // Address City
{"DAG", "123 Main Street"}, // Address Street 1
{"DAU", "072 in"}, // Height (inches or centimeters)
{"DAY", "BRO"}, // Eye color
{"DBC", "1"}, // Sex (Male = 1, Female = 2, 9 = Not specified)
{"DBB", birthday.ToString("MMddyyyy")}, // Date of Birth
{"DBD", DateTime.Now.ToString("MMddyyyy")}, // Document Issue Date
{"DAD", "NONE"}, // Middle Name
{"DAC", "John"}, // First name
{"DCS", "Doe"}, // Last name
{"DBA", DateTime.Now.AddYears(6).ToString("MMddyyyy")},// Expiration date
{"DCD", "M"}, // Jurisdiction-specific endorsement codes
{"DCB", "NONE"}, // Jurisdiction-specific restriction codes
{"DCA", "C"}, // Jurisdiction-specific vehicle class
{"DDJ", birthday.AddYears(21).ToString("MMddyyyy")}, // Under 21 until
{"DDI", birthday.AddYears(19).ToString("MMddyyyy")}, // Under 19 until
{"DDH", birthday.AddYears(18).ToString("MMddyyyy")}, // Under 18 until
{"DAZ", "BRO"}}; // Hair color
// 2. Build the AAMVAID instance
using (AAMVAIDBuilder builder = new AAMVAIDBuilder())
{
builder.SetJurisdiction(AAMVAJurisdiction.Pennsylvania, AAMVAID.LookupIssuerIdentificationNumber(AAMVAJurisdiction.Pennsylvania))
.SetVersion(AAMVAVersion.Version2016)
.SetJurisdictionVersion(JURISDICTION_VERSION)
.SetNumberOfEntries(SUBFILES_COUNT);
builder.SetSubfileType(SUBFILES_COUNT - 1, AAMVASubfileType.DL, SUBFILE_TYPE_CODE);
for (int i = 0; i < driversLicenseData.GetLength(0); i++)
builder.AddDataElementToSubfile(0, driversLicenseData[i, 0], driversLicenseData[i, 1]);
Console.WriteLine($"Is AAMVAIDBuilder disposed: {builder.IsDisposed} \n");
Console.WriteLine("===================================================================");
Console.WriteLine("\n");
driversLicenseID = builder.Build();
builder.Reset();
}
foreach (KeyValuePair<string, AAMVADataElement> element in driversLicenseID.Subfiles[0].DataElements)
{
Console.WriteLine($"ElementID: {element.Value.ElementID} Element value:{element.Value.Value}");
}
// 3. Define a hash set and parse to a specific element
IDictionary<string, AAMVADataElementInfo> _dataElementInfo;
_dataElementInfo = AAMVADataElementInfo.RetrieveAll(AAMVAVersion.Version2016);
HashSet<string> DataElements = new HashSet<string>()
{
"DCA", "DCB", "DCD", "DBA", "DCS", "DAC", "DAD", "DBD", "DBB", "DBC", "DAY", "DAZ", "DCL",
"DAU", "DAG", "DAI", "DAJ", "DAH", "DAK", "DAQ", "DCF", "DCG", "DDE", "DDF", "DDG", "DCU"
};
foreach (string elementID in DataElements)
{
AAMVADataElementInfo info = _dataElementInfo[elementID];
info.LengthType = AAMVALengthType.Fixed;
Console.WriteLine($"ElementID: {info.ElementID}");
switch (elementID)
{
case "DAY": // Eye color
AAMVAEyeColor eyeColor = driversLicenseID.EyeColor;
Console.WriteLine($"Eye Color: {eyeColor}");
break;
case "DAZ": // Hair color
AAMVAHairColor hairColor = driversLicenseID.HairColor;
Console.WriteLine($"Eye Color: {hairColor}");
break;
case "DAI": // City
Console.WriteLine($"City Name: {driversLicenseID.AddressCity}");
break;
case "DAK": // Jurisdiction
AAMVARegion rgn = AAMVAID.LookupRegion(driversLicenseID.Jurisdiction);
Console.WriteLine($"Postal Code: {driversLicenseID.AddressPostalCode} {rgn}");
break;
case "DCG": // Address region (country)
Console.WriteLine($"Address Region: {driversLicenseID.AddressRegion}");
break;
case "DAJ": // State abbreviation
AAMVAJurisdiction[] jurisdictions = (AAMVAJurisdiction[])Enum.GetValues(typeof(AAMVAJurisdiction));
for (int i = 0; i < jurisdictions.Length; i++)
{
string abbr = AAMVAID.LookupStateAbbreviation(jurisdictions[i]);
Console.WriteLine($"State abbreviations: {abbr}");
}
Console.WriteLine($"Address State Abbreviation: {driversLicenseID.AddressStateAbbreviation}");
break;
case "DBC": // Sex
AAMVASex[] sex = (AAMVASex[])Enum.GetValues(typeof(AAMVASex));
for (int i = 0; i < sex.Length; i++)
{
Console.WriteLine($"Sex codes: {sex[i]}");
}
break;
case "DAG": // Street address 1
Console.WriteLine($"Street Address1: {driversLicenseID.AddressStreet1}");
break;
case "DAH": // Street address 2
Console.WriteLine($"Street Address2: {driversLicenseID.AddressStreet2}" +
$"- Can be null if address street line 2 is not encoded in the barcode data");
break;
case "DBB": // Date of Birth
Console.WriteLine($"Date of Birth: {driversLicenseID.DateOfBirth}");
break;
case "DBA": // Expiration date
Console.WriteLine($"Expiration Available: {driversLicenseID.ExpirationAvailable} | Is Expired: {driversLicenseID.Expired} | Expiration Date: {driversLicenseID.ExpirationDate}");
break;
case "DBD": // Issue date
Console.WriteLine($"Issue Date: {driversLicenseID.IssueDate}");
break;
case "DCS": // Last name
Console.WriteLine($"Last Name: {driversLicenseID.LastName.Value}");
break;
case "DAD": // Middle name
Console.WriteLine($"Middle Name: {driversLicenseID.MiddleName.Value}");
break;
case "DAC": // First name
Console.WriteLine($"Middle Name: {driversLicenseID.FirstName.Value}");
break;
case "DCU": // Suffix
AAMVANameSuffix[] enums = (AAMVANameSuffix[])Enum.GetValues(typeof(AAMVANameSuffix));
for (int i = 2; i < enums.Length; i++)
{
AAMVANameSuffix enumValue = enums[i];
string codeArabic = AAMVAID.LookupNameSuffixCodeArabic(enumValue);
Console.WriteLine("Arabic suffix: " + enumValue.ToString() + " - \"" + codeArabic + "\"");
string codeRoman = AAMVAID.LookupNameSuffixCodeRoman(enumValue);
Console.WriteLine("Roman suffix: " + enumValue.ToString() + " - \"" + codeRoman + "\"");
}
break;
case "DCL": // Suffix
AAMVARaceEthnicity[] races = (AAMVARaceEthnicity[])Enum.GetValues(typeof(AAMVARaceEthnicity));
for (int i = 0; i < races.Length; i++)
{
AAMVARaceEthnicity race = races[i];
string code = AAMVAID.LookupRaceEthnicityCode(race);
Console.WriteLine("Race: " + race + " - \"" + code + "\"");
}
break;
}
Console.WriteLine($"Definition: {info.Definition}");
Console.WriteLine($"Friendly Name: {info.FriendlyName}");
Console.WriteLine($"Length Type: {info.LengthType}");
Console.WriteLine($"Valid Characters: {info.ValidCharacters}");
Console.WriteLine($"Valid Subfile Types: {info.ValidSubfileTypes}");
Console.WriteLine($"Value Max Length: {info.ValueMaxLength}");
Console.WriteLine("\n");
Console.WriteLine("===================================================================");
Console.WriteLine("\n");
}
// 4. Process AAMAValidCharacters
AAMVAValidCharacters[] characters = (AAMVAValidCharacters[])Enum.GetValues(typeof(AAMVAValidCharacters));
for (int i = 0; i < characters.Length; i++)
{
Console.WriteLine($"Valid characters: {characters[i]}");
}
// 5. Extract AAMVAID properties
Console.WriteLine($"Is over 18: {driversLicenseID.Over18}"); //Is over 18
Console.WriteLine($"Is over 18: {driversLicenseID.Over18Available}"); //Over 18 available
Console.WriteLine($"Is over 19: {driversLicenseID.Over19}"); //Is over 19
Console.WriteLine($"Is over 19: {driversLicenseID.Over19Available}"); //Over 19 available
Console.WriteLine($"Is over 21: {driversLicenseID.Over21}"); //Is over 21
Console.WriteLine($"Is over 21: {driversLicenseID.Over21Available}"); //Over 21 available
Console.WriteLine($"Version: {driversLicenseID.Version}"); //Version
Console.WriteLine($"Number of entries: {driversLicenseID.NumberOfEntries}"); //Number of entries
Console.WriteLine($"Is AMMVAID Disposed: {driversLicenseID.IsDisposed}"); //Is Disposed
Console.WriteLine($"Issuer Identification Number: {driversLicenseID.IssuerIdentificationNumber}"); //Issuer Identification Number
Console.WriteLine($"Jurisdiction Version Number: {driversLicenseID.JurisdictionVersion}"); // Jurisdiction Version Number
var jurisdiction = AAMVAID.LookupJurisdiction(driversLicenseID.IssuerIdentificationNumber); // Returns state
var suffix = AAMVAID.LookupNameSuffix("JR"); // Returns name suffix
var raceEthnicity = AAMVAID.LookupRaceEthnicity("BK"); // Returns race/ethnicity
Console.WriteLine($"{jurisdiction} \n {suffix} \n {raceEthnicity}");
nameResult = driversLicenseID.FirstName;
nameResult.InferredFromFullName = true;
Console.WriteLine($"Name result: {nameResult.Value}");
var subfilesList = driversLicenseID.Subfiles;
foreach (AAMVASubfile subfile in subfilesList)
{
Console.WriteLine($"{subfile.Offset} \n {subfile.SubfileType} \n {subfile.SubfileTypeCode}");
}
// 6. Extract data and write as PDF417 barcode
PDF417BarcodeData data = new PDF417BarcodeData();
data.Symbology = BarcodeSymbology.PDF417;
data.SetData(driversLicenseID.GetBytes());
Console.WriteLine($"=======================================");
AAMVAID parsedAAMVAData = BarcodeData.ParseAAMVAData(driversLicenseID.GetBytes(), true);
Console.WriteLine($"Parsed AAMVAData First Name: {parsedAAMVAData.FirstName.Value}");
Console.WriteLine($"Parsed AAMVAData Last Name: {parsedAAMVAData.LastName.Value}");
Console.WriteLine($"Parsed AAMVAData Issue Date: {parsedAAMVAData.IssueDate}");
BarcodeEngine barcodeEngine = new BarcodeEngine();
PDF417BarcodeWriteOptions pdf417WriteOptions = (PDF417BarcodeWriteOptions)barcodeEngine.Writer.GetDefaultOptions(BarcodeSymbology.PDF417);
//Refer to AAMVA CDS 2016 Section D.3 thru D.11.2
//Must range from 0.0066 to 0.015 inches
pdf417WriteOptions.XModule = 15; //0.015
//Must >= 3
pdf417WriteOptions.XModuleAspectRatio = 3;
//Error level must be at least 3, 5 is recommended
pdf417WriteOptions.ECCLevel = PDF417BarcodeECCLevel.Level5;
//Default WidthAspectRatio is 2:1. 4:1 looks similar to ID barcodes in the wild
pdf417WriteOptions.SymbolWidthAspectRatio = 4;
//Default quiet zone for PDF417 is 2 * XModule
RasterCodecs codecs = new RasterCodecs();
barcodeEngine.Writer.CalculateBarcodeDataBounds(LeadRect.Empty, IMAGE_DPI, IMAGE_DPI, data, pdf417WriteOptions);
using (RasterImage image = RasterImage.Create(data.Bounds.Width, data.Bounds.Height, BITS_PER_PIXEL, IMAGE_DPI, new RasterColor(255, 255, 255)))
{
barcodeEngine.Writer.WriteBarcode(image, data, pdf417WriteOptions); // Write the barcode
codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "MyDriversLicense.png"), RasterImageFormat.Png, 1); // write the output to file
}
codecs.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";
}