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

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

Last updated