[barcode]

Output common 1D and 2D type barcode to the document.

Shorthand

It is acceptable to use the abbreviation bc instead of the full command name barcode .
So the command sequence [bc: type code39; data 1234] and [barcode: type code39; data 1234] are equivalent.

Parameters

Several parameters can be provided to determine the type and look of the barcode being output.
Of these, the type and data parameters are required for all barcode types.

General Parameters

Parameter

Description

type

Select the barcode type.

data

Data to be encoded in the printed barcode.
Content may be limited depending on the barcode type.
For more information, please see Supported Barcode Types and Data Limitations .

Parameters for 1D barcodes

Parameter

Description

height / h

Height of the barcode to be printed as printer dots, mm (recommended) or % of width.
Defaults to 10mm.

module / m

Barcode module size as dots or mm.
Use 0 to specify minimum.
For more information, please see 1D Barcode Sizing .

wide-module / wm

Barcode wide bar module size, for barcode types that support it.
Use 0 to specify the minimum size allowed relative to the standard module size.
For more information, please see 1D Barcode Sizing .

hri

No value required.
If this parameter is present then HRI (human readable information) will be printed underneath the barcode.

Parameters for QrCode 2D Barcodes

Parameter

Description

cell / c / module / m

QRCode cell size as dots or mm.
Use 0 to specify minimum(Range: 1 ~ 8 (dots) ( 0.125mm ~ 1mm )).
Note that 0 is equivalent to 1 (dots), and 3 (dots) is the default if this parameter is not specified.

error-correction / ec

Specify the error correction level when printing QR Code barcodes.
Values may be low / l , medium / m , quartile / q , high / h .
QR Codes printed with greater error correction will be larger for the same data set.

model

Specify the QR Code model type.
Supported values are 1 and 2 (default).
Note that model type 2 is the most commonly used and widely supported QR Code type and so recommended.

Parameters for PDF417 2D Barcodes

Parameter

Description

size

Sets the size calculation mode.
Supported values are ratio (default) or fixed .

rows / height / h

If the “size” mode is ratio then “rows” specifies vertical size ratio.
If “size” mode is fixed then is specifies the number of horizontal rows to be used when rendering.
For more information, please see the Ratio Sizing / Fixed Sizing of PDF417 .

columns / width / w

If the “size” mode is ratio then “columns” specifies the horizontal size ratio.
If “size” mode is fixed then specifies the exact number of symbol columns to use when printing.
Note that each column is 17 modules wide.
For more information, please see the Ratio Sizing / Fixed Sizing of PDF417 .

module / m

Barcode module size as dots or mm.
Use 0 to specify minimum(Range: 1 ~ 10 (dots) ( 0.125mm ~ 1.25mm )).
Note that 0 is equivalent to 1 (dots), and 2 (dots) is the default if this parameter is not specified.

vertical-module / vm

Specify the vertical size of a single module as a multiplier of the module value, from 1 to 10.

error-correction / ecc / ec

Specify the error correction level as an integer value from 0 (no error correction) to 8 (maximum error correction).

Supported Barcode Types and Data Limitations

The following barcode symbologies are currently supported by the markup, although some may not be supported by a particular target device or emulation.
In case a symbology is not supported by the target device, the [barcode] command will be ignored.
Each symbology has different limitations regarding the type of data that it can represent.
Using data that is not suitable for the requested symbology will cause undefined results.
Use the following table to determine the correct type value and data (e.g. [barcode: type <value>; data <data>] for the particular barcode type that you need to print.

Symbology

<value>

Wide Module

<data> Data Constraints

EAN8

ean8

7 or 8 numeric characters only.
The 8th is a checksum digit and will be calculated by the printer, so does not need to be provided.

JAN8

jan8

Japanese subset of EAN8 specification.
Completely compatible with EAN8 data requirements.

EAN13

ean13

12 or 13 numeric characters only.
The 13th is a checksum digit and will be calculated by the printer so does not need to be provided.

JAN13

jan13

Japanese subset of EAN13 specification.
Completely compatible with EAN13 data requirements.

UPC-E

upc-e

11 or 12 numeric characters only.
Character 12 is a checksum that will be calculated by the printer and so does not need to be provided

UPC-A

upc-a”

11 or 12 numeric characters only.
Character 12 is a checksum that will be calculated by the printer and so does not need to be provided

Interleaved 2 of 5

itf

An even number of numerical digits.
If an odd number of digits are provided, then a ‘0’ will be added to the beginning of the data.

Code 39

code39

Numerical digits (‘0’ to ‘9’), upper case characters (‘A’ to ‘Z’) and characters ‘ ‘, ‘$’, ‘%’, ‘+’, ‘-’, ‘.’, ‘/’

Code 93

code93

Any valid ASCII data (*)

Code 128

code128

Any valid ASCII data (*)

NW-7

nw7

Numerical digits (‘0’ to ‘9’), limited alphabet characters (‘A’ to ‘D’, and ‘a’ to ‘d’) and characters ‘$’, ‘+’, ‘-’, ‘.’, ‘/’, ‘:’

QR Code

qr

Any valid ASCII data (*)

PDF417

pdf417

Any valid ASCII data (*)
(*) To specify a string including symbols in data , please enclose the string in " character as shown below (The " character at the beginning and end of the string will be excluded from data when converted to a command).
And if you want to specify " or \ please use \"` or ``\\ .
For example:
[barcode: type pdf417; data "1234567890!\"#$%&'()=~|-^\\`{@[+*};:]<>?_,./"]

1D Barcode Sizing

Barcode width are dependent of the Symbology type, module size , data length and in some cases (such as Code 128) which internal character set sequence is used.
Some devices also support only a limited set of module sizes and ratios. Detail :List of module and wide-module for the type of barcode
It is therefore not possible to specify the width of the total symbology, however the following rules will be followed:
  • The module and wide-module values will be adjusted to the closest sizes supported by your output device which are also allowed by the symbology being printed.
    Set a value of 0 for both in order to request the minimum supported width.
  • Most symbologies will always generate the same size barcode for the same number of data digits.
    Where a symbology supports multiple internal character encodings (such as Code 128) the width may vary depending on the data content as well as number of digits.
    Data will be automatically analyzed and packed in the most efficient way supported by your target device.

If your application requires a larger amount of data or data that may vary in length significantly, then it is recommended to use a 2d symbology instead, such as QR Code of PDF417.

List of module and wide-module for the type of barcode

The following is a list of modules and wide modules for each type of barcodes.
The unit of the value is dot (The mm is “(dot * 0.125)mm”).
And the “default” is the value that can be taken if the module / wide-module parameter is not specified or is set to 0.

UPC-E / UPC-A / JAN/EAN8 / JAN/EAN13 / Code128 / Code93

Code39 / NW-7

TF”

module

module : wide-module

module : wide-module

2 (default)

2 : 6

2 : 5

3

3 : 9

4 : 10

4

4 : 12

6 : 15

-

2 : 5

2 : 4 (default)

-

3 : 8

4 : 8

-

4 : 10

6 : 12

-

2 : 4 (default)

2 : 6

-

3 : 6

3 : 9

-

4 : 8

4 : 12

QR Code

Using the [barcode] command it is possible to print 2D QR Codes with compatible printers.
As a minimum it is only necessary to specify a type of “qr” and provide some data.
For example:
[barcode: type qr; data https://cloudprnt.net/CloudPRNTSDK/Documentation/articles/markup/markupintro.html]

However, it may be desirable to set the cell size (defaults to 3 printer dots) and error correction level.

Note

Kanji is not yet supported.

QR Code Error Correction

settings

Capability

l/low

Can read with up to 7% of data obscured/damaged.

m/medium

Can read with up to 15% of data obscured/damaged.

q/quartile

Can read with up to 25% of data obscured/damaged.

h/high

Can read with up to 30% of data obscured/damaged.

Higher error correction levels will increase the size of a QR Code for the same data, and reduce the maximum data length that can be encoded.

PDF417

The [barcode] command also supports outputting PDF417 2D barcodes to compatible printers.
This can be done by setting the type parameter to pdf417 and providing some data.
For example:
[barcode: type pdf417; data PDF417 Symbologies can support very long data]

Ratio Sizing

By default, a ratio mode will be used to calculate the final printed size at a width:height(columns:rows) ratio of 2:1.
The ratio can be changed by specifying the columns / width and rows / height parameters.
And the width:height(columns:rows) ratio can be specified by 99:1 ~ 1:10 (height(rows) / width(columns) = 0.01 ~ 10).
Note that if the specified ratio is not able to contain the required data within that available print area then the printer may adapt the sizing parameters to fit, or may not print the symbology at all (this is printer/implementation dependent).
Therefore it is strongly recommended that you check your output parameters against the longest data that your application will be required to encode in a PDF417.

Fixed Sizing

Optionally, documents may set the size parameter to fixed , this allows them to also specify the required columns and/or rows to be printed.
columns may be set to a value from 0 to 30, where 0 allows the output device to choose based on the length of supplied data and error correction level.
The width of one column is 17 x module , and in addition space must be allowed for the start/stop patterns and row indicators which in total are equal to 4 columns.
rows may set a value from 3 to 90 to specify the number of rows to be printed.
If may also be omitted or set to 0 to allow the output device to calculate the number of rows based on the length of data and error correction required.
The height of one row is module x vertical-module .
If using the fixed sizing mode then it is necessary to specify at least one on the columns or rows parameters.
Otherwise the default ratio sizing method, will be used.
Note that if the specified size is not able to contain the required data withing that available print area then the printer may adapt the sizing parameters to fit, or may not print the symbology at all (this is printer/implementation dependent).
Therefore it is strongly recommended that you check your output parameters against the longest data that your application will be required to encode in a PDF417.

Example

Markup

This is a simple markup example, using only the [barcode] and [cut] commands.

Barcode Examples

EAN 8:
[barcode: type ean8; data "1234567"]

EAN 13:
[barcode: type ean13; data "500274857162"; hri]

Interleaved 2 of 5 (module 3 dot):
[barcode: type itf; data "48129500"; height 20mm; hri; module 3]

Code 39:
[barcode: type code39; data "ABC123"]

Code 39 (module 3, wide module 9):
[barcode: type code39; data "ABC123"; module 3; wide_module 9]

Code 128:
[barcode: type code128; data "Hello World!"]

QR Code:
[barcode: type qr; data "https://cloudprnt.net/CloudPRNTSDK/Documentation/articles/markup/markupintro.html"]

[cut]

Output at 58mm

This is the result when using the markup processor to sent to an mC-Print2 58mm(2inch) printer.

../../_images/barcodes_58mm.jpg

Output at 80mm

This is the result when using the markup processor to sent to a TSP650II 80mm(3inch) printer.

../../_images/barcodes_80mm.jpg