#10 EAN 128 support


Hi everybody, here is my announced EAN128 support

I didn't have time to write a proper documentation, so
here is a crashcourse:

Advice: try this patch the demo applet!

Description of XML-Format:




If you want to encode multiple Application Identifiers
(AI) you usually have to show where one AI ends and the
next one starts. The char that separates the AIs can be
specified by <group-separator>
In this implementation you can ALWAYS use the
<group-separator> between two AIs, even if
EAN128-standard does not allow a FNC1 (so you do not
need to understand the EAN128 details).
The rules for usage of FNC1 are misunderstood very
often (I hope I got it right, discussion welcome):
If the AI starts with chars
"00" - "04", "1", "20", "23", "31" - "36" or "41"
you are not allowed to use an FNC1 in front of the next
AI. In every other case you MUST use one!

My intend was to use ASCII-Code "GS" aka
ASCII-Group-Separator aka x1D for <group-separator>.
Most EAN-128-capable barcode scanners deliver this sign
if they read an FNC1! So a lot of EAN128 users do not
know what FNC1 is. Unfortunately I could not use "GS"
in fop. Chars below 32 seem to cause trouble. So I
default to xF1.

If really love the feature <checksum>auto</checksum> in
barcode4j (eg in ean-13) so I want to keep it.
Unfortunately in EAN128 this is more difficult. Lets
have a look at AI (8003). It contains 13 digits (n13)
followed by the check digit (cd) followed by 1 to 16
chars (n13+cd+an1-16).
So i introduced a special character
<check-digit-marker> that will always be replaced by a
check digit if it is found at a proper place.
(Fortunately in most cases you even can omit the
<check-digit-marker>: eg AIs (00), (01), (02),
(410)-(415) and if you want to (91) USPS Confirmation

In my first version all the EAN128 AIs had been
hardcoded. The code was small, readable and in the
spirit of object orientation. Then I needed new AIs.
Late I did some research and found some more. After
that I found even more and more and more... So I
decided to make everything configurable. I apologize
for the state of my code.

The idea is to define which AIs you want to use and how
they look like:
eg: <template>(01)n13+cd(421)n3+an1-9(10)an1-20</template>
allowed data types are numeric (n), alpha-numeric (an),
date (d) followed by a fixed or variable length
A check-digit (cd) has always a length of one. (cd0
means check-digit calculation includes the AI!
Greetings from the USPS) AIs can consist of several
Parts indicated by '+'-Signs.

Most AIs I found are already defined in
You do not need an <template> for them.
Some are not include because they are country specific
(like (91)-USPS Confirmation Service) or mutually
agreed between trading partners (90).

<omit-brackets>true<omit-brackets> does not show the




Known Bugs: Very often the human readable text is much
bigger than the barcode. This is not honored in
computation of size so the human readable text gets
workaround: increase the quiet-zone. Be aware that you
have to undo this as soon the bug is fixed.

Don't be surprised if I need some days to answer your

Have fun,


  • birch

    birch - 2005-05-25

    Patch file for EAN 128 support

  • Jeremias Märki

    Jeremias Märki - 2005-05-29

    Logged In: YES

    Hi Dietmar,

    thank you for your patch. At the moment, I don't have much
    free time to look at your work but I promise to review it as
    soon as possible. Looks like you've invested quite some time
    here. Thanks for your patience. You'll hear from me again

    Jeremias Maerki

  • Fernando Iriazabal

    Logged In: YES

    Hi Dietmar, i've been trying to build a ean-128 barcode
    with fop after aplying this patch and now i got it.

    I just want to say that, in order to get it, i've had to do
    one more change that doesn't appear in your patch file. The
    change consist in adding a line to a fop java file.

    Index: src/fop-
    private static final String[] BARCODE_ELEMENTS =
    {"intl2of5", "code39", "codabar", "code128",
    "upc-a", "upc-e", "ean-13", "ean-8",
    "height", "module-width", "wide-factor", "quiet-
    "checksum", "human-readable",
    "human-readable-font", "human-readable-size",
    "font-name", "font-size", "placement",
    "display-start-stop", "display-checksum",
    "tall-bar-height", "short-bar-height", "baseline-
    + "ean128", "template", "group-separator", "check-
    digit-marker", "omit-brackets"

    As you can see, all you have to do is to add the last line
    elements to the BARCODE_ELEMENTS variable.

  • Jeremias Märki

    Jeremias Märki - 2007-01-19
    • status: open --> closed-fixed
  • Jeremias Märki

    Jeremias Märki - 2007-01-19

    Logged In: YES
    Originator: NO

    The EAN-128 stuff is applied and documented. Thanks a lot, Dietmar!


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks