Barcode Generator Option
Barcode Generator Option enables you to embed barcodes directly in the document as images. Barcode fonts are not necessary.
The barcode can be specified by using data scheme as follows:
<!-- XSL-FO example -->
<fo:external-graphic src="data:application/vnd.ah-barcode;type=QR;scale=2,Hello%20World!"/>
<!-- HTML example -->
<img src="data:application/vnd.ah-barcode;type=QR;scale=2,Hello%20World!"/>
application/vnd.ah-barcode is a special media type of its own use. The barcode content you want to output can be specified directly as strings as shown above. Note that at this time, an improper character as URI should be expressed by the % encode. You can also specify it with Base64.
<!-- XSL-FO example -->
<fo:external-graphic src="data:application/vnd.ah-barcode;type=QR;base64,PD94bWwgdmVyc2lv..."/>
<!-- HTML example -->
<img src="data:application/vnd.ah-barcode;type=QR;base64,PD94bWwgdmVyc2lv..."/>
The barcode output is controlled by the parameter of the media type. The parameter is not case-sensitive. The type parameter is required and indicates the types of the barcode to output.
The barcode is always enforced by axf:image-smoothing="false".
CAUTION: | This document does not cover barcode specifications. Refer instead to the specification of each barcode type. |
---|
QR / Micro QR
QR codes complies with the international standard of ISO/IEC 18004:2006.
Barcode Generator Option only supports QR Model2, does not support Model1.
The following parameters can be specified.
Parameter | Value | Default | Contents | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
type | QR | Micro | <Required> | ||||||||||||||||
ver | auto | 1 to 40 | auto | 1 to 4 | auto | Version | |||||||||||||||
ecl | auto | L | M | Q | H | auto | Error correction level | ||||||||||||||||
enc | auto | [ N || A || B || K ] | auto | Encoding
| ||||||||||||||||
mpr | auto | 0 to 7 | auto | 0 to 3 | auto | Mask pattern reference | |||||||||||||||
scale | <positive-numbers> | 1 | Output size of 1 cell | ||||||||||||||||
qz | <non-negative-numbers> | 4 or 2 | Margin (quiet zone). Default: 4 for QR, 2 for MicroQR | ||||||||||||||||
out | svg | png | svg | Output formats | ||||||||||||||||
dpi | <non-negative-numbers> | 0 | The png image resolution (0, if nothing specified) | ||||||||||||||||
color | <color> | black | Barcode color | ||||||||||||||||
bgcolor | <color> | white | Barcode background-color | ||||||||||||||||
charset | <arbitrary-character-strings> | UTF-8 | Encoding by the direct character string specification |
By specifying auto for ver, an appropriate version will be applied according to the data length.
By specifying auto for ecl (error correction level), an appropriate error correction level will be applied according to the data and the version.
Multiple values can be specified to enc excluding auto. For instance, suppose enc=NAB is specified, these three are mixed and outputted appropriately. If failed to output with the specified encoding, an error will be generated.
Some sort of masking is given to QR so that a monochrome pattern may become even as much as possible. The mpr specification by the mask pattern reference enforces this processing to one particular pattern. It may be less uniformity than the pattern automatically selected, but it doesn't mean the wrong QR.
The specifiable format for scale as the output size of 1 cell differs between svg and png.
- svg
The positive real number with a unit can be specified. 0 or less cannot be specified. Enter a value and choose a unit option (em, ex, px, pt, pc, and in, cm, mm, jpt, q, twip or emu). If the unit is omitted, it is considered px.
- png
The integral value greater than or equal to 1 can be specified. The unit should not be included. When the value of a real number is specified, below the decimal point will be rounded down.
A value of the margin (quiet zone) which can be specified with the qz specification is 4 for QR and 2 for MicroQR. This value can be changed to smaller; however, we do not guarantee the best result.
The dpi specification for image resolution is effective only with png and the value of a real number can be specified. The unit should not be included.
Any color other than transparent can be specified for the color specification, however png is converted to RGB if color or bgcolor is specified. You can also specify transparent for the bgcolor specification.
- color=red
- color='#FF0000'
- color='rgb-icc(#Grayscale,0.5)'
In this example, note that a value is processed with quotation marks appropriately. If you do not use quotation marks, you must process a value with % escape appropriately as below:
- color=%23FF0000
- color=rgb-icc(%23Grayscale%2C0.5)
If semi-transparent is specified for color, the color tone of the barcode may differ between svg and png. While color of foreground is drawn on top of bgcolor of background in svg, bgcolor and color are not drawn overlapping in png.
The charset specification indicates the encoding outputted to QR when the character string is specified directly and it's not Base64. This setting is applied when kanji is not specified to the encoding. The data specified by Base64 is outputted as is with no conversion.
CAUTION: | QR cannot process all range of Shift JIS codes in kanji mode. These characters may not be readable for some QR readers. |
---|
CAUTION: | Structured Append is not supported. |
---|
Data Matrix
Data Matrix complies with the international standard of ISO/IEC 16022:2006.
Barcode Generator Option only supports ECC 200.
The following parameters can be specified.
Parameter | Value | Default | Contents | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
type | DataMatrix | DM | <Required> | |||||||||||||||||
enc | auto | [ A || C || T || X || E || B ] | raw | auto | Encoding
| ||||||||||||||||
shape | S | R | S |
Barcode shape
| ||||||||||||||||
scale | <positive-numbers> | 1 | Output size of 1 cell ☞ scale | ||||||||||||||||
qz | <non-negative-numbers> | 1 | Margin (quiet zone) | ||||||||||||||||
out | svg | png | svg | Output formats | ||||||||||||||||
dpi | <non-negative-numbers> | 0 | The png image resolution (0, if nothing specified) | ||||||||||||||||
color | <color> | black | Barcode color ☞ color | ||||||||||||||||
bgcolor | <color> | white | Barcode background-color ☞ color |
Multiple values other than auto or raw can be specified with the enc specification (encoding specification). For instance, when enc=ACE is specified, these three values are mixed and output properly. In this case, A is always considered to be specified even if it is not specified.
When raw is specified, the input data is output without change. In this case, note the following:
- No error correction code is included in the input data.
- Automatic padding is not applied so an error occurs if the data size does not reach the capacity of the matrix.
- We do not guarantee whether the input data meets the specification requirements.
The dpi specification for image resolution is effective only with png and the value of a real number can be specified. The unit should not be included.
CAUTION: | Structured Append is not supported. |
---|
PDF417
PDF417 complies with the international standard of ISO/IEC 15438:2006.
Barcode Generator Option does not support CompactPDF417, MacroPDF417 or MicroPDF417.
The following parameters can be specified.
Parameter | Value | Default | Contents | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
type | PDF417 | <Required> | |||||||||
enc | auto | [ T || N || B ] | auto | Encoding
| ||||||||
ecl | auto | 0 to 8 | auto | Error correction level | ||||||||
r | auto | 3 to 90 | auto | Number of rows | ||||||||
c | auto | 1 to 30 | auto | Number of columns per row (data only) | ||||||||
h | <positive-numbers> | 3 | Height of a row (proportion to the width) | ||||||||
scale | <positive-numbers> | 1 | Width of a bar ☞ scale | ||||||||
qzx | <non-negative-numbers> | 2 | Horizontal margin (quiet zone) | ||||||||
qzy | <non-negative-numbers> | 2 | Vertical margin (quiet zone) | ||||||||
out | svg | png | svg | Output formats | ||||||||
dpi | <non-negative-numbers> | 0 | The png image resolution (0, if nothing specified) | ||||||||
color | <color> | black | Barcode color ☞ color | ||||||||
bgcolor | <color> | white | Barcode background-color ☞ color |
Multiple values can be specified to enc excluding auto. For instance, suppose enc=TNB is specified, these three are mixed and outputted appropriately. If failed to output with the specified encoding, an error will be generated.
Bar code size can be specified with r and c. c specifies the number of columns for data only. Start pattern, left row identifier, right row identifier and end pattern are not included. If no values are specified with both r and c, their necessary values are automatically calculated. If a value is specified with either r or c, a value of the other one is automatically calculated. If values are specified with both of them, and the values are less than necessary size, an error occurs. The number of bars per row is c*17+69.
h specifies the height of the bar per row how many times longer than the width of the bar. In the specification, greater than or equal to 3 is required. A smaller value can be specified; however, we do not guarantee the best result.
A margin (quiet zone) can be specified with qzx and qzy. In the specification, greater than or equal to 2 is required. A smaller value can be specified; however, we do not guarantee the best result.
The dpi specification for image resolution is effective only with png and the value of a real number can be specified. The unit should not be included.
Aztec Code
Aztec Code complies with the international standard of ISO/IEC 24788:2008. The following parameters can be specified.
Parameter | Value | Default | Contents | |
---|---|---|---|---|
type | Aztec | Aztec | <Required> | |
ecl | 5 to 95 | 23 | Error correction level (%) (Invalid for AztecRune) | |
scale | <positive-numbers> | 1 | Output size of 1 cell ☞ scale | |
qz | <non-negative-numbers> | 0 | Margin (quiet zone) | |
out | svg | png | svg | Output formats | |
dpi | <non-negative-numbers> | 0 | The png image resolution (0, if nothing specified) | |
color | <color> | black | Barcode color ☞ color | |
bgcolor | <color> | white | Barcode background-color ☞ color |
In the case of AztecRune, a decimal character string from 0 to 255 is given as the input data.
ecl is the percentage of code generated from the input data. The total number of codes is at least (number of generated codes+3)*100/(100-ecl).
The dpi specification for image resolution is effective only with png and the value of a real number can be specified. The unit should not be included.
CAUTION: | Extended Channel Interpretation (ECI), Reader Initialization Symbol are not supported. Structured Append is not supported. |
---|
Customer Barcodes
Customer barcodes indicate Japan Post Customer Barcode or Intelligent Mail® Barcode, etc. The following parameters can be specified.
Parameter | Value | Default | Contents |
---|---|---|---|
type | JPCBC | <Required> | Japan Post Customer Barcode |
IMBC | Intelligent Mail® Barcode | ||
POSTNET | |||
l | <positive-numbers> | <Described later> | Length of long bar/full bar |
t | <positive-numbers> | <Described later> | Length of timing bar/tracker bar |
h | <positive-numbers> | <Described later> | Length of half bar (POSTNET only) |
w | <positive-numbers> | <Described later> | Width of bar |
p | <positive-numbers> | <Described later> | Pitch of bar |
hsp | <non-negative-numbers> | <Described later> | Horizontal margin |
vsp | <non-negative-numbers> | <Described later> | Vertical margin |
out | svg | png | svg | Output format |
dpi | <positive-numbers> | 384 | png image resolution |
color | <color> | black | Barcode color ☞ color |
bgcolor | <color> | white | Barcode background-color ☞ color |
The length and width of the bar, and the margin, etc should be the values with units. Enter a value and choose a unit option (pt, pc, in, cm, mm, jpt, q, twip or emu). The default values are as follows:
Parameters | JPCBC | IMBC | POSTNET |
---|---|---|---|
l | 3.6mm | 0.15in | 0.125in |
t | 1.2mm | 0.05in | |
h | 0.05in | ||
w | 0.6mm | 0.02in | 0.02in |
p | 1.2mm | 0.045in | 0.0416in |
hsp | 2.0mm | 0.125in | 0 |
vsp | 2.0mm | 0.028in | 0 |
When outputting png, the length and the width of the bar are rounded to the number of pixels by the dpi specification. Therefore, the output may differ slightly from the specified length. When a low resolution is specified, the barcode may not be correctly read.
The dpi specification for image resolution is effective only with png and the value of a real number can be specified. The unit should not be included.
Japan Post Customer Barcode
Japan Post Customer Barcode can be specified by the JPCBC value and the following characters can be specified. The first seven characters indicates the ZIP code. Then the numbers that show postal address will follow afterwards. If the postal address numbers indicates greater than 13 characters, by counting 2 alphabets as 1 character, then the latter parts greater than 13 characters will be discarded. Lower case will be converted into upper case.
0
Intelligent Mail® Barcode
Intelligent Mail® Barcode can be specified by the IMBC value and only numbers with the determined digit numbers can be specified. The allowed digit numbers are 20, 25, 29 or 31. In addition, the second digit must be 0 to 4.
POSTNET
Only numbers with the determined digit numbers can be specified to POSTNET. The allowed digit numbers are 5, 9, or 11.
Linear Barcodes
Linear barcodes indicate 1 dimensional barcodes. The following parameters can be specified.
Parameter | Value | Default | Contents |
---|---|---|---|
type | EAN | JAN | <Required> | |
UPC | UPC-A, UPC-E | ||
ITF | Interleaved 2of5 | ||
Codabar | NW-7 | |||
Code39 | |||
Code128 | |||
GS1-128 | EAN-128 | |||
w | <positive-numbers> | 0.33mm | Width of thin bar |
r | <positive-numbers> | 2.5 | Width ratio between thin and wide bars It's not used with EAN JAN UPC Code128 GS1-128 EAN-128 |
h | <positive-numbers> | 22.86mm | Height of bar |
qz | <non-negative-numbers> | 10 | Specifies the horizontal margin (quiet zone) by the number of thin bars |
reduc | <positive-numbers> | 1 | Display magnification of the bar width (effective only with svg output) V7.3MR3 |
scale | <positive-numbers> | 1 | Display magnification |
out | svg | png | svg | Output format |
dpi | <positive-numbers> | 384 | png image resolution |
color | <color> | black | Barcode color ☞ color |
bgcolor | <color> | white | Barcode background-color ☞ color |
text | none | auto | center | justify | none | Specifies how the text of an original code is displayed under the barcode (effective only with svg output) |
The length and width of the bar, and the margin, etc should be the values with units. Enter a value and choose a unit option (pt, pc, in, cm, mm, jpt, q, twip or emu).
When outputting png, the length and the width of the bar are rounded to the number of pixels by the dpi specification. Therefore, the output may differ slightly from the specified length. When a low resolution is specified, the barcode may not be correctly read.
The dpi specification for image resolution is effective only with png and the value of a real number can be specified. The unit should not be included.
You can display the text of an original code under the barcode by specifying values to text. Only the typical display format can be specified. This is effective only with svg output. Specify the font you want to use by barcode-text-font in Option Setting File. The size of a character is automatically calculated from the size of a barcode.
- none
Does not display text.
- auto
With JAN/EAN/UPC, the standard output, like drawing out a part of bar and pushing the beginning character toward left, will be performed. With other than JAN/EAN/UPC, it is treated as center.
- center
Displays centered text.
- justify
Displays justified text by fitting the right and left edge of the text on the width of the barcode.
EAN / JAN
EAN complies with the international standard of ISO/IEC 15420:2009. JAN is the same as EAN. In EAN/JAN, the allowed digit numbers are 13 or 8 only by the figure. The last digit is the check digit. It is acceptable to input 12 digits or 7 digits excluding the check digit. When 13 digits or 8 digits are given, the last digit will be ignored, calculated and replaced correctly when outputted.
UPC
In UPC, the allowed digit numbers are 12 or 8 only by the figure. 12 digits are UPC-A, and eight digits are UPC-E. In UPC-E, the first digit must be 0 or 1. The last digit is the check digit. It is acceptable to input 11 digits or 7 digits excluding the check digit. When 12 digits or 8 digits are given, the last digit will be ignored, calculated and replaced correctly when outputted. UPC-D is not supported.
Interleaved 2of5
Interleaved 2of5 complies with the international standard of ISO/IEC 16390:2007. Interleaved 2of5 can be specified with ITF. In ITF, only the figure in the even number digit can be specified.
Codabar / NW-7
In Codabar/NW-7, the beginning of a string must be one of ABCD. The end character must be one of ABCD or TN*E. The character in the middle can be specified from the following in any arbitrary digit. The lower case of the beginning and end of English letters will be converted into the upper case.
0
You can specify whether to add the check digit or not. When the check digit is added, there may be a limit on characters that can be used.
Parameter | Value | Default | Contents | Limitations |
---|---|---|---|---|
cd | none | none | None | |
m10w2 | Modulus 10 weight 2 | Only figures available except for the beginning and end of characters. | ||
m10w2r | Modulus 10 weight 2 runes | Only figures available except for the beginning and end of characters. | ||
m10w3 | Modulus 10 weight 3 | Only figures available except for the beginning and end of characters. | ||
m11 | Modulus 11 | Only figures with greater than or equal to 6 digits available except for the beginning and end of characters. | ||
wm11 | Weight modulus 11 | Only figures with less than or equal to 12 digits available except for the beginning and end of characters. | ||
m16 | Modulus 16 | |||
7dr | 7dsr | 7 check DR/DSR | Only figures available except for the beginning and end of characters. | ||
9dr | 9dsr | 9 check DR/DSR | Only figures available except for the beginning and end of characters. |
Code39
Code39 complies with the international standard of ISO/IEC 16388:2007. In Code39, the following characters can be specified in any arbitrary digit. The lower case of the beginning and end of English letters will be converted into the upper case.
0
You can specify whether to add the check digit or not.
Parameter | Value | Default | Contents |
---|---|---|---|
cd | none | m43 | None |
m43 | Modulus 43 |
Code128
Code128 complies with the international standard of ISO/IEC 15417:2007. In Code128, three types of code sets, CODE-A, CODE-B, and CODE-C can be specified by parameters.
Parameter | Value | Default |
---|---|---|
code | A | B | C | B |
In Code128, any arbitrary characters of U+0000 to U+007F can be expressed. Among these, U+0000 to U+001F, U+007F, and the control code will be substituted by another codes.
|
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The following characters are available to input.
|
GS1-128 / EAN-128
GS1-128/EAN-128 is Code128 with some kind of restriction. Barcode Generator Option will check the following points (or may not). The restrictions other than these are the same as Code128.
- It is necessary to start with FNC1.
- Characters that can be used excluding the control code are as follows (white space is not included):
!"%&'()*+-./0123456789:;<=>?
ABCDEFGHIJKLMNOPQRSTUVWXYZ_
abcdefghijklmnopqrstuvwxyz - FNC2 and FNC4 cannot be used.
- Recognizes the already-known application identifier (AI) and check the number of characters. Does not check the character format.
- Does not check FNC1 in case of the fixed length even if is a necessary format.
The following shows the already registered AI. If you want to change the format or AI is not listed here, it is possible to add changes in Option Setting File. * as the last digit of AI allows any arbitrary digit. For instance, 310* indicates 3100 to 3109. Format has the following meanings. The last F of the format shows that FNC1 is required.
- n3 : 3-digit numbers
- x3 : 3-digit arbitrary characters
- n-10 : Numbers with greater than or equal to 1 and less than or equal to 10 digits.
- x3-10 : Arbitrary characters with greater than or equal to 3 and less than or equal to 10 digits.
|
|
|
|
|
Note: The format of 23* is the fixed length of digit number 2*+1 against the number * of the last digits. For instance, if it is 234, it becomes x9.