←Select platform

AAMVAID Class

Summary

Provides information encoded in an AAMVA CDS related to ID card or driver's license, of the cardholder.

Syntax
C#
Objective-C
C++
Java
public class AAMVAID : IDisposable 
@interface LTAAMVAID : NSObject<NSCopying> 
public class AAMVAID 
public ref class AAMVAID : public System.IDisposable   
Remarks

The class will be filled by calling BarcodeData.ParseAAMVAData(byte[], bool) when reading PDF417 barcodes from North American ID cards and driver's licenses.

Example
C#
using Leadtools; 
using Leadtools.Barcode; 
using Leadtools.Codecs; 
 
 
public void AAMVA_Example() 
{ 
	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; 
	BarcodeEngine barcodeEngine = new BarcodeEngine(); 
	RasterCodecs codecs = new RasterCodecs(); 
	AAMVAID driversLicenseID = 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 
 
	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]); 
 
		driversLicenseID = builder.Build(); 
	} 
 
	PDF417BarcodeData data = new PDF417BarcodeData(); 
	data.Symbology = BarcodeSymbology.PDF417; 
	data.SetData(driversLicenseID.GetBytes()); 
 
	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 
 
	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:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 22.0.2022.9.20
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2022 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Barcode Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2022 LEAD Technologies, Inc. All Rights Reserved.