Forum Xamarin Xamarin.Forms

Can anyone recommend an alternative to Zxing?

We have a feature request to scan distant QR codes (printed on full A4 paper). In the iOS camera app, this is possible when you 'pinch-to-zoom'. However, zooming does not seem to be available with Zxing, (and distant focusing is not working well either).

FWIW, I'm fairly new to Xamarin development. It is a Xamarin forms application supporting only iOS at this time.


  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭
    Zxing is for free. There are other product, but are not for free
  • XamarinoobXamarinoob Member ✭✭

    Cost is not really an issue - at this point we need to let the client know what costs are to be expected.

    Can you please share the other products?

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭
    I know Scandit
    But I think you can easily find something with google

    Otherwise you can use external barcode readers
  • parzivalmxparzivalmx Member ✭✭

    You can create a custom iOS render for the camera add bar-code scanning features and customize the camera details. Using the native methods.

    metadataOutput = new AVCaptureMetadataOutput();
                        var metadataDelegate = new BarcodeScannedOutputDelegate();
                        metadataOutput.SetDelegate(metadataDelegate, DispatchQueue.MainQueue);
                        // Specify barcode types, I2of5 & QRCode
                        metadataOutput.MetadataObjectTypes = AVMetadataObjectType.Interleaved2of5Code | AVMetadataObjectType.QRCode | AVMetadataObjectType.Code128Code;
                        // Create Preview Layer, this can be customized further later
                        AVCaptureVideoPreviewLayer previewLayer = new AVCaptureVideoPreviewLayer(session);
                        previewLayer.Frame = new RectangleF(0, 0, (int)UIScreen.MainScreen.Bounds.Width, 400);
  • LEAD_SupportLEAD_Support USMember ✭✭

    The LEADTOOLS Xamarin SDK has barcode recognition, image processing, and a Xamarin Forms camera control that you can use to interact with your device’s camera and recognize the QR code. (Disclaimer: I am an employee of this toolkit’s vendor).

    Check out our blog here for an overview of the control and how it can be configured to read barcodes in your app:

    In this example, after the image is taken it is passed to the event handler assigned to leadCamera.PictureReceived where the image will be contained in the event argument (e.Image) which can then be processed and used in the handler:

    private void LeadCamera_PictureReceived(FrameHandlerEventArgs e)
       RasterImage img = YourImageProcessingFunction(e.Image);

    If you are interested in checking this out, you can find a free evaluation here:

  • AdamMeaneyAdamMeaney USMember ✭✭✭✭✭

    I will say that I doubt you will get great scanning on a zoom from far away.

    But you can always pull down the ZXing source and make it have Zoom. Their code isn't too complex to edit.

    If the barcodes are large I can see it working, but if there are several together on the page or they are very dense, it takes a pretty high resolution shot to get things even a foot away.

  • XamarinoobXamarinoob Member ✭✭

    I was quite confused as to why zooming - which is a digital zoom - actually made a different in the native iOS camera app. Because there is no optical zoom, the camera captures what it captures. 'Pinch-to-zoom' functionality really just digitally enlarges the camera image - it doesn't actually zoom.

    I realized this is working on the native app, because it is built in behavior. If a QR code exists within the camera frame, but is not taking up a large portion of the screen, the camera purposely doesn't scan it. This is so if you are taking a larger framed picture, if a random QR code (from a billboard or sign or something) just happens to be in frame, it doesn't change the purpose of the camera from photography to scanning.

    Instead, the QR needs to take up a certain percentage of the screen, so the camera app is sure that you're trying to scan, not take a picture. This is why 'pinch to zoom' makes it work. It doesn't zoom, it just tells the application that you're trying to scan based on your behavior (walking closer to the QR code to make it fill the frame works the exact same way).

    So, in the end, I realized that it wasn't the zoom functionality that I was trying to make work. The problem was that Xing just outright refuses to focus at a distance. I'm not sure why this is. We've tried repeatedly to change the resolution, use AutoFocus() methods, and even created timed intervals in which the camera is supposed to try and refocus. But it just refuses to focus at a distance.

    The best luck we've had has been when we first load the camera - it's nice a clear, focused at a distance. But almost immediately, it adjusts to try and look for something close up, even if I'm pointing the camera outside, upward at a tree far away. It doesn't care, it just assumes it needs to focus close.

    It has been exceedingly frustrating.

Sign In or Register to comment.