Open gtvracer opened 3 months ago
Add
.ConfigureMauiHandlers(h => { h.AddHandler(typeof(CameraBarcodeReaderView),typeof(CameraBarcodeReaderViewHandler)); h.AddHandler(typeof(CameraView), typeof(CameraViewHandler)); h.AddHandler(typeof(BarcodeGeneratorView), typeof(BarcodeGeneratorViewHandler)); });
To MauiProgram.cs
Hi Chuck,
I did as you suggested, captured an image using MediaPicker.CapturePhotoAsync() and fed into the parsing code as below. It returns a null result for that image attached.
// code BarcodeReader reader = new BarcodeReader { AutoRotate = true,
Options = new DecodingOptions {
TryHarder = true,
PossibleFormats = new List<BarcodeFormat> { BarcodeFormat.PDF_417 }
}
}; // load a bitmap try { SKBitmap originalBitmap = SKBitmap.Decode(photoPath); // detect and decode the barcode inside the bitmap var result = reader.Decode(originalBitmap); // do something with the result if (result != null) { App.Log("Succeeded in parsing barcode"); App.Log(result.BarcodeFormat.ToString()); App.Log(result.Text); } else App.Log("Failed to parse barcode"); } catch (Exception ex) { App.Log($"ParseScannedImage exception:{ex.Message}"); } // end code
[image: pdf417-1.PNG]
On Mon, Apr 8, 2024 at 7:57 AM Chuck Giddens @.***> wrote:
Add
.ConfigureMauiHandlers(h => {
h.AddHandler(typeof(CameraBarcodeReaderView),typeof(CameraBarcodeReaderViewHandler)); h.AddHandler(typeof(CameraView), typeof(CameraViewHandler)); h.AddHandler(typeof(BarcodeGeneratorView), typeof(BarcodeGeneratorViewHandler)); });
To MauiProgram.cs
— Reply to this email directly, view it on GitHub https://github.com/Redth/ZXing.Net.Maui/issues/174#issuecomment-2042983435, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACDPXLROXK7UVGGJQOJP333Y4KV5FAVCNFSM6AAAAABEYHQZWSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBSHE4DGNBTGU . You are receiving this because you authored the thread.Message ID: @.***>
I'm encountering the same issue. The camera won't pick up anything. When I attempt to feed a high res image into the decoder directly, I get null
back.
Using ZXing.Net.Maui.Controls v0.4.0 and the basic ZXing page, and configuration, it can detect simple PDF417, but it fails to detect more complex ones, like the one on the back of a California drivers license. It also doesn't keep the torch on either, but flashes once when the page initializes. I've tried the barcode images samples on the internet by searching for "PDF417 images", only the simple ones are read....
The Xamarin version of ZXing is able to read the CA drivers license barcode, fyi..
I'm using Visual Studio v17.9.2, XCode 15.3 and .net8.
Any insight will be appreciated. Thanks!
Page:
Code behind:
MauiProgram.cs: