Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extracting Data from pdf417 such as Drivers License

I have an Android application in which i am scanning PDF417 barcode image. After scanning the Barcode i am getting the result as below.

@

ANSI 636014040002DL00410477ZC05180089DLDAQD1234562 XYXYXYXYXYXYXYXYX
DCSLASTNAMEXYXYXYXYXYXYXYXYXXYXYXYXYXYXYXYX
DDEU
DACFIRSTXYXYXYXYXYXYXYXYXXYXYXYXYXYXYXYXXYX
DDFU
DADXYXYXYXYXYXYXYXYXXYXYXYXYXYXYXYXXYXYXYXY
DDGU
DCAA XYXY
DCBNONEY1XY1XY1
DCDNONEX
DBD10312009
DBB10311977
DBA10312014
DBC1
DAU068 IN
DAYBRO
DAG1234 ANY STREET XY1XY1XY1XY1XY1XY1X
DAICITY XY1XY1XY1XY1XY1
DAJCA
DAK000000000  
DCF00/00/0000NNNAN/ANFD/YY X
DCGUSA
DCUSUFIX
DAW150
DAZBLK XY1XY1XY
DCKXY1XY1XY1XY1XY1XY1XY1XY1X
DDAF
DDBMMDDCCYY
DDD1

ZCZCAY
ZCBCORR LENS
ZCCBRN
ZCDXYX
ZCEXYXYXYXYXYXYXY
ZCFXY1XY1XY1XY1XY1XY1XYXYXYXYXYXYXY

I want to get details like FirstName, LastName, City, Address etc from the above String. Can anyone please tell me how do i get the details.

Thanks.

like image 879
ravi Avatar asked Mar 13 '14 09:03

ravi


People also ask

What is PDF417 barcode used for?

PDF417 is a 2d barcode (stacked symbology) used in a variety of applications, primarily transport, identification cards, and inventory management. PDF stands for Portable Data File and was developed by Symbol Technologies. PDF417 uses built-in error correction to ensure better readability.

How much data can PDF417?

According Wikipedia, a PDF417 can store a maximum of 90 rows, and each row a maximum of 30 codewords. Then 5 codewords could encode 6 bytes, or 44 digits with 15 codewords, or 1 codewords could encode 2 "letters". So you have as maximum: 2700 codewords or 3200 bytes, or 7920 digits, or 5400 "letters".


1 Answers

Please see below link and generate the parser to extract the information of driver License.

http://www.dol.wa.gov/external/docs/barcodeCalibration-EDLEID.pdf

I have make this decoder for ios app

here the code :

NSString *message=barcode.barcodeString;

    NSMutableArray *arrFixedData=[[NSMutableArray alloc]initWithObjects:@"DCS",@"DCT",@"DCU",@"DAG",@"DAI",@"DAJ",@"DAK",@"DCG",@"DAQ",@"DCA",@"DCB",@"DCD",@"DCF",@"DCH",@"DBA",@"DBB",@"DBC",@"DBD",@"DAU",@"DCE",@"DAY",@"ZWA",@"ZWB",@"ZWC",@"ZWD",@"ZWE",@"ZWF", nil];
    NSMutableArray *arrDriverData=[[NSMutableArray alloc]initWithObjects:@"Customer Family Name",@"Customer Given Name",@"Name Suffix",@"Street Address 1",@"City",@"Jurisdction Code",@"Postal Code",@"Country Identification",@"Customer Id Number",@"Class",@"Restrictions",@"Endorsements",@"Document Discriminator",@"Vehicle Code",@"Expiration Date",@"Date Of Birth",@"Sex",@"Issue Date",@"Height",@"Weight",@"Eye Color",@"Control Number",@"Endorsements",@"Transaction Types",@"Under 18 Until",@"Under 21 Until",@"Revision Date", nil];


    NSMutableDictionary *dict=[[NSMutableDictionary alloc]init];
    for (int i=0; i<[arrFixedData count]; i++)
    {
        NSRange range = [message  rangeOfString: [arrFixedData objectAtIndex:i] options: NSCaseInsensitiveSearch];
        NSLog(@"found: %@", (range.location != NSNotFound) ? @"Yes" : @"No");
        if (range.location != NSNotFound)
        {
            NSString *temp=[message substringFromIndex:range.location+range.length];

            NSRange end = [temp rangeOfString:@"\n"];
            if (end.location != NSNotFound)
            {
                temp = [temp substringToIndex:end.location];
                temp =[temp stringByReplacingOccurrencesOfString:@"\n" withString:@""];
                temp=[temp stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

            }
            NSLog(@"temp data : %@",temp);
            [dict setObject:temp forKey:[arrDriverData objectAtIndex:i]];
        }
    }

    NSLog(@"Dictionary : %@",dict);

The barcodestring contains the data which are scanned from pdf 417.

Thanks

like image 142
prish Avatar answered Sep 26 '22 06:09

prish