Barcode Generation
Last updated
Was this helpful?
The Barcode class provides functionality to generate over 100 different types of 1D and 2D barcodes and return them as Base64 encoded images. It is a utility class with only static methods, so you do not need to create an instance.
This function creates a barcode image based on the provided type, text, and configuration options. It returns a base64 encoded string of the generated PNG image.
Parameters
type: The type of barcode to generate. A full list of supported types can be found here (e.g., qrcode, code128, ean13, pdf417).
text: The string of text or data that you want to encode into the barcode.
options: An object containing various options to customize the appearance of the barcode. A full list of options can be found in the Options Reference.
This example generates a standard QR code for a URL.
# type
qrcode
# text
https://heisenware.comThis example creates a code128 barcode, scales it, includes the human-readable text, and applies custom colors.
# type
code128
# text
Heisenware Rocks!
# options
scale: 3
includeText: true
textAlign: center
barColor: 0F7180
textColor: 0F7180This example generates an ean13 barcode (which requires a 12-digit input) and rotates it 90 degrees to the right.
Output
The Function Outputs a base64 encoded string representing the generated barcode image. For example: iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACt...
Last updated
Was this helpful?
Was this helpful?
# type
ean13
# text
400638133393
# options
scale: 4
rotate: R