Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Friday, January 10, 2020 5:47:17 PM(UTC)
Matthew Bresson

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.

File Attachment(s):
AAMVAIDXamDemo.zip (1,776kb) downloaded 66 time(s).

Edited by user Thursday, February 13, 2020 9:43:58 AM(UTC)  | Reason: Not specified

Matt Bresson
Developer Support Engineer
LEAD Technologies, Inc.
LEADTOOLS
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.048 seconds.