Barcode

In OL Connect Designer, you can add a variety of barcodes to your template. The supported barcode types include 1d barcodes (the striped ones) and 2d barcodes (encoded horizontally and vertically).

Note: When generating Print output, you can add extra barcodes and OMR marks. This is particularly useful when you might need to drive custom processes on production machines using either barcodes or OMR marks. At merge time more information is available about the actual output document. The page count, for example, is not available at design time.
Having a barcode added at the time of printing is also a time saver in an automated process where only a barcode needs to be added to an existing PDF and a template is actually unnecessary. In this case, content creation can be skipped. (See Print processes with OL Connect tasks.)

To add barcodes and OMR marks on the fly when generating Print output from the Designer, select File > Print and check the option Add additional content (see Additional Content) in the Print Wizard. To have this done automatically, save this and other output options in an Output Preset (see Output Presets).

Send the preset to Workflow to use it in Workflow configurations. See Sending files to Workflow.

Adding a barcode

Before adding a barcode, load data or at least a Data Model; see Loading data.

Then, to add a barcode to a section, Master Page or snippet:

  1. Select Insert > Barcode on the menu or click the Barcode toolbar button.

    Tip: A KIX code can also be part of an address block created by the Address Block wizard. See Address Block.

  2. Choose the desired barcode type.

  3. Select the field that contains the barcode value. The barcode type dictates the length and exact format of the required value. For a detailed description or for background information on a specific barcode, please refer to the documentation provided by the individual barcode supplier. Note that some barcode readers may require specific parameters as well.
    If it is necessary to concatenate fields to compose the barcode value, edit the expression (or the script) after adding the barcode; see Adding barcodes to a Dynamic Table.

    Note: For barcodes that require a Checksum, the Designer can calculate a Checksum if that isn't provided by your data. In that case the field should contain the required value minus the Checksum. The option to include a calculated Checksum in the barcode value is given on the Properties tab (in step 6), if applicable.

  4. Give the barcode an ID and/or class.

  5. Check the option Absolute to insert the barcode in an absolute-positioned box inside the <body> of the HTML, but outside other elements. (This option is not available in Email sections.) Alternatively, use the Location drop-down to select where to insert the barcode.

    • At cursor position inserts it where the cursor is located in the template.

    • Before element inserts it before the HTML element in which the cursor is currently located. For example if the cursor is within a paragraph, the insertion point will be before the <p> tag.*

    • After start tag inserts it within the current HTML element, at the beginning, just after the start tag.*

    • Before end tag inserts it within the current HTML element, at the end, just before the end tag.*

    • After element inserts it after the element in which the cursor is currently located. For example if the cursor is within a paragraph, the insertion point will be after the end tag of the paragraph (</p>).*

    • Replace inserts it in place of the currently selected element. (This option is not available when inserting content in a Master Page.)

    * If the current element is located inside another element, use the Elements drop-down to select which element is used for the insertion location. The list displays every element in the breadcrumbs, from the current selection point down to the root of the body.

    Note: HTML has some restrictions as to which types of elements are allowed as children of other elements. For example, a paragraph element is not allowed to have children that are block level elements - like a Div or a Table. If inserting content at the selected location would produce invalid HTML the final result may be different than expected. For example, when you insert a Div into a paragraph, the paragraph gets split in two. This means you end up with two paragraphs with the Div in between.

  6. The settings to make on the Properties tab and Output tab depend on the selected barcode type. See Barcode types.

  7. Click OK to close the dialog.

In the template the barcode shows up as a gray box. A barcode is always added with the barcode type's default dimensions.

The barcode box has an expression containing the name of the selected field. For example: {{~url~}}. The value for the barcode is obtained by evaluating the expression (or expressions) in the box.

The expression has a tilde character (~) inside the double brackets, on both sides. The tildes remove any white space added by the editor when switching between the Design, Source, and Preview modes. They do not remove white space from the value itself.

The barcode properties are written to the data-params attribute on the Barcode element in JSON format. (To see this, select the barcode and open the document in the Source view.)

To see the barcode working, toggle to the Preview tab in the Workspace.

Note: If expressions are not supported in the current section, a script that is associated to the barcode is added instead of an expression.

To enable expressions in a section, right-click the section in the Resources pane, select Properties and check the option Evaluate Handlebars expressions. In templates made with OL Connect 2022.1 or older this option is unchecked by default.

Adding barcodes to a Dynamic Table

If you want the rows in a Dynamic Table to have a barcode that is based on the value of a detail table field, first create the Dynamic Table. See Dynamic Table.

Then click in the cell that should contain the barcode and follow the same procedure as described in Adding a barcode. The only differences will be:

  • In Step 3, when selecting the field that contains the barcode value, you can only choose a field from the detail table the Dynamic Table row is based on.

  • In Step 5, the Location option is not available. The barcode can only be inserted At cursor position.

Changing a barcode

Barcode value

The value to feed to the barcode generator is either obtained by evaluating the expression or expressions in the barcode box or by running a script that is associated to the barcode.

Expression

When a barcode has just been inserted, it has one expression that contains the name of a data field (e.g. {{~url~}}).

To change the expression, click in the box and type the new expression - or multiple expressions, if you want the barcode value to be composed of the values of multiple fields. (See also: Handlebars expressions.)

In each expression, place a tilde character (~) inside the double brackets, on both sides. The tildes remove any white space added by the editor when switching between Design, Source, and Preview modes. They do not remove white space from the value itself, which is the result of the expression.

Script

To change the script that is associated with the barcode, double-click it on the Scripts pane. When you select more than one field, the script puts the values of the selected fields in one string and passes that to the barcode generator.

Tip: If you don't know which script matches the barcode, click the box that contains the barcode and check the ID and class of that box on the Attributes pane. Then take a look at the Scripts pane: the selector of the associated script is the same as the ID and/or class of the barcode box.
If a barcode has more than one class name, only the first one is used in the script's selector.

Barcode type and properties

To change the barcode type or the barcode's properties such as the scale and color, open the Barcode properties dialog: right-click the barcode (on the Design tab in the workspace) and select Barcode from the shortcut menu.

A barcode's type and size can also be changed on the Attributes pane.

Barcode types

Click the barcode type below for information about its properties.