Barcodes as image
Generate barcodes as image following the same logic as for Pictures:
Insert a temporary picture in your template (white
JPEG
image, or catPNG
image). The temporary image is used to find the location to insert the barcode.Write the marker followed by the barcode formatter into the alternative text, description, or title of the image. The format should be:
{d.value:barcode(type)}
. Refer to Pictures for more info.Insert the
type
of barcode as a first argument of the formatter:barcode
. Refer to theSupported barcodes below.Generate the document.
Barcode options are available and can be passed to the barcode
formatter as a second argument, such as :barcode(type, options1, options2, ...)
. Refer to the Barcodes options below.
Example
This example shows how to insert 3 barcodes as images:
ean13
qrcode
gs1
Data
Retrieve your barcode data as
JSON
from your database.Edit your template in a text editor, insert 3 temporary images. For each image, write as an alternative text tags:
First image:
{d.urlQrCode:barcode(qrcode)}
Second image:{d.productCodeBarEan13:barcode(ean13)}
Third image:
{d.productGs1:barcode(gs1-128)}
To scale the barcode, chain the formatter :imageFit
, such as {d.urlQrCode:barcode(qrcode):imageFit(contain)}
. Learn more about the imageFit formatter.
Supported barcodes
Barcode name | Type |
---|---|
EAN-5 (5 digit add-on) |
|
EAN-2 (2 digit add-on) |
|
EAN-13 |
|
EAN-8 |
|
UPC-A |
|
UPC-E |
|
ISBN |
|
ISMN |
|
ISSN |
|
Code 128 |
|
GS1-128 |
|
GS1-14 |
|
SSCC-18 |
|
Code 39 |
|
Code 39 Extended |
|
Italian Pharmacode |
|
Pharmazentralnummer (PZN) |
|
Code 93 |
|
Code 93 Extended |
|
Interleaved 2 of 5 (ITF) |
|
ITF-14 |
|
Deutsche Post Identcode |
|
Deutsche Post Leitcode |
|
GS1 DataBar Omnidirectional |
|
GS1 DataBar Stacked |
|
GS1 DataBar Stacked Omnidirectional |
|
GS1 DataBar Truncated |
|
GS1 DataBar Limited |
|
GS1 DataBar Expanded |
|
GS1 DataBar Expanded Stacked |
|
GS1 North American Coupon |
|
Pharmaceutical Binary Code |
|
Two-track Pharmacode |
|
Code 25 |
|
Industrial 2 of 5 |
|
IATA 2 of 5 |
|
Matrix 2 of 5 |
|
COOP 2 of 5 |
|
Datalogic 2 of 5 |
|
Code 11 |
|
BC412 |
|
Codabar |
|
USPS Intelligent Mail |
|
USPS POSTNET |
|
USPS PLANET |
|
Royal Mail 4 State Customer Code |
|
AusPost 4 State Customer Code |
|
Royal Dutch TPG Post KIX |
|
Japan Post 4 State Customer Code |
|
MSI Modified Plessey |
|
Plessey UK |
|
Telepen |
|
Telepen Numeric |
|
PosiCode |
|
Codablock F |
|
Code 16K |
|
Code 49 |
|
Channel Code |
|
Flattermarken |
|
Custom 1D symbology |
|
Custom 4 state symbology |
|
Miscellaneous symbols |
|
PDF417 |
|
Compact PDF417 |
|
MicroPDF417 |
|
Data Matrix |
|
Data Matrix Rectangular |
|
Data Matrix Rectangular Extension |
|
Royal Mail Mailmark |
|
QR Code |
|
Swiss QR Code |
|
Micro QR Code |
|
Rectangular Micro QR Code |
|
MaxiCode |
|
Aztec Code |
|
Compact Aztec Code |
|
Aztec Runes |
|
Code One |
|
Han Xin Code |
|
DotCode |
|
Ultracode |
|
GS1 Composite 2D Component |
|
EAN-13 Composite |
|
EAN-8 Composite |
|
UPC-A Composite |
|
UPC-E Composite |
|
GS1 DataBar Omnidirectional Composite |
|
GS1 DataBar Stacked Composite |
|
GS1 DataBar Stacked Omnidirectional Composite |
|
GS1 DataBar Truncated Composite |
|
GS1 DataBar Limited Composite |
|
GS1 DataBar Expanded Composite |
|
GS1 DataBar Expanded Stacked Composite |
|
GS1-128 Composite |
|
GS1 Data Matrix |
|
GS1 Data Matrix Rectangular |
|
GS1 QR Code |
|
GS1 DotCode |
|
HIBC Code 39 |
|
HIBC Code 128 |
|
HIBC Data Matrix |
|
HIBC Data Matrix Rectangular |
|
HIBC PDF417 |
|
HIBC MicroPDF417 |
|
HIBC QR Code |
|
HIBC Codablock F |
|
HIBC Aztec Code |
|
Barcodes options
Pass the option as a second argument in any order. The option must keep the format "optionName:value", such as {d.number:barcode(qrcode, width:300, height:100, includetext:false, scale:1)}
.
Option name | Type | Description |
---|---|---|
width | integer | Width a number as millimeters. Example: |
height | integer | Height a number as millimeters. Example: |
scale | integer | Quality of the barcode as a number between |
includetext | boolean | Show the text and takes a Boolean as value, Example: |
textsize | integer | Change the text size. Example: |
textxalign | string | Change the alignment of the text horizontally. Takes only 4 values: |
textyalign | string | Change the alignment of the text vertically. Takes only 3 values: Example: |
rotate | string | Rotate the barcode and the text. Takes only 4 values (case insensitive): |
barcolor | string | Color of bars as hexadecimal Example: |
textcolor | string | Color of the text as hexadecimal Example: |
backgroundcolor | string | Color of the background as hexadecimal Example: |
eclevel | string | Specify the error correction level: |
Last updated