We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to capture and scan the Barcode in Xamarin.Forms.

Platform: Xamarin.Forms |
Control: PDF
Tags: pdf

ZXing (zebra crossing) is an open-source tool to decode barcodes. It allows users to scan most of the 1D and 2D barcodes, including QR and DataMatrix Barcodes.



Barcode image in android


Getting Started


ZXing.Net Mobile is available for Xamarin applications as both a component and a NuGet package that can be installed in iOS, Android and Windows projects. Need to add the package or Nuget to all of the projects in Xamarin applications to get started.


Please find the following steps:


1. Right click the project and select Manage NuGet Packages.

2. Browse packages from source(“https://www.nuget.org/api/v2”) and add the ZXing.Net.Mobile packages in all of the projects in Xamarin applications.



Create a Scanner Page


ZXing.Net.Mobile is a C#/.NET library based on the open source Barcode Library: ZXing (Zebra Crossing). It works with Xamarin.iOS, Xamarin.Android and Windows Universal. The goal of ZXing.Net.Mobile is to make scanning barcodes in our own Xamarin application.


Create a new ZXingScannerPage and then push the page onto the navigation stack using below code snippet,

ZXingScannerPage scanPage = new ZXingScannerPage ();
await Navigation.PushAsync (scanPage);



Validating Output


The text and type of the Barcode can be displayed when the OnScanResult event is fired using below code snippet,

scanPage.OnScanResult += (result) => 
         scanPage.IsScanning = false;
         ZXing.BarcodeFormat barcodeFormat = result.BarcodeFormat;
         string type = barcodeFormat.ToString();
         Device.BeginInvokeOnMainThread(() => 
                    DisplayAlert("The Barcode type is : " + type, "The text is : " + result.Text, "OK");


Please find the sample from the below link,



2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
You must log in to leave a comment
Pedro Hernández
Oct 31, 2019

Dear Syncfusion team

Had you test this in a new version of Xamarin Forms 4.xxx

Thanks in advanced


Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile