Skip to main content

AilaDLScanObject

Object representing a scanned driver's license barcode.

Declaration

@interface AilaDLScanObject : AilaScanObject
@property (nonatomic) AilaCodeType type;
@property (nonatomic) NSString *data;
@property (nonatomic) NSString *rawData;
@end

Description

This object is returned as part of the scanCallback upon a successful driver's license scan when dlParsingMode is enabled. It extends AilaScanObject with an additional rawData property containing the unparsed PDF417 barcode string.

Properties

type

Always AilaCodeTypePDF417 for driver's license scans.

Type: AilaCodeType

data

Returns the parsed data from the driver's license in a JSON string.

Type: NSString / String

All possible keys:

Names: firstName, middleNames, lastName, givenNameAlias, lastNameAlias,
suffixAlias, suffix

Dates: expirationDate, issueDate, birthdate, hazmatExpirationDate,
revisionDate, underEighteenUtilDate, underNineteenUtilDate,
underTwentyOneUtilDate

Appearance: race, gender, eyeColor, height, weight, hairColor

Location: placeOfBirth, streetAddress, streetAddressTwo, city, state,
postalCode, country

Meta Data: version, licenseNumber, documentId, auditInformation,
inventoryControlNumber, complianceType, isOrganDonor,
isVeteran, isTemporaryDocument

Codes: federalVehicleCode, standardVehicleClass, standardRestrictionCode,
standardEndorsementCode, jurisdictionVehicleClass,
jurisdictionRestrictionCode, jurisdictionEndorsementCode,
jurisdictionVehicleDescription, jurisdictionRestrictionDescription,
jurisdictionEndorsementDescription

Date Format: YYYY-MM-DDTHH:MM:SSZ

Any keys not found in the parsed data will not appear in the JSON string.

rawData

Returns the raw string from the pdf417 barcode.

Type: NSString / String

This is the unparsed PDF417 string as read from the driver's license.

Methods

typeDescription

Returns the descriptive text "pdf417".

Returns: NSString / String

Usage Example

config.dlParsingMode = AilaDLParsingModeOn;
config.scanCallback = ^(NSArray<AilaScanObject *> *results) {
for (AilaScanObject *scan in results) {
if ([scan isKindOfClass:[AilaDLScanObject class]]) {
AilaDLScanObject *dlScan = (AilaDLScanObject *)scan;

// Get parsed JSON data
NSString *jsonData = dlScan.data;
NSData *data = [jsonData dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *parsed = [NSJSONSerialization JSONObjectWithData:data
options:0
error:nil];

NSString *firstName = parsed[@"firstName"];
NSString *lastName = parsed[@"lastName"];
NSString *licenseNumber = parsed[@"licenseNumber"];
NSString *expirationDate = parsed[@"expirationDate"];

NSLog(@"Name: %@ %@", firstName, lastName);
NSLog(@"License: %@, Expires: %@", licenseNumber, expirationDate);

// Get raw PDF417 string
NSString *rawDL = dlScan.rawData;
NSLog(@"Raw Data: %@", rawDL);
}
}
};

See Also