Table of Contents

Class Barcode

Namespace
MiPdf.Barcodes
Assembly
MiPdf.dll

Base class of all barcodes. Barcodes are drawn as vector graphics (one filled path), so they stay sharp at every zoom level and print resolution.

public abstract class Barcode
Inheritance
Barcode
Derived
Inherited Members

Properties

Background

Optional background fill (including the quiet zone).

public PdfColor? Background { get; set; }

Property Value

PdfColor?

Color

Color of the bars/modules (default black).

public PdfColor Color { get; set; }

Property Value

PdfColor

QuietZone

Width of the light margin on each side, in modules. Scanners need it; the default follows the symbology.

public int QuietZone { get; set; }

Property Value

int

Text

The encoded data.

public string Text { get; }

Property Value

string

TotalWidthModules

Total width in modules including the quiet zones.

public abstract int TotalWidthModules { get; }

Property Value

int

Methods

Draw(PdfCanvas, double, double, double, double)

Draws the barcode into the rectangle with the bottom-left corner (x, y). The quiet zone is part of the rectangle. 2D codes keep square modules and are centered.

public abstract void Draw(PdfCanvas canvas, double x, double y, double width, double height)

Parameters

canvas PdfCanvas
x double
y double
width double
height double

DrawWithModuleSize(PdfCanvas, double, double, double, double?)

Draws the barcode with a fixed module (narrow bar) size in points; returns the size used.

public PdfRectangle DrawWithModuleSize(PdfCanvas canvas, double x, double y, double moduleSize, double? height = null)

Parameters

canvas PdfCanvas
x double
y double
moduleSize double
height double?

Returns

PdfRectangle