If you're building a warehouse tool, a POS system, or even a small shipping app, sooner or later you'll need to print barcode labels in C#. And that's where things get confusing—because printing isn't just about code. It's about barcodes, label size, printers, and communication protocols all working together.
This guide keeps it simple. No fluff—just what you actually need to get barcode label printing working in a real application.
When developers look up how to print barcode labels with C#, they're typically trying to fix one of these common issues:
· Generate barcodes (Code128, QR, etc.)
· Print labels like 4×6 shipping labels or product tags
· Connect to a thermal barcode printer
· Control layout, DPI, and positioning
So the task is actually a combination of:
Barcode generation
Label layout
Printer communication
Before printing, you need a barcode image.
· ZXing.Net (free, widely used)
· BarcodeLib (simple, lightweight)
· Commercial SDKs (more features, better support)
using ZXing;
using System.Drawing;
var writer = new BarcodeWriter
{
Format = BarcodeFormat.CODE_128
};
Bitmap barcode = writer.Write("123456789");
barcode.Save("barcode.png");
This creates a basic barcode image you can later print on a label.
The simplest way to print barcode labels in C# is using the built-in .NET PrintDocument class.
using System.Drawing;
using System.Drawing.Printing;
PrintDocument pd = new PrintDocument();
pd.PrintPage += (sender, e) =>
{
Image img = Image.FromFile("barcode.png");
e.Graphics.DrawImage(img, 10, 10, 200, 80);
};
pd.Print();
· Standard printers
· Simple label printing
· Small-scale applications
But here's the catch: This method is not ideal for thermal barcode printers (like shipping label printers).
If you're working with barcode label printers (Zebra, TSC, etc.), you'll get better results using printer commands instead of images.
Thermal printers don't “render” like normal printers. They expect commands like:
· ZPL (Zebra Programming Language)
· TSPL (TSC Printer Language)
using System.IO;
string zpl = @"^XA
^FO50,50
^BCN,100,Y,N,N
^FD123456789^FS
^XZ";
File.WriteAllText(@"\\PrinterName\Share", zpl);
This sends raw instructions directly to the printer.
· Faster printing
· Sharper barcode output
· Better control over label layout
This is the preferred method for:
· shipping label printing
· warehouse barcode systems
· inventory tracking solutions
A common issue developers face:
“Why does my barcode look stretched or blurry?”
Usually, it's because of label size or DPI mismatch.
· Printer resolution (203 dpi vs 300 dpi)
· Label size (e.g., 4×6 inches)
· Scaling in code
For example:
· 4×6 label at 203 dpi → 812 × 1218 pixels
· 4×6 label at 300 dpi → 1200 × 1800 pixels
If you ignore this, scanning problems will happen.
There are three common ways to print barcode labels in C#:
Method | Best For | Limitation |
PrintDocument | Simple apps | Not ideal for thermal printers |
Image printing | Basic labels | Lower performance |
ZPL / TSPL commands | Professional systems | Requires learning printer language |
· Print 4×6 shipping labels
· Use ZPL for speed and consistency
· Generate SKU and pallet labels
· Use barcode printing with C# backend systems
· Print price tags and QR labels
· Combine barcode generation + layout control
→ Leads to slow speed and poor quality
→ Causes unreadable barcodes
→ Breaks when switching printers
→ “Looks fine” doesn't mean it scans fine
If you're researching this topic, you'll also see queries like:
· C# barcode printing example
· print label using ZPL C#
· thermal printer C# SDK
· how to generate barcode in C#
· barcode label printing for warehouse systems
These all point to the same core goal:
building a reliable barcode printing workflow in C#.
Printing barcode labels in C# isn't just about writing code—it's about understanding how printers actually work.
If you're building a quick tool, start with PrintDocument.
If you're building something serious—like a shipping system or inventory platform—go straight to ZPL or TSPL commands.
That one decision will save you hours of debugging later.
Yes, but results may vary. Standard printers can print barcodes, but thermal barcode printers are more reliable for scanning.
· Code128 → general use
· QR code → more data
· EAN/UPC → retail
Not always. Libraries like ZXing.Net are enough for most cases.
For thermal printers, yes. It's faster, cleaner, and designed for label printing.