Mali.ZXing
8.0.41--date20241204-0106.git-8c7b4d5
dotnet add package Mali.ZXing --version 8.0.41--date20241204-0106.git-8c7b4d5
NuGet\Install-Package Mali.ZXing -Version 8.0.41--date20241204-0106.git-8c7b4d5
<PackageReference Include="Mali.ZXing" Version="8.0.41--date20241204-0106.git-8c7b4d5" />
paket add Mali.ZXing --version 8.0.41--date20241204-0106.git-8c7b4d5
#r "nuget: Mali.ZXing, 8.0.41--date20241204-0106.git-8c7b4d5"
// Install Mali.ZXing as a Cake Addin #addin nuget:?package=Mali.ZXing&version=8.0.41--date20241204-0106.git-8c7b4d5&prerelease // Install Mali.ZXing as a Cake Tool #tool nuget:?package=Mali.ZXing&version=8.0.41--date20241204-0106.git-8c7b4d5&prerelease
ZXing.Net.MAUI
The successor to ZXing.Net.Mobile: barcode scanning and generation for .NET MAUI applications
<img src="https://user-images.githubusercontent.com/271950/129272315-b3f5a468-c585-49f2-bbab-68a884618b94.png" width="300" />
Barcode Scanning
Install ZXing.Net.MAUI
Install ZXing.Net.MAUI NuGet package on your .NET MAUI application
Make sure to initialize the plugin first in your
MauiProgram.cs
, see below// Add the using to the top using ZXing.Net.Maui; // ... other code public static MauiApp Create() { var builder = MauiApp.CreateBuilder(); builder .UseMauiApp<App>() .UseBarcodeReader(); // Make sure to add this line return builder.Build(); }
Now we just need to add the right permissions to our app metadata. Find below how to do that for each platform.
Android
For Android go to your AndroidManifest.xml
file (under the Platforms\Android folder) and add the following permissions inside of the manifest
node:
<uses-permission android:name="android.permission.CAMERA" />
iOS
For iOS go to your info.plist
file (under the Platforms\iOS folder) and add the following permissions inside of the dict
node:
<key>NSCameraUsageDescription</key>
<string>This app uses barcode scanning to...</string>
Make sure that you enter a clear and valid reason for your app to access the camera. This description will be shown to the user.
Windows
Windows is not supported at this time for barcode scanning. You can however use the barcode generation. No extra permissions are required for that.
For more information on permissions, see the Microsoft Docs.
Using ZXing.Net.Maui
If you're using the controls from XAML, make sure to add the right XML namespace in the root of your file, e.g: xmlns:zxing="clr-namespace:ZXing.Net.Maui.Controls;assembly=ZXing.Net.MAUI"
<zxing:CameraBarcodeReaderView
x:Name="cameraBarcodeReaderView"
BarcodesDetected="BarcodesDetected" />
Configure Reader options
cameraBarcodeReaderView.Options = new BarcodeReaderOptions
{
Formats = BarcodeFormats.OneDimensional,
AutoRotate = true,
Multiple = true
};
Toggle Torch
cameraBarcodeReaderView.IsTorchOn = !cameraBarcodeReaderView.IsTorchOn;
Flip between Rear/Front cameras
cameraBarcodeReaderView.CameraLocation
= cameraBarcodeReaderView.CameraLocation == CameraLocation.Rear ? CameraLocation.Front : CameraLocation.Rear;
Handle detected barcode(s)
protected void BarcodesDetected(object sender, BarcodeDetectionEventArgs e)
{
foreach (var barcode in e.Results)
Console.WriteLine($"Barcodes: {barcode.Format} -> {barcode.Value}");
}
Barcode Generator View
<zxing:BarcodeGeneratorView
HeightRequest="100"
WidthRequest="100"
ForegroundColor="DarkBlue"
Value="https://dotnet.microsoft.com"
Format="QrCode"
Margin="3" />
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0-gtk3.24 is compatible. |
-
net8.0-gtk3.24
- Mali.Controls.Compatibility (>= 8.0.41--date20241204-0106.git-8c7b4d5)
- Mali.Controls.Core (>= 8.0.41--date20241204-0106.git-8c7b4d5)
- Mali.Controls.Xaml (>= 8.0.41--date20241204-0106.git-8c7b4d5)
- Mali.Core (>= 8.0.41--date20241204-0106.git-8c7b4d5)
- Mali.Essentials (>= 8.0.41--date20241204-0106.git-8c7b4d5)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.Hosting (>= 3.1.5)
- ZXing.Net (>= 0.16.8)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Mali.ZXing:
Package | Downloads |
---|---|
Mali.ZXing.Controls
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.0.41--date20241204-0106... | 87 | 12/4/2024 |
8.0.40--date20241203-0927... | 50 | 12/3/2024 |
8.0.40--date20241202-0216... | 39 | 12/2/2024 |
8.0.40--date20241202-0202... | 43 | 12/2/2024 |
8.0.40--date20241202-0138... | 47 | 12/2/2024 |
8.0.40--date20241202-0118... | 41 | 12/2/2024 |