Altova StyleVision 2024 Enterprise Edition

The Barcode design element is supported in XSLT 2.0 or XSLT 3.0 mode (not XSLT 1.0) and enables barcodes (screenshot below) to be generated in the output document. At the location in the design document where you wish to enter the barcode, insert the Barcode design element and specify its properties.

 

Barcode01

 

Important: For barcodes to work, a Java Runtime Environment must be installed. This must be version 1.4 or later in a bit version that corresponds to the bit version of the StyleVision package installed on your system: 32-bit or 64-bit.

 

Important: For barcodes to be generated in the output, you must use Altova's XSLT processor to generate the output. This is because the barcodes in an SPS are generated by calling special Java extension functions that are not part of the XSLT standard. Altova's XSLT processors support these specific extension functions, whereas other XSLT processors very probably do not. As a result, barcodes will not be generated if processed with a non-Altova XSLT processor. The Altova XSLT processor is packaged with StyleVision, and is automatically called when you generate output via the Generate commands in the File menu. Alternatively, you can use RaptorXML Server, which is a Altova's standalone XSLT processor.

 

Note:Barcodes are not rendered in Text output.

 

Inserting a barcode

To insert a barcode in your design, do the following:

 

1.At the location where you wish to insert the barcode, right-click and select the command Insert Barcode. Alternatively, select the command Insert | Insert Barcode or click the Barcode icon in the toolbar and click the location in the design where you wish to insert the barcode. You can also drag and drop an element from the Schema Tree into the Design View and then select 'Create Barcode'. The Insert Barcode dialog pops up (screenshot below).

 

BarcodeProps01

 

2.Two properties, Type and Text, are mandatory; the others are optional and/or have appropriate default values. The Type property, the value of which can be selected from a dropdown list (see screenshot above), specifies the type of the barcode, for example EAN-13 (which includes ISBN barcodes) and UPC-A. The Text property specifies the value that will generate the barcode, for example, an ISBN number. The various barcode properties are described below. Set the required properties and any other properties that you want. Note that, if you wish to use a value in the XML file as the value of a property, you can enter an XPath expression to locate the XML node you wish to access. Do this as follows: Select the property, toggle on the XPath button in the toolbar of the Properties dialog, and then enter the XPath expression in the Edit XPath Expression dialog. The XPath expression will be evaluated within the current context node.

3.After setting the properties, click OK. The barcode image will be inserted. The generated barcode (see screenshot below) can be immediately viewed in any of the output previews.

 

Barcode01

 

Note: Barcode images are generated as PNG files.

 

Barcode properties

The following barcode properties can be specified. The Type and Text properties must be set; the other properties are optional. Note that different properties are available for different barcode types.

 

Type: The barcode system under which the message will be interpreted, such as EAN and UPC.

Text: The value that will be used to generate the barcode pattern.

SetModuleWidth: The width of the bars in the code.

SetBarHeight: The height of the bars.

SetHeight: The height of the barcode graphic.

DoQuietZone: Yes or No values determine whether the "quiet zone" (or padding) around the barcode, which is specified in the SetQuietZone and SetVerticalQuietZone properties, will be implemented.

SetQuietZone: Sets the "quiet zone" (or padding) around the barcode. In the case of one-dimensional barcodes, the value specified here is applied to the horizontal dimension. In the case of two-dimensional barcodes, the value is applied to both horizontal and vertical dimensions. The value of the vertical dimension can be overridden by the value specified in the SetVerticalQuietZone property. A length unit of millimeters (mm) is required. Example: 2mm.

SetVerticalQuietZone: Sets the "quiet zone" (or padding) for the vertical dimension on two-dimensional barcodes. A length unit of millimeters (mm) is required. Example: 2mm.

SetMsgPosition: Specifies where the message text appears relative to the barcode. Values are top, bottom, and none (no mesage is generated).

SetPattern: Sets a pattern for the message text so that the text is readable. A long string of numbers, for example, would be difficult to read. The syntax for patterns is given below.

SetFontName: The font in which text should appear.

SetFontSize: The font-size in which text should appear.

SetChecksumMode: The following values are available: (i) Add: the checksum is automatically added to the message; (ii) Check: the checksum is checked while rendering the barcode (assumes the checksum is present); (iii) Ignore: no checksum processing is done; (iv) Auto: enables the barcode type's default behaviour.

Orientation: Whether the barcode should be rotated. The options are in steps of 90 degrees counter-clockwise.

PixelDensity: Specifies the density of the pixels in the barcode image. Higher pixel density provides sharper images.

GeneratedImageSettings: Enables you to set a name for the generated barcode image file. If no name is specified, a name is generated automatically by StyleVision.

 

 


 

 

Pattern syntax

Patterns are used to make the input message string more readable in the barcode. In the pattern, each character of the input message text is represented by the underscore "_". Any other characters included in the pattern are inserted at the corresponding locations in the output message text. The backslash "\" is an escape symbol. So, the combination of '\?' will insert the character '?' in the output message text, where '?' can be any character. The character '#' can be used to delete a character from the original message. These points of pattern syntax are illustrated with the examples below.

 

Input message text

Pattern

Output message text

123456

__ __ __

12 34 56

15032011094655

__\\__\\____ __:__:__ UTC

15\03\2011 09:46:55 UTC

15-03-2011

__#/__#/____

15/03/2011

 

Generating output files

The barcode image files that are generated for the output are saved to locations that are specified in the Paths tab of the Properties dialog (screenshot below), which is accessed with the menu command File | Properties.

 

DlgPropertiesPaths

 

Barcode image files for previews may be created in the same directory as the SPS file or as the Working XML File. These are temporary files, which are deleted when the SPS is closed. Barcode image files that are created when output is generated using the File | Save Generated File command can be created at any location. Their target location is specified in the pane, Location of Additionally Generated Files (see screenshot above).

 

© 2017-2023 Altova GmbH