Skip to footer content
USING IRONBARCODE

VB .NET Barcode Font: How to Generate and Print Bar Codes Without Font Dependencies

If you’re wondering how to handle a VB .NET barcode font in a real-world application, you’re not alone. Barcode fonts like Code 39 or Code 128 often cause issues once you move past simple demos, fonts need to be installed everywhere, printers don’t always respect them, and deployments can break when something is missing.

This article shows a simpler approach: generating barcodes as images in VB.NET using IronBarcode. It’s the method we recommend internally because it avoids the deployment and printer problems that barcode fonts tend to introduce.

By the end, you’ll understand why barcode fonts fall short and how to generate Code 39 barcodes (and more) programmatically in Visual Basic with just a few lines of code.

Start a free trial of IronBarcode and follow the examples below to generate barcodes in minutes.

What Are Barcode Fonts and Why Do They Fall Short?

Barcode fonts are specialized typefaces that map characters to barcode patterns. To create barcodes with a Code 39 font, developers encode data as a string, wrap it with start and stop characters (typically asterisks), and render the text using the installed font. The font visually converts that string into scannable bar codes.

This font-based approach requires every machine and printer to have the barcode fonts installed. Code 39 fonts demand that stop characters and check digits are handled manually in source code, and human readable text below barcodes needs separate formatting with a standard font like Arial. Compatibility issues arise frequently, whether in Crystal Reports integrations, Visual Studio designer views, or when developing for deployment across different system environments.

A programmatic barcode generator like IronBarcode solves these problems. It generates barcodes directly as barcode image files — PNG, JPEG, GIF, TIFF, or BMP — no font installation, no distribution headaches. Every generated barcode image follows the barcode symbology type specification, and the output is a portable barcode image ready for any printer or document. This is the approach covered throughout the rest of this article.

How to Generate Code 39 Barcodes in Visual Basic Without Fonts?

Generating a Code 39 barcode in VB.NET requires just a few lines with IronBarcode. The following code demonstrates how to encode data and export it:

Imports IronBarCode
Module Program
    Sub Main(args As String())
        ' Generate a Code 39 barcode from a string value
        Dim myBarcode = BarcodeWriter.CreateBarcode("HELLO-2025", BarcodeWriterEncoding.Code39)
        ' Export the generated barcode as a PNG file
        myBarcode.SaveAsPng("Code39Barcode.png")
    End Sub
End Module
Imports IronBarCode
Module Program
    Sub Main(args As String())
        ' Generate a Code 39 barcode from a string value
        Dim myBarcode = BarcodeWriter.CreateBarcode("HELLO-2025", BarcodeWriterEncoding.Code39)
        ' Export the generated barcode as a PNG file
        myBarcode.SaveAsPng("Code39Barcode.png")
    End Sub
End Module
VB .NET

Output Barcode Image

VB .NET Barcode Font: How to Generate and Print Bar Codes Without Font Dependencies: Image 1 - Output Image from Code Example

BarcodeWriter.CreateBarcode accepts the data string and the barcode symbology as parameters. With BarcodeWriterEncoding.Code39, IronBarcode handles the full encoding specification, start characters, stop characters, and check digits are all automatically added without manual string manipulation. This is a considerable improvement over Code 39 barcode fonts, where forgetting an asterisk or miscalculating a check digit produces unreadable bar codes.

Code 39 is a linear barcode symbology that encodes uppercase letters, digits, and special characters, making Code 39 barcodes widely compatible for label and inventory scenarios. IronBarcode's barcode generator also supports Code 128, QR codes, EAN-13, UPC-A, Data Matrix, and dozens of other formats through the same CreateBarcode method. The source code above works in any VB.NET project, console, desktop, or web application. Each barcode image can also be exported as TIFF or BMP for specialized printing needs.

How to Style and Export Barcodes to Multiple Formats?

IronBarcode's fluent API makes it straightforward to customize barcodes. The following sample code shows how to set margin size, resize barcodes, and add annotation text on a Code 128 example:

Imports IronBarCode
Imports IronSoftware.Drawing
Module Program
    Sub Main(args As String())
        ' Generate a Code 128 barcode with styling
        Dim styledBarcode = BarcodeWriter.CreateBarcode("PKG-98765", BarcodeWriterEncoding.Code128)
        ' Set margin size in pixels around the barcode
        styledBarcode.SetMargins(10, 10, 10, 10)
        ' Resize — x dimension (width) and y dimension (height) in pixels
        styledBarcode.ResizeTo(400, 120)
        ' Add annotation with Arial font above barcodes
        styledBarcode.AddAnnotationTextAboveBarcode("Package Label")
        ' Display encoded value as readable text below barcodes
        styledBarcode.AddBarcodeValueTextBelowBarcode()
        ' Export barcodes to JPEG and GIF formats
        styledBarcode.SaveAsJpeg("Styled.jpeg")
        styledBarcode.SaveAsGif("Styled.gif")
    End Sub
End Module
Imports IronBarCode
Imports IronSoftware.Drawing
Module Program
    Sub Main(args As String())
        ' Generate a Code 128 barcode with styling
        Dim styledBarcode = BarcodeWriter.CreateBarcode("PKG-98765", BarcodeWriterEncoding.Code128)
        ' Set margin size in pixels around the barcode
        styledBarcode.SetMargins(10, 10, 10, 10)
        ' Resize — x dimension (width) and y dimension (height) in pixels
        styledBarcode.ResizeTo(400, 120)
        ' Add annotation with Arial font above barcodes
        styledBarcode.AddAnnotationTextAboveBarcode("Package Label")
        ' Display encoded value as readable text below barcodes
        styledBarcode.AddBarcodeValueTextBelowBarcode()
        ' Export barcodes to JPEG and GIF formats
        styledBarcode.SaveAsJpeg("Styled.jpeg")
        styledBarcode.SaveAsGif("Styled.gif")
    End Sub
End Module
VB .NET

Output Styled Barcode

VB .NET Barcode Font: How to Generate and Print Bar Codes Without Font Dependencies: Image 2 - Example barcode with specific styling

SetMargins accepts pixel values for each side or a single value for uniform margin size, the white space around the barcode image. ResizeTo controls the x dimension and y dimension of barcodes in pixels. For physical units, ResizeToMil specifies width in thousandths of an inch supported for true unit precision at a configurable DPI, which is helpful when exact measure matters for scanner compatibility.

AddBarcodeValueTextBelowBarcode automatically adds the encoded string as human readable text beneath the barcode image, no separate font or drawing code needed. These features replicate what barcode fonts provide, but as a portable barcode image object that generates barcodes you can save as BMP, TIFF, or any other supported format. For more on export options, refer to the output data formats guide.

How to Generate and Print Barcode Labels from a Visual Basic Application?

Once barcodes are generated, printing them as labels is simple. The barcode generator exports standard images that any printer can handle, aware of no font dependencies. The following code creates a QR code barcode for a product label:

Imports IronBarCode
Module Program
    Sub Main(args As String())
        ' Generate a QR code barcode for a product label
        Dim qrBarcode = QRCodeWriter.CreateQrCode("https://example.com/product/12345", 300)
        ' Export barcode to file path for printer output
        qrBarcode.SaveAsJpeg("ProductLabel.jpeg")
        ' Send the exported file to a printer via System.Drawing
        Console.WriteLine("Barcode saved — ready for printer")
    End Sub
End Module
Imports IronBarCode
Module Program
    Sub Main(args As String())
        ' Generate a QR code barcode for a product label
        Dim qrBarcode = QRCodeWriter.CreateQrCode("https://example.com/product/12345", 300)
        ' Export barcode to file path for printer output
        qrBarcode.SaveAsJpeg("ProductLabel.jpeg")
        ' Send the exported file to a printer via System.Drawing
        Console.WriteLine("Barcode saved — ready for printer")
    End Sub
End Module
VB .NET

Generated Barcode from Sample code

VB .NET Barcode Font: How to Generate and Print Bar Codes Without Font Dependencies: Image 3 - Generated barcode ready for printing

Whether printing Code 39 barcodes, Code 128 shipping barcodes, or QR barcodes for inventory, the following process is identical: generate barcodes as a barcode image, export to a file, and send to the printer. The barcode orientation is handled correctly during generation. For advanced scenarios, note that the VB.NET barcode printing tutorial covers configuration and orientation options in detail. This article also pairs well with the VB.NET barcode generator tutorial for additional example patterns and the IronBarcode documentation site for the complete API reference.

Conclusion

This article covered how to move beyond traditional barcode fonts in VB.NET and generate barcodes programmatically with IronBarcode. Whether you need Code 39 barcodes, Code 128 barcodes, QR barcodes, or other linear and 2D barcodes, IronBarcode is a helpful barcode generator that produces high-quality barcode images in a compiled Visual Basic .NET application, valuable functionality for any developer developing barcode features into dotnet projects. The source code examples in this article can be adapted for any barcode symbology that your application requires.

Get stated with IronBarcode now.
green arrow pointer

Ready to obtain a production license? Explore IronBarcode licensing options to find the right fit for your project, or download the free trial from NuGet.

Jordi Bardia
Software Engineer
Jordi is most proficient in Python, C# and C++, when he isn’t leveraging his skills at Iron Software; he’s game programming. Sharing responsibilities for product testing, product development and research, Jordi adds immense value to continual product improvement. The varied experience keeps him challenged and engaged, and he ...
Read More