Barcode Generation?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Barcode Generation?
Hi all,
Can LC either natively or by other means (widget or plugin maybe?) generate a readable/scannable barcode? Likely symbologies that will be used are EAN and Code 128 (there might be others). I know there are fonts out there that can do it but it's been my experience that while you can type various characters in the associated barcode font, it's often not readable/scannable with a barcode reader.
The barcodes would be part of an app that would only be used on Windows desktop PC's and no mobile devices.
Any help is appreciated.
Thank you so much,
Jon
Can LC either natively or by other means (widget or plugin maybe?) generate a readable/scannable barcode? Likely symbologies that will be used are EAN and Code 128 (there might be others). I know there are fonts out there that can do it but it's been my experience that while you can type various characters in the associated barcode font, it's often not readable/scannable with a barcode reader.
The barcodes would be part of an app that would only be used on Windows desktop PC's and no mobile devices.
Any help is appreciated.
Thank you so much,
Jon
Re: Barcode Generation?
There are online barcode and QR code generators that are pretty simple to use. Without doubt, someone with some LC nous could run something that could go to the site, enter the details and kick it back to LC. Just search Free Online Barcode Generator to see what's out there.
Otherwise, I reckon within a day you should be able to generate a barcode creator in LC using the same concept as the fonts. Just need to set up a series of images at the same scale as you want, and place them side by side. The barcode section for each number is just binary black-or-white stripes, 7 sections long. Set up for each number 0-9, named Nr1, Nr2, etc. or whatever, then run a script like:
Something along those lines should copy an image from a predefined set and then line them up. Output could come from snapshot of defined area. The readability would come down to size etc. that could easily be tested in real life. A little research into standard sizes, lengths of inputs, packing etc. could fill in any blanks necessary to make it readable.
XdM
Otherwise, I reckon within a day you should be able to generate a barcode creator in LC using the same concept as the fonts. Just need to set up a series of images at the same scale as you want, and place them side by side. The barcode section for each number is just binary black-or-white stripes, 7 sections long. Set up for each number 0-9, named Nr1, Nr2, etc. or whatever, then run a script like:
Code: Select all
on mouseup
put "20" into tLeftJustification
put the number of characters of field "input" into tNumber
repeat with x=1 to tNumber
if character x of field "input"= "0" then
copy img "Nr0" --don't quote me on that, I haven't tried this or tested it... conceptually speaking... copy the existing image
--repeat this process for 1 and Nr1, 2 and Nr2, etc. to 9
end if
set the left of last img to tLeftJustification
set the top of last image to "10"
add 14 to tLeftJustification --if each bar section is 2 pixels wide
end repeat
end mouseup
XdM
- Attachments
-
- barcodestripes.gif (10.19 KiB) Viewed 8956 times
Re: Barcode Generation?
Hi Jon,
check QRCREATE in the dictionary!
Best
Klaus
check QRCREATE in the dictionary!

Best
Klaus
Re: Barcode Generation?
Hello Jon,
on Windows or linux try the command line /shell tool "barcode_gen".
Use it with the Livecode shell() function.
It's free and open source under either of Apache License, Version 2.0 or MIT license.
Supported barcode types are: EAN13, EAN8, CODE39, CODE93, CODE11, CODE128, CODABAR, ITF (2 of 5 Interleaved), STF (2 of 5 Standard).
Supported output formats are: PNG, GIF, SVG
Link: https://github.com/revilo/barcode_gen
Best
Günter
on Windows or linux try the command line /shell tool "barcode_gen".
Use it with the Livecode shell() function.
It's free and open source under either of Apache License, Version 2.0 or MIT license.
Supported barcode types are: EAN13, EAN8, CODE39, CODE93, CODE11, CODE128, CODABAR, ITF (2 of 5 Interleaved), STF (2 of 5 Standard).
Supported output formats are: PNG, GIF, SVG
Link: https://github.com/revilo/barcode_gen
Best
Günter
Re: Barcode Generation?
Hi Günter,grzkmo wrote: ↑Tue Dec 21, 2021 4:16 pmHello Jon,
on Windows or linux try the command line /shell tool "barcode_gen".
Use it with the Livecode shell() function.
It's free and open source under either of Apache License, Version 2.0 or MIT license.
Supported barcode types are: EAN13, EAN8, CODE39, CODE93, CODE11, CODE128, CODABAR, ITF (2 of 5 Interleaved), STF (2 of 5 Standard).
Supported output formats are: PNG, GIF, SVG
Link: https://github.com/revilo/barcode_gen
Best
Günter
I will look into your suggestion but I don't have much experience with doing command line or shell stuff in LC. I'm sure it's not difficult, but the only thing I've done with command line/shell stuff is pinging a server.
Best regards,
Jon
Re: Barcode Generation?
You could install a free BARCODE font (e.g. https://fonts.google.com/specimen/Libre ... ard-styles)
and create a snapshot of your generated barcode, if you need an image for this.
and create a snapshot of your generated barcode, if you need an image for this.
Re: Barcode Generation?
Hi Klaus,
I will revisit using a barcode font but it's been my experience that while one can type characters using the associated barcode font, the barcode isn't readable/scannable with a barcode reader. I don't know, maybe the barcode fonts have gotten better. Hopefully this is the case as that will make things much easier.
Best regards,
Jon
I will revisit using a barcode font but it's been my experience that while one can type characters using the associated barcode font, the barcode isn't readable/scannable with a barcode reader. I don't know, maybe the barcode fonts have gotten better. Hopefully this is the case as that will make things much easier.
Best regards,
Jon

Re: Barcode Generation?
I have been producing scannable and readable barcodes from barcode fonts already 10 years ago!
As I said I created a snapshot from a field with not too small font size and everything was fine!

As I said I created a snapshot from a field with not too small font size and everything was fine!
Re: Barcode Generation?
Hi Klaus,
That's very encouraging and I am very happy to hear that. I will definitely revisit this!!
Thank you so much,
Jon
That's very encouraging and I am very happy to hear that. I will definitely revisit this!!
Thank you so much,
Jon
Re: Barcode Generation?
Hi Klaus,
So far, I'm not having any luck getting a code 128 barcode to scan/read using a font.
For comparison, I went to the following website: https://barcode.tec-it.com/en/Code128?data=1234567890
The barcode generated on that site reads/scans immediately but when I type the same string of characters using any one of several code 128 barcode fonts I found online, none of them will scan/read (not to mention, they visually don't match the barcode generated on the tec-it website).
What am I missing?
Best regards,
Jon
So far, I'm not having any luck getting a code 128 barcode to scan/read using a font.
For comparison, I went to the following website: https://barcode.tec-it.com/en/Code128?data=1234567890
The barcode generated on that site reads/scans immediately but when I type the same string of characters using any one of several code 128 barcode fonts I found online, none of them will scan/read (not to mention, they visually don't match the barcode generated on the tec-it website).
What am I missing?
Best regards,
Jon
Re: Barcode Generation?
I use that website too...
Type in "1" and get a code, then type in "12" and get a code, and you will notice that the length of the code is the same, but the centre changes... so there is "padding". In the case of a 128, there is a start code that tells the reader what character set to use (CODE A, B or C), there is an added digit after the end of the coded characters that is a 'check digit' made up of a function of other digits (start character value + character 1 value x 1, char 2 value x 2, etc. / 103 and work out remainder (0-102)), then a stop code at the end. This validates the barcode and makes it readable. 128 uses a (modulo 103) check digit and a short start and end section. Some also need quiet zones (10x modules) at the start and synchronising bars at the start, middle and end. There's a pdf on the tec-it website that goes into depth about how to generate the barcode.
If you're having trouble reading it, it's probably because you are missing a bit of the code.
Consider it like this: If I want to encode 12456, I would need the following: (code type)123456(check digit= start code +1*1+2*2+3*3+4*4+5*5+6*6 mod 103)(stop), not jut 123456.
Hope that helps.
XdM
Type in "1" and get a code, then type in "12" and get a code, and you will notice that the length of the code is the same, but the centre changes... so there is "padding". In the case of a 128, there is a start code that tells the reader what character set to use (CODE A, B or C), there is an added digit after the end of the coded characters that is a 'check digit' made up of a function of other digits (start character value + character 1 value x 1, char 2 value x 2, etc. / 103 and work out remainder (0-102)), then a stop code at the end. This validates the barcode and makes it readable. 128 uses a (modulo 103) check digit and a short start and end section. Some also need quiet zones (10x modules) at the start and synchronising bars at the start, middle and end. There's a pdf on the tec-it website that goes into depth about how to generate the barcode.
If you're having trouble reading it, it's probably because you are missing a bit of the code.
Consider it like this: If I want to encode 12456, I would need the following: (code type)123456(check digit= start code +1*1+2*2+3*3+4*4+5*5+6*6 mod 103)(stop), not jut 123456.
Hope that helps.
XdM
-
- Posts: 738
- Joined: Thu Sep 11, 2014 1:49 pm
Re: Barcode Generation?
Maybe take a look at sQuiRt http://splash21.com/sQuiRt.php
The sQuiRt library for LiveCode generates QR codes according to the ISO international standard (ISO/IEC18004).
As this library is 100% LiveCode, it is suitable for Mac, Windows, Linux, Mobile and LiveCode server platforms.
Added a demo stack with the sQuiRt library included as a substack.
Regards,
Paul
The sQuiRt library for LiveCode generates QR codes according to the ISO international standard (ISO/IEC18004).
As this library is 100% LiveCode, it is suitable for Mac, Windows, Linux, Mobile and LiveCode server platforms.
Added a demo stack with the sQuiRt library included as a substack.
Regards,
Paul
Re: Barcode Generation?
That's pretty cool, thank Paul