PowerBuilder Barcode Integration
The definitive guide to local DLL processing, Cloud API integration, and DataWindow font rendering.
01
Local .NET Core DLL Integration
Utilizing DotNetObject allows you to perform complex barcode encoding logic directly on the client machine without network latency. This is ideal for 2D barcodes like QR Code, Aztec, and DataMatrix.
Full PowerScript Setup
DotNetAssembly lnv_Asm
DotNetObject lnv_Encoder
Long ll_ret
lnv_Asm = Create DotNetAssembly
// Ensure .NET Runtime is installed
ll_ret = lnv_Asm.LoadWithDotNetCore("cruflbcsnet.dll")
IF ll_ret = 1 THEN
lnv_Encoder = lnv_Asm.CreateInstance("Barcodesoft.Encoder")
// Encode returns a string formatted for the BCS font
ls_barcode_data = lnv_Encoder.Encode(ls_input)
dw_1.SetItem(row, "barcode_col", ls_barcode_data)
ELSE
MessageBox("Error", "Failed to load .NET DLL. Check Runtime.")
END IF
02
Cloud REST API (No-Code Setup)
For zero-footprint deployments, use the REST API. PowerBuilder's DataWindow handles this via the Bitmap() expression.
Expression for Computed Field:
Bitmap("https://www.barcodesoft.com/barcode/qrcode/token=YOUR_TOKEN&text=" + id_field + "&format=png")
Tip: Use a small PNG format to reduce DataWindow retrieval time.
03
DataWindow Design Steps
To ensure the barcode scans correctly, follow these UI adjustments in the DataWindow Painter:
- Font Selection: Set the column font to the specific barcode font (e.g.,
BCSQRcode). - Anti-Aliasing: Disable "TrueType" smoothing in Windows font settings if the barcode appears blurry.
- Column Size: Ensure the column is wide enough to prevent "clipping," which renders the barcode unreadable.
- Autosize Height: Enable this property if the amount of data encoded varies significantly.
Choosing Your Method
| Feature | .NET DLL | REST API |
|---|---|---|
| Internet Required | No | Yes |
| Batch Performance | High (Instant) | Medium (Network Latency) |
| Ease of Setup | Requires Runtime | Plug & Play |