Page 2 of 2

Re: EAN-8 Barcode generator

Posted: Thu Jul 18, 2013 7:24 am
by Rathinagiri
Or we should use HMG_LEN() function instead of len()

Re: EAN-8 Barcode generator

Posted: Thu Jul 18, 2013 11:07 am
by quartz565
Thank you for sharing Rathi,
very nice work !!

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

Re: EAN-8 Barcode generator

Posted: Thu Jul 18, 2013 11:18 am
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

Re: EAN-8 Barcode generator

Posted: Thu Jul 18, 2013 1:42 pm
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 331 times

Re: EAN-8 Barcode generator

Posted: Thu Jul 18, 2013 1:57 pm
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

Re: EAN-8 Barcode generator

Posted: Thu Jul 18, 2013 8:16 pm
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

Re: EAN-8 Barcode generator

Posted: Fri Jul 19, 2013 2:30 am
by Rathinagiri
Yes. That is right. Thank you Esgici.

Re: EAN-8 Barcode generator

Posted: Fri Jul 19, 2013 7:14 am
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!

Re: EAN-8 Barcode generator

Posted: Fri Jul 19, 2013 8:07 am
by Rathinagiri
Thanks Marek.