How to Print Aztec Barcodes in Visual Basic (VB.NET)
Generate high-resolution Aztec barcodes within your Visual Basic applications using the Barcodesoft BCSAztec TrueType font and COM components.
Prerequisites
- BCSAztec.ttf: The core TrueType font.
- cruflbcs.dll: The COM object library (found in
C:\Program Files (x86)\Common Files\Barcodesoft\Fontutil\).
Method 1: Late Binding
Best for version independence. No need to set references at compile time, though it runs slightly slower than early binding.
' Late Binding Example
Dim cruflBCSObj As Object
Set cruflBCSObj = CreateObject("cruflBCS.Aztec.1")
cruflBCSObj.SetCRLF(1)
cruflBCSObj.ECLevel = 23
Dim retval As String
retval = cruflBCSObj.Encode(strTemp)
' Apply BCSAztec font to retval
Method 2: Early Binding
Best for high performance. Requires adding a project reference to the cruflBCS.dll type library.
' Early Binding Example
' 1. Project > Add Reference > cruflBCS.dll
Dim obj As cruflBCS.CBcsAztec
Set obj = New cruflBCS.CBcsAztec
obj.ECLevel = 23
Dim qrcode As String
qrcode = obj.Encode(strToEncode)
Set obj = Nothing
Important: After calling the Encode method, you must apply the BCSAztec font typeface to the returned string in your UI (Label, TextBox, or Report) to render the barcode image.