简体   繁体   English

解码驾照PDF417或磁条

[英]decode drivers license PDF417 or magnetic strip

I was able to extract the code from the barcode but when reading the magnetic script from a OHIO drivers license I cannot seem to get the two letter code that prefixes the license number like the PDF417 does.我能够从条形码中提取代码,但是当从俄亥俄州驾驶执照中读取磁性脚本时,我似乎无法获得像 PDF417 那样在执照号前面加上两个字母的代码。

Private Sub ScannDLButton_Click(sender As Object, e As EventArgs) Handles ScanDLButton.Click
        Try


            Dim strInputBox As String = InputBox("Please Swipe/Scan Customer's Driver's License", "Driver's License")

            Dim strLastName As String
            Dim strFirstName As String
            Dim strMiddleName As String
            Dim strDOB As String
            Dim strStreet As String
            Dim strCity As String
            Dim strState As String
            Dim strZIP As String
            Dim strDL As String
            Dim strCountry As String

this determines if it is a magnetic strip这确定它是否是磁条

            If strInputBox.Contains("%") Then

                Dim CaretPresent As Boolean = False
                Dim EqualPresent As Boolean = False
                CaretPresent = strInputBox.Contains("^")
                EqualPresent = strInputBox.Contains("=")

                If CaretPresent Then 'track one
                    Dim CardData As String() = strInputBox.Split("^"c)
                    strState = CardData(0).Substring(1, 2)
                    strCity = CardData(0).Substring(3, CardData(0).Length - 3)
                    Dim strname As String() = CardData(1).Split("$"c)
                    strLastName = strname(0)
                    strFirstName = strname(1)
                    strMiddleName = strname(2)
                    strStreet = CardData(2)
                    Dim strzipcode As String() = CardData(3).Split("+"c)
                    strZIP = strzipcode(1).Substring(2, 5)

                End If

                If EqualPresent Then ' track two
                    Dim CardData As String() = strInputBox.Split("="c)
                    strDOB = CardData(1).Substring(6, 6)

                End If

this determines if the user scanned a barcode on back of the license这确定用户是否扫描了许可证背面的条形码

            ElseIf strInputBox.Contains("ANSI") Then

                Dim separatingStrings As String() = {"ANSI", "DBA", "DCS", "DAC", "DAD", "DBD", "DBB", "DBC", "DAY", "DAU", "DAG", "DAI", "DAJ", "DAK", "DAQ", "DCF", "DCG", "DDE", "DDF", "DDG", "DAZ", "DCI", "DCJ", "DCU", "DCE", "DDA", "DDB", "DAW", "DDK", "ZOZ", "ZOE"}
                Dim text As String = strInputBox
                Dim words As String() = text.Split(separatingStrings, System.StringSplitOptions.RemoveEmptyEntries)
                Dim i As Integer = 0

                For Each word In words
                    _log.Info("Looking at code: " & separatingStrings(i).ToString)
                    _log.Info("Parsing field: " & word.ToString.Trim)
                    strLastName = IIf(separatingStrings(i) = "DCS", word.ToString.Trim, strLastName)
                    strFirstName = IIf(separatingStrings(i) = "DAC", word.ToString.Trim, strFirstName)
                    strMiddleName = IIf(separatingStrings(i) = "DAD", word.ToString.Trim, strMiddleName)
                    strDOB = IIf(separatingStrings(i) = "DBB", word.ToString.Trim, strDOB)
                    strStreet = IIf(separatingStrings(i) = "DAG", word.ToString.Trim, strStreet)
                    strCity = IIf(separatingStrings(i) = "DAI", word.ToString.Trim, strCity)
                    strState = IIf(separatingStrings(i) = "DAJ", word.ToString.Trim, strState)
                    strZIP = IIf(separatingStrings(i) = "DAK", word.ToString.Trim, strZIP)
                    strDL = IIf(separatingStrings(i) = "DAQ", word.ToString.Trim, strDL)
                    strCountry = IIf(separatingStrings(i) = "DCG", word.ToString.Trim, strCountry)
                    i += 1
                Next

            Else
                MessageBox.Show("Incorrect format, contact us with this type of ID", "Scan Driver's License", MessageBoxButtons.OK, MessageBoxIcon.Stop)
                Return
            End If

Is there code encrypted code within the text line.文本行中是否有代码加密代码。

I know this is an old question, but maybe someone will still find this answer helpful.我知道这是一个老问题,但也许有人仍然会发现这个答案有帮助。

It appears, at least for Ohio, that the two letter license number prefix is represented by the ordinal number of the alphabet (A=01 .. Z=26).看起来,至少在俄亥俄州,两个字母的许可证号码前缀由字母表的序数表示(A=01 .. Z=26)。

So in the sample data ";6360231911247481" the "636023" is Ohio's ANSI Id prefix and "19" is the ordinal of the first letter ("S") and "11" is the ordinal of the second letter ("K"), with "247481" being the remaining numeric portion.所以在样本数据“;6360231911247481”中,“636023”是俄亥俄州的ANSI Id前缀,“19”是第一个字母(“S”)的序数,“11”是第二个字母(“K”)的序数,“247481”是剩余的数字部分。

So for this example, the full DL Number is "SK247481".因此,对于此示例,完整的 DL 编号为“SK247481”。

Note that this was determined from sample data and not a documented source, so ymmv.请注意,这是根据样本数据确定的,而不是记录在案的来源,因此 ymmv。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM