BarcodeConsoleRenderer Class
Provides methods to render a linear barcode using Unicode block characters.
public static class BarcodeConsoleRendererMethods
| Name | Description |
|---|---|
| ToConsoleString(Barcode, ConsoleRenderOptions?) | Renders the barcode as a string using Unicode block characters. |
| WriteTo(Barcode, TextWriter, ConsoleRenderOptions?) | Renders the barcode to a TextWriter using Unicode block characters. |
| WriteToConsole(Barcode, ConsoleRenderOptions?) | Renders the barcode to Console.Out. |
ToConsoleString(Barcode, ConsoleRenderOptions?)
BarcodeConsoleRenderer.csRenders the barcode as a string using Unicode block characters.
public static string ToConsoleString(this Barcode barcode, ConsoleRenderOptions? options = null)Parameters
barcodeBarcode- The barcode to render.
optionsConsoleRenderOptions?- The rendering options, or
nullfor the defaults.
Returns
string The lines of the barcode, without trailing spaces and without a final new line.
Exceptions
ArgumentNullExceptionbarcodeisnull.ArgumentOutOfRangeException- An option is out of range, or the text is too large for a string.
Remarks
Each module is ConsoleRenderOptions.ModuleWidth characters wide. The bars of a barcode that is not stacked are ConsoleRenderOptions.BarHeight lines high; the rows of a stacked barcode are drawn as the rows of a two-dimensional symbol, two per line. The quiet zone is on the left and right sides only.
WriteTo(Barcode, TextWriter, ConsoleRenderOptions?)
BarcodeConsoleRenderer.csRenders the barcode to a TextWriter using Unicode block characters.
public static void WriteTo(this Barcode barcode, TextWriter writer, ConsoleRenderOptions? options = null)Parameters
barcodeBarcode- The barcode to render.
writerTextWriter- The destination.
optionsConsoleRenderOptions?- The rendering options, or
nullfor the defaults.
Exceptions
ArgumentNullExceptionbarcodeorwriterisnull.ArgumentOutOfRangeException- An option is out of range, or the text is too large for a string.
WriteToConsole(Barcode, ConsoleRenderOptions?)
BarcodeConsoleRenderer.csRenders the barcode to Console.Out.
public static void WriteToConsole(this Barcode barcode, ConsoleRenderOptions? options = null)Parameters
barcodeBarcode- The barcode to render.
optionsConsoleRenderOptions?- The rendering options, or
nullfor the defaults.
Exceptions
ArgumentNullExceptionbarcodeisnull.ArgumentOutOfRangeException- An option is out of range, or the text is too large for a string.