Generate Barcode
Audience:
Low-code EngineersSkill 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.
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 Barcode | Generate QR Code | |
|---|---|---|
| Shape | Bars (1D) | Square grid (2D) |
| Best for | Short codes read by barcode scanners: product numbers, order IDs, asset tags | URLs, longer text, anything scanned with a phone camera |
| Data | Depends on the type. Some types take digits only. | Any text |
| Image format | JPEG | PNG |
| Colors and logo | Black on white only | Custom colors and an optional icon in the middle |
Related Actions
| Action Name | Description |
|---|---|
| Generate QR Code | Creates a QR code image instead of a barcode. |
| Generate PDF | Creates a PDF, for example a label that includes the barcode image. |
| Send Email | Sends the barcode image by email. |
| Create Thumbnail | Makes a resized copy of an image. |
| Delete File | Deletes a barcode image you no longer need. |
Input Parameter Reference
| Parameter | Description | Supports Tokens | Default | Required |
|---|---|---|---|---|
| Barcode | The value to encode, for example [OrderId]. It must fit the rules of the chosen Barcode Encoding. See Barcode types. | Yes | empty string | Yes |
| Barcode Encoding | The 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. | Yes | code128b | Yes |
| Barcode image width | The image width in pixels, for example 300. | Yes | empty string | Yes |
| Barcode image height | The image height in pixels, for example 100. | Yes | empty string | Yes |
| Show text | When checked, the encoded value is printed under the bars. | No | Unchecked | No |
| Upload to Folder | The 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 |
| SignatureName | The 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. | Yes | empty string | No |
| FileName Token Name | The name of a token to store the file name in. | Yes | empty string | No |
| Absolute Url Token Name | The name of a token to store the full URL of the image in. | Yes | empty string | No |
| Relative Url Token Name | The name of a token to store the URL of the image, relative to the site, in. | Yes | empty string | No |
| Portal Path Token Name | The name of a token to store the image's path inside the portal's file system in. | Yes | empty string | No |
| File Path Token Name | The name of a token to store the physical path on the server in. | Yes | empty string | No |
| Base64 Token Name | The name of a token to store the image's content, Base64 encoded, in. | Yes | empty string | No |
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 parameter | Contains | Example |
|---|---|---|
| FileName Token Name | The file name with the extension. | order-1001.jpeg |
| Absolute Url Token Name | The full, direct URL of the image. | https://example.com/Portals/0/Barcodes/order-1001.jpeg |
| Relative Url Token Name | The direct URL of the image, relative to the site. Use this in an <img> tag. | /Portals/0/Barcodes/order-1001.jpeg |
| Portal Path Token Name | The folder and file name inside the portal. | /Barcodes/order-1001.jpeg |
| File Path Token Name | The physical path of the file on the server. | C:\...\Portals\0\Barcodes\order-1001.jpeg |
| Base64 Token Name | The 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 Encoding | Type | What it can encode |
|---|---|---|
code128 | Code 128 | Letters, digits and punctuation. A good default for general IDs. |
code128A | Code 128 A | Uppercase letters, digits, punctuation and control characters. |
code128b | Code 128 B | Uppercase and lowercase letters, digits and punctuation. |
code128c | Code 128 C | Digits only. Encodes pairs of digits, so long numbers make shorter barcodes. |
code39 | Code 39 | Uppercase letters, digits, space and - . $ / + %. |
code93 | Code 93 | A more compact alternative to Code 39. |
ean | EAN-13 | Digits only: 12 digits plus a check digit. Used for retail products. |
upc | UPC-E | Digits only. This is the short UPC-E format, not the 12-digit UPC-A. |
itf14 | ITF-14 | Digits only: 13 digits plus a check digit. Used on shipping cartons. |
interleaved2of5 | Interleaved 2 of 5 | Digits only, in an even number. |
standard2of5 | Standard 2 of 5 | Digits only. |
industrial2of5 | Industrial 2 of 5 | Digits only. |
codabar | Codabar | Digits 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
.jpegextension. Don't add an extension to SignatureName, or the file ends up asname.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 theOn Erroractions 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
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