Skip to main content
Version: 1.28 (Current)

Generate Barcode

Audience: Low-code Engineers

Skill Prerequisites: Actions, Tokens

Creates a one-dimensional (1D) barcode image from a value, for example an order number or product code, and saves it as a JPEG file in a portal folder. You choose the barcode type, the image size and whether the value is printed under the bars. The action can return the file's name, URLs, path and Base64 content as tokens.

note

This action is part of the Barcode Generator add-on. The add-on is installed separately and requires the BARCODE feature package to be licensed. If it isn't licensed, the action fails with a not-licensed error. Once installed, the action is available in all modules that run actions.

Typical Use Cases​

  • Create a barcode label for an order, ticket or asset when a record is saved
  • Add a barcode to a PDF or email, using the image's URL or Base64 content
  • Create an EAN-13 barcode for a product from its product number
  • Create barcodes for shipping cartons with ITF-14

Don't use it to​

  • Encode URLs, long text or contact details for phones to scan. Use Generate QR Code instead.
  • Read or scan barcodes. This action only creates images.
  • Create PNG or transparent images. The image is always a JPEG with black bars on a white background.

Barcode or QR code?​

Generate BarcodeGenerate QR Code
ShapeBars (1D)Square grid (2D)
Best forShort codes read by barcode scanners: product numbers, order IDs, asset tagsURLs, longer text, anything scanned with a phone camera
DataDepends on the type. Some types take digits only.Any text
Image formatJPEGPNG
Colors and logoBlack on white onlyCustom colors and an optional icon in the middle
Action NameDescription
Generate QR CodeCreates a QR code image instead of a barcode.
Generate PDFCreates a PDF, for example a label that includes the barcode image.
Send EmailSends the barcode image by email.
Create ThumbnailMakes a resized copy of an image.
Delete FileDeletes a barcode image you no longer need.

Input Parameter Reference​

ParameterDescriptionSupports TokensDefaultRequired
BarcodeThe value to encode, for example [OrderId]. It must fit the rules of the chosen Barcode Encoding. See Barcode types.Yesempty stringYes
Barcode EncodingThe barcode type, for example code128b or ean. It can also be a token or expression that returns one of the type names. Upper and lower case are both accepted.Yescode128bYes
Barcode image widthThe image width in pixels, for example 300.Yesempty stringYes
Barcode image heightThe image height in pixels, for example 100.Yesempty stringYes
Show textWhen checked, the encoded value is printed under the bars.NoUncheckedNo
Upload to FolderThe portal folder to save the image in. It's created if it doesn't exist. If it's empty, the image is saved in Temp.Yes/ (the root folder)Yes
SignatureNameThe image's file name, without the extension, for example order-[OrderId]. .jpeg is always added. If it's empty, a random name (a GUID) is used.Yesempty stringNo
FileName Token NameThe name of a token to store the file name in.Yesempty stringNo
Absolute Url Token NameThe name of a token to store the full URL of the image in.Yesempty stringNo
Relative Url Token NameThe name of a token to store the URL of the image, relative to the site, in.Yesempty stringNo
Portal Path Token NameThe name of a token to store the image's path inside the portal's file system in.Yesempty stringNo
File Path Token NameThe name of a token to store the physical path on the server in.Yesempty stringNo
Base64 Token NameThe name of a token to store the image's content, Base64 encoded, in.Yesempty stringNo

Output Parameters Reference​

Each output has its own token name parameter. A token is only created when you fill in its name. Write the name without brackets, for example BarcodeUrl, and use it later as [BarcodeUrl].

Token name parameterContainsExample
FileName Token NameThe file name with the extension.order-1001.jpeg
Absolute Url Token NameThe full, direct URL of the image.https://example.com/Portals/0/Barcodes/order-1001.jpeg
Relative Url Token NameThe direct URL of the image, relative to the site. Use this in an <img> tag./Portals/0/Barcodes/order-1001.jpeg
Portal Path Token NameThe folder and file name inside the portal./Barcodes/order-1001.jpeg
File Path Token NameThe physical path of the file on the server.C:\...\Portals\0\Barcodes\order-1001.jpeg
Base64 Token NameThe JPEG image, Base64 encoded, without a data: prefix./9j/4AAQSkZJRg...

To show the Base64 image directly in HTML, add the prefix yourself: <img src="data:image/jpeg;base64,[BarcodeBase64]" />.

Barcode types​

The value in Barcode must follow the rules of the chosen type. If it doesn't, the action fails with an error from the barcode library.

Barcode EncodingTypeWhat it can encode
code128Code 128Letters, digits and punctuation. A good default for general IDs.
code128ACode 128 AUppercase letters, digits, punctuation and control characters.
code128bCode 128 BUppercase and lowercase letters, digits and punctuation.
code128cCode 128 CDigits only. Encodes pairs of digits, so long numbers make shorter barcodes.
code39Code 39Uppercase letters, digits, space and - . $ / + %.
code93Code 93A more compact alternative to Code 39.
eanEAN-13Digits only: 12 digits plus a check digit. Used for retail products.
upcUPC-EDigits only. This is the short UPC-E format, not the 12-digit UPC-A.
itf14ITF-14Digits only: 13 digits plus a check digit. Used on shipping cartons.
interleaved2of5Interleaved 2 of 5Digits only, in an even number.
standard2of5Standard 2 of 5Digits only.
industrial2of5Industrial 2 of 5Digits only.
codabarCodabarDigits and - $ : / . +, starting and ending with one of the letters A, B, C or D.

If you're not sure which type to use, check what the scanner or the receiving system expects. For internal IDs, code128 is usually a safe choice.

Considerations​

  • The image is a JPEG. The file always gets the .jpeg extension. Don't add an extension to SignatureName, or the file ends up as name.png.jpeg.
  • Some characters in the name are replaced. Slashes (/), spaces and colons (:) in SignatureName become dashes (-).
  • Existing files are replaced. If a file with the same name is already in the folder, it's overwritten. Leave SignatureName empty, or include something unique such as an ID, to keep every barcode.
  • Width and height must be numbers. Use whole numbers greater than zero. An empty value, or a width too small for the data, makes the action fail. Longer values need wider images.
  • Show text uses part of the height. The text is drawn inside the image, so the bars get shorter.
  • Invalid values fail. An empty Barcode, characters the type doesn't accept, or an unknown Barcode Encoding (Encoding is not known.) stop the action with an error. Use a condition, or the On Error actions of Execute Actions, to handle this. See Common Parameters.
  • The URLs are direct links. The URL tokens point straight to the file, so they work for files in standard folders, not secure or database folders.
  • No file ID. The action doesn't return the file's ID. Use the path or URL tokens instead.

Examples​

tip

To understand how to use the below examples, please see Running Examples.

1. Order number barcode with text​

This action creates a Code 128 barcode for the OrderId token, with the number printed under the bars. It saves the image in the Barcodes folder as order-<OrderId>.jpeg and puts its URL in [BarcodeUrl].

{
"Title": "Generate Barcode",
"ActionType": "BarCodeGenerator",
"Description": "Create a barcode for the order",
"Parameters": {
"Label": "[OrderId]",
"EncodeType": "code128",
"Width": "300",
"Height": "100",
"IncludeLabel": true,
"Folder": "Barcodes/",
"SignatureName": "order-[OrderId]",
"RelativeUrlTokenName": "BarcodeUrl",
"FileNameTokenName": "BarcodeFileName"
}
}

You can then show it with <img src="[BarcodeUrl]" />.

2. EAN-13 barcode as Base64​

This action creates an EAN-13 barcode for a 12-digit product number and returns the image as Base64 in [ProductBarcode], for example to embed it in an email. The file name is random.

{
"Title": "Generate Barcode",
"ActionType": "BarCodeGenerator",
"Description": "Create an EAN-13 barcode for the product",
"Condition": "[ProductNumber] != \"\"",
"Parameters": {
"Label": "[ProductNumber]",
"EncodeType": "ean",
"Width": "250",
"Height": "120",
"IncludeLabel": true,
"Folder": "Barcodes/Products/",
"SignatureName": "",
"Base64TokenName": "ProductBarcode"
}
}

Revised 09/27/2026