Class BarcodeDrawOptions
How DrawBarcode(Canvas, Barcode, RectF, Paint, BarcodeDrawOptions?), ToPath(float, BarcodeDrawOptions?) and ToRaster(int, BarcodeDrawOptions?) draw a barcode.
public sealed record BarcodeDrawOptions : IEquatable<BarcodeDrawOptions>
- Inheritance
-
BarcodeDrawOptions
- Implements
- Inherited Members
Examples
// A 0.33 mm module (the X dimension) in points, with the text under the bars and 0.05 mm taken off each bar
// for ink spread. The quiet zone's top-left corner goes at (36, 36).
float module = 0.33f / 25.4f * 72;
page.DrawBarcode(code, new Vector2(36, 36), module, Rgba8.Black, new BarcodeDrawOptions
{
Font = font,
BarWidthReduction = 0.05f / 25.4f * 72,
});
Properties
BarWidthReduction
Gets how much narrower each dark bar or module is drawn, in output units (pixels for ToRaster(int, BarcodeDrawOptions?)), to make up for ink spreading on a printer; 0 by default. Half is taken off each side. 2D modules shrink in height too. It changes drawing only, never the modules.
public float BarWidthReduction { get; init; }
Property Value
Exceptions
- ArgumentOutOfRangeException
The value is negative or not finite.
Default
Gets the defaults: quiet zone on, no bar width reduction, no text.
public static BarcodeDrawOptions Default { get; }
Property Value
Font
Gets the font for the human-readable text under the bars (HumanReadableText), or null, the default, to draw no text. Its size is in output units. ToPath(float, BarcodeDrawOptions?) draws no text.
public Font? Font { get; init; }
Property Value
- Font?
QuietZone
Gets a value indicating whether the symbol's quiet zone (QuietZone) is kept clear around it; true by default. Readers need it; turn it off only when the space around the symbol is blank anyway. Linear symbols have it at the left and right only.
public bool QuietZone { get; init; }