B4J Tutorial Barcodes - QR Codes, PDF417, Aztec Codes, Code11, Code39, Code93, EAN8, EAN13, and Code128

This is my first attempt at B4J. Have not tried to do anything special to the layout etc. The aim was to get back the correct binary strings to draw Code11, Code39, Code93, EAN8 and EAN13 barcodes with. All the code are in the main module as well as modules for each of the types of barcodes. The B4J project also includes a class called StringUtilities that the project makes use of. This class contains 38 string manipulation methods making use of inline java code.

Each of the barcode modules return a binary string (1's and 0's). You need to draw an equal sized bar (width and height) for each 1 (black) and for each 0 (white). For eg, 11 will be two black bars next to one another, 10 will be a black bar followed by a white bar, 00 will be two consecutive white bars, and 01 will be a white bar followed by a black bar.

The barcodes generated for EAN8 and EAN13 includes the parity bits - take note that the label next to them only shows the original input message for EAN8 and EAN13 barcodes. You can amend the code in the B4J project to your own liking and for eg return an array of strings that contains for eg (1) the binary string of the input message and (2) the parity bit/number for EAN8 or EAN13 barcodes. Very simple to do and I leave it up to whoever wants to use this project.

Have not fully amended the error checking for valid input messages. Simple to do and I leave it up to whoever wants to use this B4J project.

This project is based on my B4A project that you can find here. Just busy amending it so that it can be used in B4J. Have tested/scanned each of Code11, Code39, Code93, EAN8 and EAN13 with QRCPV4 that you can find here.

I will add Code128, Aztec Codes, PDF417, and QR Codes (as what I have inside the B4A project) as and when time permits.

No internet connection is required to generate the barcodes - all the code are in the code modules.

Edit: see project in post #9. It generates QRCodes, PDF417, Aztec Codes, Code11, Code39, Code93, EAN8, EAN13, and Code128

1.png
 

Attachments

  • BARCODES.zip
    181.9 KB · Views: 1,255
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
how to save the qrcode to file?
You wil have to add the necessary code to the Code Modules to save it. Browse the B4J forum to see how to do it. There should be examples somewhere in the forum.
 

serro efe

Member
Licensed User
Longtime User
The attached project adds QR Codes (Version 1 to Version 40) to the barcodes already posted in the previous projects. Use something like NeoReader or this to scan the QR Codes with.

I will try and spend a bit of additional time on it to redo the drawing of the 1D barcodes by adding their code back into the various code modules. Will also add the possibility to change the fore color and back color of the barcodes as well as the size of the bars in the 1D barcodes and the modules in the 2D codes.

(Can I say that I am reasonably proud of my very first B4J project...:cool:. There are 10 380 lines of code in the code modules to generate these barcodes with)

View attachment 36826

Hello @Johan Schoeman
I am trying to apply the above example.
I am getting such an error code. Could you help me with the solution.
B4J Versiyon: 6.01
Ayrıştırma kodu. (0.29s)
Kod derleniyor. (0.81s)
Layout kodlarını derleme. (0.01s)
Kütüphaneleri organize etmek. (0.00s)
Oluşturulan Java kodunu derleme. (4.88s)
Hata ayıklayıcı motor kodunu derleme Error
B4J line: 1490
End Sub
javac 1.8.0_152
shell\src\b4j\example\azteccode_subs_0.java:3642: error: code too large for try statement
catch (Exception e) {
^
1 error
 

serro efe

Member
Licensed User
Longtime User
I compiled the project as a library with b4j. I created two files called barcode.xml and barcode.jar. I left these files in the library folder. When I create a new project, I see barcode (version: 1.00) in the library list, but I can not add it to the project. How do I track it so I can use it?
 

Johan Schoeman

Expert
Licensed User
Longtime User

syerif

Active Member
Licensed User
Longtime User
This is my first attempt at B4J. Have not tried to do anything special to the layout etc. The aim was to get back the correct binary strings to draw Code11, Code39, Code93, EAN8 and EAN13 barcodes with. All the code are in the main module as well as modules for each of the types of barcodes. The B4J project also includes a class called StringUtilities that the project makes use of. This class contains 38 string manipulation methods making use of inline java code.

Each of the barcode modules return a binary string (1's and 0's). You need to draw an equal sized bar (width and height) for each 1 (black) and for each 0 (white). For eg, 11 will be two black bars next to one another, 10 will be a black bar followed by a white bar, 00 will be two consecutive white bars, and 01 will be a white bar followed by a black bar.

The barcodes generated for EAN8 and EAN13 includes the parity bits - take note that the label next to them only shows the original input message for EAN8 and EAN13 barcodes. You can amend the code in the B4J project to your own liking and for eg return an array of strings that contains for eg (1) the binary string of the input message and (2) the parity bit/number for EAN8 or EAN13 barcodes. Very simple to do and I leave it up to whoever wants to use this project.

Have not fully amended the error checking for valid input messages. Simple to do and I leave it up to whoever wants to use this B4J project.

This project is based on my B4A project that you can find here. Just busy amending it so that it can be used in B4J. Have tested/scanned each of Code11, Code39, Code93, EAN8 and EAN13 with QRCPV4 that you can find here.

I will add Code128, Aztec Codes, PDF417, and QR Codes (as what I have inside the B4A project) as and when time permits.

No internet connection is required to generate the barcodes - all the code are in the code modules.

Edit: see project in post #9. It generates QRCodes, PDF417, Aztec Codes, Code11, Code39, Code93, EAN8, EAN13, and Code128

View attachment 36644
Hi,
Is there any sample with itf format please?

Best regards
 
Top