Mot exact Résultats par page

Index des mots-clés

AGENDA PERSONNEL
ALBUM PHOTO (Script)
ANTI SPAM
APICULTURE
BAECKEOFFE
BREDELE
BUCHE DE NOEL
C++
CADRE
CASSOULET
CHARLOTTE AUX FRUITS
CODAGE ADRESSES MAIL
CODE 2 DE 5 ENTRELACE
CODE 3 DE 9
CODE 128
CODE PDF417
CODES BARRE
CODE POSTAL
CODES VIDEOTEXT
COLOMBO DE PORC
CONFITURES
CONGOLAIS
CORNICHONS AU VINAIGRE
COUARAIL
CREMES
CRUMBLE
CYBERMUT
DADANT
DATAMATRIX
DDE
DOMBRE
DOUBLE NAT
DYNDNSUPDATE
EAN 13
EAN 128
ELECTRONIQUE
ENVOI DE SMS
ESPACE MEMBRE
EURO
EXEMPLES VB6
FAR
FARCE
FAVORIS
FONCTIONS
FONCTIONS EN C++
GATEAU ROULE
GRATIN LORRAIN
GUACAMOLE
IMPRIMANTES RESEAUX
INSTANCE UNIQUE
KIT VB4
LANGSTROTH
LIQUEUR
MADELEINES
MAISONS
MAQUEREAUX AU VIN BLANC
MAQUEREAUX (Rillettes)
MARINADES
NMEA
NOUGATINE
PAIN
PATE A TARTE
PDF417
PHP
PIC
PLANS DE MAISON
PLANTEUR
POMMES
POULET COCO
PROCEDURES
PROGRAMMATION
RATATOUILLE
RECETTES DE CUISINE
RESSOURCES RESEAUX
RHUBARBE
R.I.B.
RILLETTE DE MAQUEREAUX
ROUTINES
RUCHE
SAUMON EN CROUTE
SCRIPTS
SITES
SLICE
SMS
SOUPE DE COURGE
TABLE PERIODIQUE
TARTE
TATIN (Tarte)
TARTIFLETTE
USB
VIDEOTEXT
VISUAL BASIC
VOIRNOT
WNTIPCFG

Mot exact Résultats par page
I
N
D
E
X

The EAN 13 code


Version francaise

This code used on all current consumer products allow a 12 digits code, the thirteenth digit is a control key that we'll must generate. Before going into technique,  two smalls evasions.

The UPC-A bar code type used in U.S.A.

It has only 11 digits and the key. It's in fact an EAN13 code with the first digit to zero and with a lightly different custom. The UPC-A code type is a subset of the EAN13 type.
Exemple :

These two barcodes are identicals, we have put a zero before the UPC-A code to obtain the EAN13 code but the bar pattern is tightly identical.
On the begin of 2005 all shops in U.S.A. will must accept the EAN13 code, there is no longer reason to produce UPC-A code.


Digits sense.

- 2 digits for the country code or system code
- 5 digits for the society identification
- 5 digits for the product identification
- 1 digit for the checksum
This rule is frequently violate in order to increase the use of available digits.
Here is the list of  country codes or system codes :

00 a 13 United States and Canada
20 a 29 In store numbers
30 a 37 France
380 Bulgaria
383 Slovenia
385 Croatia
387 Bosnia-Herzegovina
400 a 440 Germany
45 + 49 Japan
460 a 469 Russian federation
471 Taiwan
474 Estonia
475 Latvia
476 Azerbaidjan
477 Lithuania
478 Uzbekistan
479 Sri Lanka
480 Philippines
481 Belarus
482 Ukraine
484 Republic of Moldova
485 Armenia
486 Georgia
487 Kazakstan
489 Hong Kong
50 Uganda
520 Greece
528 Lebanon
529 Cyprus
531 Macedonia
535 Malta
539 Ireland
54 Belgium
560 Portugal
569 Iseland
57 Denmark
590 Poland
594 Romania
599 Hungary
600 - 601 South africa
609 Mauritius
611 Morocco
613 Algeria
616 Kenya
619 Tunisia
621 Syrian arab republic
622 Egypt
624 Libyan arab jamahiriya
625 Jordan
626 Islamic republic of Iran
627 Kuwait 

628 Saudi arabia
629 United arab emirates
64 Finland
690 - 693 China
70 Norvway
729 Israel
73 Sweden
740 Guatemala
741 El Salvador
742 Honduras
743 Nicaragua
744 Costa Rica
745 Panama
746 Dominican republic
750 Mexico
759 Venezuela
76 Switzerland
770 Colombia
773 Uruguay
775 Peru
777 Bolivia
779 Argentina
780 Chile
784 Paraguay
786 Ecuador
789 Brazil
80 a 83 Italiy
84 Spain
850 Cuba
858 Slovakia
859 Czech republic
860 Yugoslavia)
867 Democratic people's republic of Korea
869 Turkey
87 Netherlands
880 Republic of Korea
885 Thailand
888 Singapore
890 India
893 Viet nam
899 Indonesia
90 - 91 Austria
93 Australia
94 New Zealand
955 Malaysia
958 Macau
977 Periodicalss (ISSN)
978 - 979 Books (ISBN)
980 Refund receipts
981 - 982 Common currency coupons)
99 Coupons

Now let's see the calculation of the checksum.

The digits are numbered from right to left;
Let x, the sum of even digits and y the sum of odd digits
Let's calculate z = x + 3 * y
Let m the number divisible by 10 immediately superior to z
The checksum is : m - z

Example : 978020113447
x = 4 + 3 + 1 + 2 + 8 + 9 = 27
y = 7 + 4 + 1 + 0 + 0 + 7 = 19
z = 3 * 19 + 27 = 84
m = 90
Checksum = 90 - 84 = 6
EAN13 ---> 9  780201  134476 

Then let's learn encoding system.

Let's symbolize the bar module by "1" and the space module by "0"

The digits are converted with one of the 3 tables below ; the codes of tables A and B begin with a space whereas ones of table C begin with a bar.

Digit

Table A

Table B

Table C

0

0001101

0100111

1110010

1

0011001

0110011

1100110

2

0010011

0011011

1101100

3

0111101

0100001

1000010

4

0100011

0011101

1011100

5

0110001

0111001

1001110

6

0101111

0000101

1010000

7

0111011

0010001

1000100

8

0110111

0001001

1001000

9

0001011

0010111

1110100

The first digit is not coded, each 6 following digit is converted either by table A or by the table B and that according to the first digit. The 6 last digits are converted by the table C.
A new table indicates the use of table A or B according to the number 1 digit.

According to digit 1

Digit 2

Digit 3

Digit 4

Digit 5

Digit 6

Digit 7

0

A

A

A

A

A

A

1

A

A

B

A

B

B

2

A

A

B

B

A

B

3

A

A

B

B

B

A

4

A

B

A

A

B

B

5

A

B

B

A

A

B

6

A

B

B

B

A

A

7

A

B

A

B

A

B

8

A

B

A

B

B

A

9

A

B

B

A

B

A


Some EAN13 code are followed by an "add-on" of 2 or 5 digits, especially on the books and the magazines.
This add-on is coded with tables A & B. The choice of the table A or B, for each add-on digit, is a dependency of a checksum that it's necessary to calculate.

2 digits add-on.

Checksum calculation :
Let x, the add-on value
Let m the number divisible by 4 immediately inferior to x
The checksum is : x - m
Exemple :
x = 35 --> m = 32
Checksum = 35 - 32 = 3

Checksum

Digit 1

Digit 2

0

A

A

1

A

B

2

B

A

3

B

B

5 digits add-on

Checksum calculation :
Let x, the sum of the even digits and y the sum of the odd digits
Let's calculate z = 9 * x + 3 * y
Let m the number divisible by 10 immediately inferior to z
The cheksum is : z - m
Exemple :
Add-on = 12345
x = 2 + 4 = 6 and y = 1 + 3 + 5 = 9 consequently z = 9 * 6 + 3 * 9 = 81 Checksum = 81 - 80 = 1

Checksum

Digit 1

Digit 2

Digit 3

Digit 4

Digit 5

0

B

B

A

A

A

1

B

A

B

A

A

2

B

A

A

B

A

3

B

A

A

A

B

4

A

B

B

A

A

5

A

A

B

B

A

6

A

A

A

B

B

7

A

B

A

B

A

8

A

B

A

A

B

9

A

A

B

A

B

In addition, an add-on begin with a 4 modules width special separator having formula : 1011 and each character, except for the last one, is followed by a separator having formula 01. 

Bar code making.

Since we can create the bar code pattern it remains us to draw it on the screen and to print it on a paper sheet. Two approaches are possible :

All the found EAN13 bar codes on the net (Incomplete demonstration font) aren't free, several times expensive, and with uncertain quality; the width module isn't always permanent  in the font definition. I've decided consequently to draw entirely an EAN13 font and to propose it for download. I test it on a laser printer with size 14, what gives a very small barcode with a width of about 13 mm, result : reading at 100% ! On a good inkjet printer, this same size of 14 work very well.

The font " EAN13.ttf "

This font contain the 5 sets of the 10 digits for the 3 tables A, B and C learned above and 2 tables for the first digit (Table D & E)

The following table indicates the correspondence between the drawned bar code and the typed letter (ASCII code between bracket)

Digit

Table A

Table B

Table C

Table D

Table E

0

A (65)

K (75)

a (97)

0 (48)

k (107)

1

B (66)

L (76)

b (98)

1 (49)

l (108)

2

C (67)

M (77)

c (99)

2 (50)

m (109)

3

D (68)

N (78)

d (100)

3 (51)

n (110)

4

E (69)

O (79)

e (101)

4 (52)

o (111)

5

F (70)

P (80)

f (102)

5 (53)

p (112)

6

G (71)

Q (81)

g (103)

6 (54)

q (113)

7

H (72)

R (82)

h (104)

7 (55)

r (114)

8

I (73)

S (83)

i (105)

8 (56)

s (115)

9

J (74)

T (84)

j (106)

9 (57)

t (116)

 Additional codes :
: (58) : Start delimiter (For SAGE software)
* (42) : Middle delimiter
+ (43) : End delimiter
[ (91) : Start add-on delimiter
\ (92) : Character separator in add-on

 

Copy this file
in the font directory,
often named :
C:\WINDOWS\FONTS

The alone start delimiter (Code 58) and the table E were added for the SAGE software user who will have to then configure in their software the EAN13 encoding font table as follows :

Position

1

2

3

4

5

6

7

8

9

Value

[

:

A

K

*

a

+

k

]

Structure of an EAN13 barcode

An EAN13 barcode will be build up in the following way :

A small program to test all that

Here is a small program
written with Visual Basic 6.
The setup file copy the
program, the Visual Basic
dependencies, the source
files and the font.

 

Setup file :

ZIP file without setup :

The EAN13$ function can be re-used in any other Visual Basic 6 program ; it can also be recopied just as it in a VBA macro linked to an Excel or Word document.

Public Function ean13$(chaine$)
  'Cette fonction est regie par la Licence Generale Publique Amoindrie GNU (GNU LGPL)
  'This function is governed by the GNU Lesser General Public License (GNU LGPL)
  'V 1.1.1
  'Parametres : une chaine de 12 chiffres
  'Parameters : a 12 digits length string
  'Retour : * une chaine qui, affichee avec la police EAN13.TTF, donne le code barre
  '         * une chaine vide si parametre fourni incorrect
  'Return : * a string which give the bar code when it is dispayed with EAN13.TTF font
  '         * an empty string if the supplied parameter is no good
  Dim i%, checksum%, first%, CodeBarre$, tableA As Boolean
  ean13$ = ""
  'Verifier qu'il y a 12 caracteres
  'Check for 12 characters
  If Len(chaine$) = 12 Then
    'Et que ce sont bien des chiffres
    'And they are really digits
    For i% = 1 To 12
      If Asc(Mid$(chaine$, i%, 1)) < 48 Or Asc(Mid$(chaine$, i%, 1)) > 57 Then
        i% = 0
        Exit For
      End If
    Next
    If i% = 13 Then
      'Calcul de la cle de controle
      'Calculation of the checksum
      For i% = 12 To 1 Step -2
        checksum% = checksum% + Val(Mid$(chaine$, i%, 1))
      Next
      checksum% = checksum% * 3
      For i% = 11 To 1 Step -2
        checksum% = checksum% + Val(Mid$(chaine$, i%, 1))
      Next
      chaine$ = chaine$ & (10 - checksum% Mod 10) Mod 10
      'Le premier chiffre est pris tel quel, le deuxieme vient de la table A
      'The first digit is taken just as it is, the second one come from table A
      CodeBarre$ = Left$(chaine$, 1) & Chr$(65 + Val(Mid$(chaine$, 2, 1)))
      first% = Val(Left$(chaine$, 1))
      For i% = 3 To 7
        tableA = False
         Select Case i%
         Case 3
           Select Case first%
           Case 0 To 3
             tableA = True
           End Select
         Case 4
           Select Case first%
           Case 0, 4, 7, 8
             tableA = True
           End Select
         Case 5
           Select Case first%
           Case 0, 1, 4, 5, 9
             tableA = True
           End Select
         Case 6
           Select Case first%
           Case 0, 2, 5, 6, 7
             tableA = True
           End Select
         Case 7
           Select Case first%
           Case 0, 3, 6, 8, 9
             tableA = True
           End Select
         End Select
       If tableA Then
         CodeBarre$ = CodeBarre$ & Chr$(65 + Val(Mid$(chaine$, i%, 1)))
       Else
         CodeBarre$ = CodeBarre$ & Chr$(75 + Val(Mid$(chaine$, i%, 1)))
       End If
     Next
      CodeBarre$ = CodeBarre$ & "*"   'Ajout separateur central / Add middle separator
      For i% = 8 To 13
        CodeBarre$ = CodeBarre$ & Chr$(97 + Val(Mid$(chaine$, i%, 1)))
      Next
      CodeBarre$ = CodeBarre$ & "+"   'Ajout de la marque de fin / Add end mark
      ean13$ = CodeBarre$
    End If
  End If
End Function
In order to test this function with Excel, here's a sample file : and with Open Office :

Since the first publication of this page, I'd received numbered versions in different languages :

Language

Auteur

Neobook 4

Jean-Louis HUVE


(Simplement lancer l'exe qui se trouve dans le zip.) 

Visual Foxpro

Emile MAITREJEAN

Delphi

John SWIJSEN
YARDIMLI EKIM E YARDIMLI
Francisco FERNANDEZ 



C#

Russell SAYERS

Perl

Simone FIORAVANTI

Axapta

Soe JESPER


EAN 8 code
 

It resemble to code EAN 13 very much. It has 7 digits and a checksum computed exactly in the same way as for code EAN13. The delimitors left (We shall use ASCII 58), middle and right are the same ones. The first 4 digits are build with table A and the last 4 ones with the table C.
We will thus use also font EAN13 with this function :

Public Function EAN8$(chaine$)
  'V 1.0.0
  'Parametres : une chaine de 7 chiffres
  'Parameters : a 7 digits length string
  'Retour : * une chaine qui, affichee avec la police EAN13.TTF, donne le code barre
  '         * une chaine vide si parametre fourni incorrect
  'Return : * a string which give the bar code when it is dispayed with EAN13.TTF font
  '         * an empty string if the supplied parameter is no good
  Dim i%, checksum%, first%, CodeBarre$, tableA As Boolean
  EAN8$ = ""
  'Verifier qu'il y a 7 caracteres
  'Check for 7 characters
  If Len(chaine$) = 7 Then
    'Et que ce sont bien des chiffres
    'And they are really digits
    For i% = 1 To 7
      If Asc(Mid$(chaine$, i%, 1)) < 48 Or Asc(Mid$(chaine$, i%, 1)) > 57 Then
        i% = 0
        Exit For
      End If
    Next
    If i% = 8 Then
      'Calcul de la cle de controle
      'Calculation of the checksum
      For i% = 7 To 1 Step -2
        checksum% = checksum% + Val(Mid$(chaine$, i%, 1))
      Next
      checksum% = checksum% * 3
      For i% = 6 To 1 Step -2
        checksum% = checksum% + Val(Mid$(chaine$, i%, 1))
      Next
      chaine$ = chaine$ & (10 - checksum% Mod 10) Mod 10
      'Les 4 premier chiffre viennent de la table A
      'The first 4 digits come from table A
      CodeBarre$ = ":"   'Ajout marque de debut / Add start mark
      For i% = 1 To 4
         CodeBarre$ = CodeBarre$ & Chr$(65 + Val(Mid$(chaine$, i%, 1)))
      Next
      CodeBarre$ = CodeBarre$ & "*"   'Ajout separateur central / Add middle separator
      For i% = 5 To 8
        CodeBarre$ = CodeBarre$ & Chr$(97 + Val(Mid$(chaine$, i%, 1)))
      Next
      CodeBarre$ = CodeBarre$ & "+"   'Ajout de la marque de fin / Add end mark
      EAN8$ = CodeBarre$
    End If
  End If
End Function
	    

Do you like this page ?

Is it useful for you
?

Click here !