LEADTOOLS Support
General
LEADTOOLS SDK Examples
HOW TO: Extract the Data from a PDF417 AAMVA Barcode using Xamarin
#1
Posted
:
Friday, January 10, 2020 5:47:17 PM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 105
Was thanked: 3 time(s) in 3 post(s)
Attached is a simple Xamarin.Forms application that shows how to parse the data in a PDF417 barcode that meets the AAMVA specification.
Here are the relevant code snippets:
Code:
<StackLayout>
<leadtools:CameraView x:Name="leadCamera" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></leadtools:CameraView>
<Button x:Name="liveCapture" Text="Start Live Capture" Clicked="liveCapture_Clicked"/>
</StackLayout>
Code:
private void liveCapture_Clicked(object sender, EventArgs e)
{
leadCamera.FrameReceived += LeadCamera_FrameReceived;
leadCamera.Camera.FocusMode = FocusMode.Continuous;
leadCamera.Camera.CaptureQuality = CaptureQuality.High;
}
Code:
private void LeadCamera_FrameReceived(FrameHandlerEventArgs e)
{
var data = barcodeEngine.Reader.ReadBarcode(e.Image, LeadRect.Empty, BarcodeSymbology.PDF417);
if (e.Image != null && data.Value != null)
{
if (data.Symbology == BarcodeSymbology.PDF417)
{
AAMVAID id = BarcodeData.ParseAAMVAData(data.GetData(), false);
if (id != null)
{
leadCamera.FrameReceived -= LeadCamera_FrameReceived;
Device.BeginInvokeOnMainThread(() =>
{
DisplayAlert("AAMVA PDF417 Barcode Found!",
$"Issuer Identification Number: {id.IssuerIdentificationNumber}\n" +
$"First Name {id.FirstName.Value}\n" +
$"Last Name {id.LastName.Value}\n" +
$"Over 21? {id.Over21}"
, "OK");
});
}
}
}
}
Do Note: This particular sample application is written specifically for Android devices in Xamarin.Forms.
Edited by user Thursday, February 13, 2020 9:43:58 AM(UTC)
| Reason: Not specified
Matt Bresson
Developer Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
General
LEADTOOLS SDK Examples
HOW TO: Extract the Data from a PDF417 AAMVA Barcode using Xamarin
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.