BarcodeRenderOptions Class

Options for rendering a linear barcode: as a scene, as SVG, and as an image or a PDF with the bridge packages.

public sealed class BarcodeRenderOptions

Remarks

The sizes are in the units of the scene: pixels in an image at the default scale, CSS pixels in SVG.

Constructors

NameDescription
BarcodeRenderOptions()

BarcodeRenderOptions()

BarcodeRenderOptions.cs
public BarcodeRenderOptions()

No documentation is available.

Properties

NameDescription
DarkPaintGets or sets the paint of the bars. Default is black.
LightPaintGets or sets the paint of the spaces, of the quiet zone and of the background of the text. Default is white.
ModuleHeightGets or sets the height of each module, which is the height of the bars. Default is 80.
ModuleWidthGets or sets the width of each module. Default is 2.
QuietZoneModulesGets or sets the number of quiet zone modules on the left and right sides of the barcode. Default is 10.
SnapToPixelsGets or sets a value indicating whether the module sizes and the positions are rounded to whole units. Default is true.
TextGets or sets the style of the human-readable text (Barcode.Text) printed under the bars. Default is null: no text.

Gets or sets the paint of the bars. Default is black.

public ScenePaint DarkPaint { get; set; }

Property value

ScenePaint

Remarks

A gradient is in the coordinates of the scene: (0, 0) is the top-left corner of the quiet zone.

Gets or sets the paint of the spaces, of the quiet zone and of the background of the text. Default is white.

public ScenePaint? LightPaint { get; set; }

Property value

ScenePaint?

Remarks

null draws no background: it is transparent, or the content under the drawing shows through.

Gets or sets the height of each module, which is the height of the bars. Default is 80.

public double ModuleHeight { get; set; }

Property value

double

Remarks

The rows of a stacked barcode (Barcode.IsStacked) are BarcodeRenderOptions.ModuleWidth high instead.

Gets or sets the width of each module. Default is 2.

public double ModuleWidth { get; set; }

Property value

double

QuietZoneModules

BarcodeRenderOptions.cs

Gets or sets the number of quiet zone modules on the left and right sides of the barcode. Default is 10.

public int QuietZoneModules { get; set; }

Property value

int

Gets or sets a value indicating whether the module sizes and the positions are rounded to whole units. Default is true.

public bool SnapToPixels { get; set; }

Property value

bool

Remarks

Rounding gives every bar of one width the same width and sharp edges in images, which scanners read best. The module sizes round to the nearest whole number, at least 1. Set false to draw at the exact sizes.

Gets or sets the style of the human-readable text (Barcode.Text) printed under the bars. Default is null: no text.

public BarcodeTextOptions? Text { get; set; }

Property value

BarcodeTextOptions?

Remarks

EAN-8, EAN-13, UPC-A and UPC-E print their digits as the GS1 General Specifications do: the guard bars extend 5 modules below the other bars, the digits are grouped between them, the digits that have no bars of their own are printed outside the bars (widening the quiet zone when it is too narrow), and the digits of an add-on are printed above its bars, which start lower. The font shrinks when a group is wider than the bars it is printed under.

The other symbologies print the text centered under the bars. A text wider than the barcode widens the drawing, and the barcode is centered above it.