B4A Library [B4X] [B4XPages] Dynamsoft Barcode Reader - Cross-Platform Barcode/QR Code Scanning Library

Dynamsoft Barcode Reader is a barcode reading SDK written in C++ and has Java/Objective-C packages, so it is possible to wrap it as a B4X library using JavaObject and NativeObject.

It is a commercial SDK that has good performance and customizability.

The current version is very basic. I only wrapped the basic decode method and a TextResult class (storing the barcode content and localization results).

The library is made for B4A, B4i and B4J.

How to use:

1. Initialize

B4X:
Sub Class_Globals
    Private reader As DBR
End Sub
Private Sub init
    reader.Initialize("license")
    'request your license here: https://www.dynamsoft.com/customer/license/trialLicense?ver=latest
End Sub

2. Read barcodes from an image

B4X:
Private Sub Decode(bm as B4XBitmap)
    Dim results As List=reader.decodeImage(bm)
    Dim sb As StringBuilder
    sb.Initialize
    For Each result As TextResult In results
        sb.Append("Text: ").Append(result.Text).Append(CRLF)
    Next
    Log(sb.ToString)
End Sub


Additional libraries are required:

1. Download the jar/aar/framework files from its website.
2. Use AdditionalLib/AdditionalJar to reference dependant libraries.

For B4A:

B4X:
#AdditionalJar: DynamsoftBarcodeReader-9.2.10.aar

For B4i:

B4X:
#AdditionalLib: DynamsoftBarcodeReader.framework.3
#AdditionalLib: libc++.tbd

For B4J:

B4X:
#AdditionalJar: dynamsoft-barcodereader-9.4.0


I've created a demo using B4XPages and packaged a b4xlib. You can find the source code here: https://github.com/tony-xlh/BarcodeReader-B4X

The b4xlib is attatched.


b4j.jpg


v1.1.0 2022/10/12

Update Dynamsoft Barcode Reader to 9.x.

v1.0 2021/05/14
Released
 

Attachments

  • DynamsoftBarcodeReader.b4xlib
    3.6 KB · Views: 319
Last edited:

xulihang

Active Member
Licensed User
Longtime User
Screenshot_2021-05-14-15-18-34-1.png


A live barcode scanner is made based on this example: [B4X] [B4XPages] Barcode Reader. LLCamera is used in iOS to provide camera preview.

Update (2022/10/12): Update the library to 1.1.0

Update (2021/05/14): Added the B4J version which uses B4JVlc to utilize Web Cameras

desktop.jpg
 

Attachments

  • LiveScanner.zip
    179.7 KB · Views: 271
Last edited:

xulihang

Active Member
Licensed User
Longtime User
Is it easy to add PDF417? Because there is currently no possibility in B4I.

Here is the supported symbologies list from the website. PDF417 is supported.

Linear Barcodes (1D):
  • Code 11
  • Code 39 (including Code 39 Extended)
  • Code 93
  • Code 128
  • Codabar
  • Interleaved 2 of 5
  • EAN-8
  • EAN-13
  • UPC-A
  • UPC-E
  • Industrial 2 of 5
  • MSI
  • PharmaCode
2D Barcodes:
  • QR Code (including Micro QR Code and Model 1)
  • Data Matrix
  • PDF417 (including Micro PDF417)
  • Aztec Code
  • MaxiCode (mode 2-5)
  • DotCode
Patch Code
GS1 Composite Code
GS1 DataBar
Postal Codes
 
Last edited:

AnandGupta

Expert
Licensed User
Longtime User
Thanks @xulihang for the tutorial.

Your tutorial further gave me understanding of creating wrapper from Java code for B4X. 👍
 
Hello Xulihang, nice project!

I´m trying to run but apparently the .aar java was changed, I got this error in the last version. Do you have the old DynamsoftBarcodeReaderAndroid.aar ?

1663076876308.png

tks,

Leandro
 

xulihang

Active Member
Licensed User
Longtime User
Hello Xulihang, nice project!

I´m trying to run but apparently the .aar java was changed, I got this error in the last version. Do you have the old DynamsoftBarcodeReaderAndroid.aar?

The old version should be 8.2.0 which you can download from Dynamsoft's website. By the way, I am going to update the wrapper to use Dynamsoft Barcode Reader 9.4.
 
Top