EgoPDF.Barcodes 1.0.0

dotnet add package EgoPDF.Barcodes --version 1.0.0
                    
NuGet\Install-Package EgoPDF.Barcodes -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EgoPDF.Barcodes" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EgoPDF.Barcodes" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="EgoPDF.Barcodes" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EgoPDF.Barcodes --version 1.0.0
                    
#r "nuget: EgoPDF.Barcodes, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package EgoPDF.Barcodes@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EgoPDF.Barcodes&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=EgoPDF.Barcodes&version=1.0.0
                    
Install as a Cake Tool

EgoPDF.Barcodes

Render barcodes (1D + 2D) and Zebra ZPL II labels to PDF on top of EgoPDF.Generator and ZXing.Net.

Preview. The API is in flux. Bug reports and PRs welcome; expect breaking changes between preview versions.

Renamed from EgoPDF.Zpl. The previous name only described half of what the package does (the ZPL parser); barcode rendering is the other half and the more broadly useful part, so the package now leads with it.

Quick start (ZPL → PDF)

using Ego.PDF;
using Ego.PDF.Data;
using Ego.PDF.Barcodes.Zpl;

using var pdf = new FPdf("label.pdf");
pdf.SetUnitConverionFactor(UnitEnum.Point, 203);

// Optional: load a TTF for the monospace ZPL fonts (^A?, ^CFA).
// Without this, ^A? falls back to whatever font is currently set.
pdf.LoadFont("robotomonob", "path/to/RobotoMono-Bold.ttf");
pdf.AddFont("robotomonob", "");
// Optional: a condensed font backs the scalable proportional ^AP..^AV
// slots. With it, ^AV* renders at the tight Zebra-V proportions used
// on real courier labels; without it, those fields fall back to the
// variable font with PDF Tz horizontal compression -- legible but
// visibly squeezed at aggressive ^AV widths.
pdf.LoadFont("robotocondensed", "path/to/RobotoCondensed-VariableFont_wght.ttf");
pdf.AddFont("robotocondensed", "");
pdf.SetFont("helvetica", "B", 16);

var zpl = new PdfZpl(pdf, dpi: 203);
zpl.SetLabelSize(812, 1218);              // 4" x 6" at 203 dpi
zpl.SetVariableFont("helvetica", "B");    // mapped to ZPL font "0"
zpl.SetMonospaceFont("robotomonob");      // mapped to ZPL fonts "A".."V"
zpl.SetCondensedFont("robotocondensed");  // optional: ^AP..^AV proportional

zpl.Print(@"
^XA
^FO50,50^FDHello from EgoPDF.Barcodes!^FS
^FO50,200^BCN,80,N,N,N^FD12345678^FS
^XZ
");

pdf.Close();

Supported ZPL commands

Layout

^XA / ^XZ, ^FO, ^FT, ^FD, ^FS, ^FX, ^FH, ^FW, ^FR, ^FB, ^FN, ^CF, ^CI, ^LH, ^LL, ^PW, ^DF + ^XF (template + field substitution), ^A? (A-V, plus the proportional ^A0).

Graphics

^GB, ^GC, ^GE, ^GD, ^GF (inline ASCII bitmap with the ZPL RLE compression), ^XG (recall a host-registered graphic via PdfZpl.RegisterGraphic(name, filePath)).

Barcodes

ZPL command Symbology
^BC Code 128
^B3 Code 39
^B2 Interleaved 2 of 5
^BK Codabar
^BE EAN-13
^B8 EAN-8
^BU UPC-A
^B9 UPC-E
^BM MSI
^B7 PDF417
^BQ QR Code
^BX Data Matrix
^BO Aztec

All 1D symbologies honour orientation N (no rotation) and B (rotated 90° CCW). 2D symbologies honour N, B, R, I.

What it doesn't do

  • Print to a Zebra device. Output is PDF, not ZPL → ZPL.
  • Implement the full ZPL command surface. Printer-state commands (^MD, ^PR, ^JM, ^IL, ^IS, ^DG, ^DY, ^DU, ^LR, ^LS, ^PM, ^PO, ^PF) are silently accepted as no-ops.
  • Reproduce Zebra's bitmap fonts byte-for-byte — the package uses whatever TTF the host registers, so visible metrics differ slightly from what a real printer would emit. Pre-pick a label width to match the physical roll if you care about absolute sizing.

Targets

  • net8.0
  • net9.0

License

MIT. "ZPL" and "Zebra" are trademarks of Zebra Technologies; this package is not affiliated with or endorsed by them.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 41 6/7/2026
1.0.0-preview.3 52 6/6/2026
1.0.0-preview.2 40 6/2/2026

1.0.0: first stable release. Late-2026 ZPL fidelity pass on top of the preview series: ^AV* condensed proportional path with native aspect lock (h scales with w when w < h*71/80, matching real Zebra V), SetCondensedFont hook for picking the font that backs ^AP..^AV; ^A?B and ^B?B rotated-text / rotated-barcode anchor split between ^FO (top-left of rotated bbox) and ^FT (first-char baseline) so portrait courier labels and rotated landscape labels both place fields where their authors meant; ^B2 (Interleaved 2 of 5) hand-rolled encoder honours the ^BY wide:narrow ratio (ZXing's writer was hard-coded to 1:3) and the Mod-10 check digit when the trailing checkDigit=Y flag is set; ^BC respects an explicit height parameter and a leading ^A?h,w that picks the caption font; bottom-up rotated barcodes get their interpretation line printed alongside the bars. New GetSampleCourierPortrait + visual baseline + WebDemo entry covers the pattern end-to-end. ^FR (Field Reverse) handling on text fields from preview.3 is unchanged.