barcodes

1. SVG Stylesheet library from RenderX
2. Barcode generator in XSL
3. Barcodes
4. Barcode generator code

1.

SVG Stylesheet library from RenderX

Alexander Peshkov

We are pleased to announce that RenderX have recently released a library of XSLT stylesheets that produce SVG representation of the following barcode formats:

- Code 3 of 9/Code 3 of 9 extended
- Code 128
- UPC/EAN
- Code 2 of 5 Interleaved
- Australia Post 4-State Barcode
- Codabar

Our generators support the full range of barcode properties including checksum generation (except for Codabar). All stylesheets are heavily parameterized: you can control bars width/height, wide-to-narrow ratio, quiet zone size, font properties for human readable label, etc.

RenderX barcode library is freely available at RenderX.com

On the same page you will also find a simple online demo for each supported barcode type - the SVG image generated by a stylesheet is inserted into an XSL FO wrapper and rendered to PDF by RenderX XEP formatter. The online demo is limited to the basic flavor of the respective barcode. To assess the full power of the stylesheets, download them and try offline.

We believe that these utilities may be of interest for SVG and XSLT communities - either as a sample of implementation of complex logic in an XSLT, or as a demonstration of dynamically generated SVG applied to everyday business needs.

2.

Barcode generator in XSL

Nikolai Grigoriev

We have an XSL stylesheet that draws barcodes from digit sequences. We hope a thing like this may be useful for people wishing to add barcode labelling to their XSL-based publishing solutions;

It is also a funny example of XSLT programming per se.

Barcodes implemented are the most popular ones that you can see on items in stores and groceries - UPC/EAN, to be precise; other systems can be easily added. The output is an XSL FO table that can be rendered to PDF. As most of the barcode-drawing logic is independent of the output graphical format, modifying the stylesheet to produce SVG or something similar should be a relatively simple task.

The stylesheet and examples are freely available from Renderx;

3.

Barcodes

Eliot Kimber




> I want to use barcode with xsl:fo.  Has
> anyone used something to generate barcodes to be
> printed in the pdf file using xsl or xsl:fo ?
> Any help is appreciated.

There are a number of vendors that provide bar codefonts. Do a google search on "barcode fonts" and you'll find them. Several provide free trials.

Some barcode schemes do not use a check sum, the most common being "code 39". For these barcodes you just set the font and use normal numbers, e.g.:

<fo:block font-family="Code39Demo">1234567</fo:block>

Code39Demo is one font I found--don't have the source to hand.

For other barcode schemes, you have to calculate the checksum or include it in the data, which you normally wouldn't do. You can do this calculation in XSLT but it's non-trivial (easier with exslt functions or you could write an extension function).

RenderX has a sample of using XSLT and pure FO to generate graphical bar codes, but this seems like more work than just using a font. But it does make for a neat parlor trick.

4.

Barcode generator code

Jeremias Maerki

Krysalis Barcode is a barcode generation package written in Java and available under The Krysalis Patchy Software License (which is based on the Apache Software License Version 1.1).

Features

1D barcode implementations:

- Interleaved 2 of 5
- Code 39
- Codabar
- Code 128
- UPC-A and UPC-E (with supplementals)
- EAN-13 and EAN-8 (with supplementals)
- POSTNET

Support for multiple output formats:

- SVG
- EPS (Encapsulated PostScript)
- Bitmap images (such as PNG or JPEG)
- Java2D (AWT)
- Text (for testing and debugging only)

For more information about Krysalis Barcode, please visit: krysalis.org