-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZXing.Net.Maui doesn't seem to be able scan more complicated PDF417 barcodes #174
Comments
Add .ConfigureMauiHandlers(h => 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
<#174 (comment)>,
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 |
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:
The text was updated successfully, but these errors were encountered: