Barcodes as image

Generate barcodes as image following the same logic as for Pictures:

  1. Insert a temporary picture in your template (white JPEG image, or cat PNG image). The temporary image is used to find the location to insert the barcode.

  2. 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.

  3. Insert the type of barcode as a first argument of the formatter :barcode. Refer to theSupported barcodes below.

  4. 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

const data = {
  urlQrCode: "http://carbone.io/",
  productCodeBarEan13: "2112345678900",
  productGs1: "(01)95012345678903(3103)000123"
};
  1. Retrieve your barcode data as JSON from your database.

  2. 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)}

Supported barcodes

Barcode name
Type

EAN-5 (5 digit add-on)

ean5

EAN-2 (2 digit add-on)

ean2

EAN-13

ean13

EAN-8

ean8

UPC-A

upca

UPC-E

upce

ISBN

isbn

ISMN

ismn

ISSN

issn

Code 128

code128

GS1-128

gs1-128

GS1-14

ean14

SSCC-18

sscc18

Code 39

code39

Code 39 Extended

code39ext

Italian Pharmacode

code32

Pharmazentralnummer (PZN)

pzn

Code 93

code93

Code 93 Extended

code93ext

Interleaved 2 of 5 (ITF)

interleaved2of5

ITF-14

itf14

Deutsche Post Identcode

identcode

Deutsche Post Leitcode

leitcode

GS1 DataBar Omnidirectional

databaromni

GS1 DataBar Stacked

databarstacked

GS1 DataBar Stacked Omnidirectional

databarstackedomni

GS1 DataBar Truncated

databartruncated

GS1 DataBar Limited

databarlimited

GS1 DataBar Expanded

databarexpanded

GS1 DataBar Expanded Stacked

databarexpandedstacked

GS1 North American Coupon

gs1northamericancoupon

Pharmaceutical Binary Code

pharmacode

Two-track Pharmacode

pharmacode2

Code 25

code2of5

Industrial 2 of 5

industrial2of5

IATA 2 of 5

iata2of5

Matrix 2 of 5

matrix2of5

COOP 2 of 5

coop2of5

Datalogic 2 of 5

datalogic2of5

Code 11

code11

BC412

bc412

Codabar

rationalizedCodabar

USPS Intelligent Mail

onecode

USPS POSTNET

postnet

USPS PLANET

planet

Royal Mail 4 State Customer Code

royalmail

AusPost 4 State Customer Code

auspost

Royal Dutch TPG Post KIX

kix

Japan Post 4 State Customer Code

japanpost

MSI Modified Plessey

msi

Plessey UK

plessey

Telepen

telepen

Telepen Numeric

telepennumeric

PosiCode

posicode

Codablock F

codablockf

Code 16K

code16k

Code 49

code49

Channel Code

channelcode

Flattermarken

flattermarken

Custom 1D symbology

raw

Custom 4 state symbology

daft

Miscellaneous symbols

symbol

PDF417

pdf417

Compact PDF417

pdf417compact

MicroPDF417

micropdf417

Data Matrix

datamatrix

Data Matrix Rectangular

datamatrixrectangular

Data Matrix Rectangular Extension

datamatrixrectangularextension

Royal Mail Mailmark

mailmark

QR Code

qrcode

Swiss QR Code

swissqrcode

Micro QR Code

microqrcode

Rectangular Micro QR Code

rectangularmicroqrcode

MaxiCode

maxicode

Aztec Code

azteccode

Compact Aztec Code

azteccodecompact

Aztec Runes

aztecrune

Code One

codeone

Han Xin Code

hanxin

DotCode

dotcode

Ultracode

ultracode

GS1 Composite 2D Component

gs1-cc

EAN-13 Composite

ean13composite

EAN-8 Composite

ean8composite

UPC-A Composite

upcacomposite

UPC-E Composite

upcecomposite

GS1 DataBar Omnidirectional Composite

databaromnicomposite

GS1 DataBar Stacked Composite

databarstackedcomposite

GS1 DataBar Stacked Omnidirectional Composite

databarstackedomnicomposite

GS1 DataBar Truncated Composite

databartruncatedcomposite

GS1 DataBar Limited Composite

databarlimitedcomposite

GS1 DataBar Expanded Composite

databarexpandedcomposite

GS1 DataBar Expanded Stacked Composite

databarexpandedstackedcomposite

GS1-128 Composite

gs1-128composite

GS1 Data Matrix

gs1datamatrix

GS1 Data Matrix Rectangular

gs1datamatrixrectangular

GS1 QR Code

gs1qrcode

GS1 DotCode

gs1dotcode

HIBC Code 39

hibccode39

HIBC Code 128

hibccode128

HIBC Data Matrix

hibcdatamatrix

HIBC Data Matrix Rectangular

hibcdatamatrixrectangular

HIBC PDF417

hibcpdf417

HIBC MicroPDF417

hibcmicropdf417

HIBC QR Code

hibcqrcode

HIBC Codablock F

hibccodablockf

HIBC Aztec Code

hibcazteccode

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: {d.number:barcode(qrcode, width:300)}. To scale the barcode, it is possible to chain the formatter :imageFit, such as: {d.number:barcode(qrcode, width:300):imageFit(contain)}.

height

integer

Height a number as millimeters.

Example: {d.number:barcode(qrcode, height:10)}. To scale the barcode, it is possible to chain the formatter :imageFit, such as: {d.urlQrCode:barcode(qrcode, height:10):imageFit(contain)}.

scale

integer

Quality of the barcode as a number between 1 to 10. It multiplies the width and height, creating a bigger resolution barcode. Example: {d.number:barcode(qrcode, scale:3)}

includetext

boolean

Show the text and takes a Boolean as value, true or false.

Example: {d.number:barcode(qrcode, includetext:false)}

textsize

integer

Change the text size. Example: {d.number:barcode(qrcode, textsize:20)}

textxalign

string

Change the alignment of the text horizontally. Takes only 4 values: left, center, right, or justify. The default value is center. Example: {d.number:barcode(qrcode, textxalign:right)}

textyalign

string

Change the alignment of the text vertically. Takes only 3 values: below, center, or above. The default value is below.

Example: {d.number:barcode(qrcode, textyalign:above)}

rotate

string

Rotate the barcode and the text. Takes only 4 values (case insensitive): N for not rotated, R for 90 degree right rotation, L for 90 degree left rotation, I of 180 degree rotation. Example: {d.number:barcode(qrcode, rotate:R)}

barcolor

string

Color of bars as hexadecimal #RRGGBB (6 characters required & case insensitive).

Example: {d.number:barcode(qrcode, barcolor:#1FDE25)}

textcolor

string

Color of the text as hexadecimal #RRGGBB (6 characters required & case insensitive).

Example: {d.number:barcode(qrcode, textcolor:#1FDE25)}

backgroundcolor

string

Color of the background as hexadecimal #RRGGBB (6 characters required & case insensitive).

Example: {d.number:barcode(qrcode, backgroundcolor:#1FDE25)}

eclevel

string

Specify the error correction level: L for Low, M for Medium (default), Q for Quality and H for High. Option ONLY FOR QRCODES, Micro QR Code, GS1 QR Code, HIBC QR Code, or Swiss QR Code. Example: {d.number:barcode(qrcode, eclevel:Q)}

Last updated