Closed cvarjao closed 1 month ago
With some minor tweaks the react native vision library supports the 1D and 2D barcodes on BC Services card and drivers license. I was able to read the two barcodes on my driver's license without any issue. Here's the code I used:
const codeScannerExperimental = useCodeScanner({
codeTypes: ['qr', 'code-128', 'pdf-417'],
onCodeScanned: (val)=>{console.log(val)}
})
return (
<View style={[StyleSheet.absoluteFill, { transform: [{ rotate: orientationDegrees[orientation] ?? '0deg' }] }]}>
{device && (
<Camera
style={StyleSheet.absoluteFill}
device={device}
torch={torchActive ? 'on' : 'off'}
isActive={cameraActive}
codeScanner={codeScannerExperimental}
format={format}
/>
)}
</View>
Description
Notes:
There are two barcodes on the BC Services Card (same as on the BC DL). The serial number is a 1-D barcode on the right hand side of the back. While the 2D barcode is on the bottom side of the back. See this sample DL: https://images.ctfassets.net/nnc41duedoho/7za52YKEvPiRnuoArZz07B/d76195920ba339c03c2be814f5442090/DL-sample.jpg? The 1-D barcode is pretty straightforward and translates to raw text. Any barcode scan library will give you something like the type of barcode and the raw text.
The 2-D barcode is more complicated, and may contain more information than needed. By complicated, I mean that it's a PDF417 barcode, but doesn't follow the AAMVA standard for BC issued identity docs. The barcode for BC issued documents actually contains text in the same format as the magstripe.
APD has some server side code that converts both types of PDF417 barcodes into a "canonical" format for our needs In my opinion, our priority is the 1-D barcode for current capabilities, but the stretch goal is to extract both barcodes at the same time from the same frame (same UI interaction for the user). We can deal with the raw barcode text on the backend.
For test and sample IDs, you don't need to make any API calls yet, and you can generate as many as you need using tools like https://barcode.tec-it.com/en
Here's a sample of the PDF417 for BC docs (line breaks for readability):
That same site that I list above can generate the 1D serial number barcodes. The serial numbers are currently 9 characters. 1 alpha followed by 8 digits. Like T00252783.