EAN-8 Barcode generator

HMG Samples and Enhancements

Moderator: Rathinagiri

User avatar
Rathinagiri
Posts: 5351
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 211 times
Been thanked: 232 times
Contact:

Re: EAN-8 Barcode generator

Post by Rathinagiri »

Or we should use HMG_LEN() function instead of len()
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
quartz565
Posts: 609
Joined: Mon Oct 01, 2012 12:37 pm
Location: Thessaloniki, Greece
Has thanked: 227 times
Been thanked: 25 times
Contact:

Post by quartz565 »

Thank you for sharing Rathi,
very nice work !!

Hi Daniel, '96385074' it works fine for me.
Nikos
Best Regards,
Nikos.

os: Windows Server 2012 - 64
hw: HP Server E5606, 2.13GHz, 8.00 GB - Intel Xeon CPU

User avatar
esgici
Posts: 4539
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 410 times
Been thanked: 118 times
Contact:

Post by esgici »

quartz565 wrote: '96385074' it works fine for me.
For me too; '9638507" and '9638507 " too.

Mol, already ALLTRIM'med.

Code: Select all

   cCode := alltrim( cCode ) // line 124
Viva INTERNATIONAL HMG :D

User avatar
Rathinagiri
Posts: 5351
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 211 times
Been thanked: 232 times
Contact:

Post by Rathinagiri »

This is the second version.

1. Added an option to show/hide the digits in the barcode.
2. Separated ean8 encoding code into a separate prg so that it can be added to any project and called with a function. Or we can create a library. (If Marek makes his code into a library for EAN-13 like this it will be great.)
3. Added Esgici's suggestion.
4. Made the default line width to 2 and line height to 110 for making the barcode visible and sizable.
barean8.zip
(2.57 KiB) Downloaded 237 times
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
esgici
Posts: 4539
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 410 times
Been thanked: 118 times
Contact:

Post by esgici »

Rathinagiri wrote:This is the second version.

1. Added an option to show/hide the digits in the barcode.
2. Separated ean8 encoding code into a separate prg so that it can be added to any project and called with a function. Or we can create a library. (If Marek makes his code into a library for EAN-13 like this it will be great.)
3. Added Esgici's suggestion.
4. Made the default line width to 2 and line height to 110 for making the barcode visible and sizable.
barean8.zip
Superb !

Thanks :)

Viva HMG :D
Viva INTERNATIONAL HMG :D

User avatar
esgici
Posts: 4539
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 410 times
Been thanked: 118 times
Contact:

Post by esgici »

Rathinagiri wrote:This is the second version...]
Hi Rathi

After "Invalid Code" and "Invalid check sum", createbarcode() function open last produced barcode image (barcode.png).

To avoid this, my humble suggestion is :

When "Invalid Code" or "Invalid check sum" situations occurs, ean8_barcode() functions returns .f., ( line 56 and 74 of ean8.prg )
else return .t. (last line (115) )

and createbarcode() function will be like this :

Code: Select all

function createbarcode
   local cImage := 'barcode.png'
   if ean8_barcode( barcode.code.value, cImage, barcode.linewidth.value, barcode.lineheight.value, barcode.showdigits.value )
      if file( cImage )
         open file cImage
      endif   
   endif
   return nil
Best regards
Viva INTERNATIONAL HMG :D

User avatar
Rathinagiri
Posts: 5351
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 211 times
Been thanked: 232 times
Contact:

Post by Rathinagiri »

Yes. That is right. Thank you Esgici.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
mol
Posts: 3434
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 277 times
Been thanked: 176 times
Contact:

Post by mol »

Rathinagiri wrote:This is the second version.

1. Added an option to show/hide the digits in the barcode.
2. Separated ean8 encoding code into a separate prg so that it can be added to any project and called with a function. Or we can create a library. (If Marek makes his code into a library for EAN-13 like this it will be great.)
3. Added Esgici's suggestion.
4. Made the default line width to 2 and line height to 110 for making the barcode visible and sizable.
barean8.zip
OK, I'll do it!

User avatar
Rathinagiri
Posts: 5351
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 211 times
Been thanked: 232 times
Contact:

Post by Rathinagiri »

Thanks Marek.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

Post Reply