XF Ultrascale 2011 offers support for drawing 128, 128 Raw, 128 UCC, UPC-A, UPC-E, EAN-13, EAN-8, 2 of 5, 3 of 9, Postnet, Planet, OMR, PDF 417 and DataMatrix barcodes.
A barcode can be defined as following:
<xf:barcode xmlns:xf="http://www.ecrion.com/xf/1.0" value="upc code" type="Auto|Code128|Code128Raw|Code128UCC|UPC-A|UPC-E|EAN-13|EAN-8|2of5|3of9| DataMatrix|Postnet|Planet|OMR|PDF417"
bar-unit="length"
include-checksum="boolean"
draw-text="boolean"
extended="boolean"
encoding="ASCII|C40|TEXT|BASE256|NONE|AUTO"
preferred-format="AUTO|C10x10|C12x12|etc."
fo:content-width="length"
fo:content-height="length"
fo:content-scaling="non-uniform|uniform"
fo:font="font"
fo:padding="padding"
fo:border="border"
fo:color="color">
value
| • | The code value. For EAN and UPC values specified, the value can be specified with or without the check digit (the last digit). If the check digit is specified, then type attribute must be specified as well. |
| • | When type is EAN, UPC, 2OF5 or Postnet, non-digit characters in the value are ignored. |
| • | When type is 3OF9 non extended, only uppercase A-Z and -. $/+%* are acceptable. |
type
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
bar-unit
| • | Specifies the length of one unit of the barcode and applies only to UPC and EAN barcodes. Barcode lines can be between 1 and 4 such units. |
include-checksum
| • | Specifies it a checksum must be computer for 3 of 9 codes. By default, this value is set to true |
draw-text
| • | Specifies if the barcode value and the checksum must be displayed for 2of5 or 3of9 barcodes. Default is true. |
extended
| • | Allows for a wider character set for 3 of 9 barcodes. Default value is false. |
encoding
| • | ASCII |
| • | C40 |
| • | TEXT |
| • | BASE256 |
| • | NONE |
| • | AUTO |
Encoding for DATAMATRIX codes.
preferred-format
• AUTO |
• C24X24 |
• C64X64 |
• C144X144 |
• C10X10 |
• C26X26 |
• C72X72 |
• C8X18 |
• C12X12 |
• C32X32 |
• C80X80 |
• C8X32 |
• C14X14 |
• C36X36 |
• C88X88 |
• C12X26 |
• C16X16 |
• C40X40 |
• C96X96 |
• C12X36 |
• C18X18 |
• C44X44 |
• C104X104 |
• C16X36 |
• C20X20 |
• C48X48 |
• C120X120 |
• C16X48 |
• C22X22 |
• C52X52 |
• C132X132 |
Preferred format for DATAMATRIX codes.
Normal formatting attributes (font, color) still apply, but they must be prefixed by the XSL-FO namespace prefix.
Examples:
1. UPC-A barcode:
<fo:block>
<xf:barcode value="075-67 816 4125" type="UPC-A" bar-unit="1px"
fo:font="7.5pt Arial" fo:color="blue"
fo:scaling="non-uniform" fo:content-height="50pt"
fo:padding="10pt"/>
</fo:block>
The rendering result is displayed in the next figure:

2. DATAMATRIX barcode:
<fo:block>
<xf:barcode value="Hello World" type="DATAMATRIX" encoding="ASCII" preferred-format="C20X20"/>
<fo:block/>
The rendering result is displayed in the next figure:

3. Postnet barcode:
<fo:block>
JOE DOE<fo:block/>
101 Main Street<fo:block/>
Anytown US 12345-6789<fo:block/>
<xf:barcode xmlns:xf="http://www.ecrion.com/xf/1.0" value="12345678901" type="Postnet"/>
</fo:block>
The rendering result is displayed in the next figure:
