Class TwBarcodeService
The default ITwBarcodeService, built on the library's own barcode encoders.
public sealed class TwBarcodeService : ITwBarcodeService
- Inheritance
-
TwBarcodeService
- Implements
- Inherited Members
Constructors
TwBarcodeService()
public TwBarcodeService()
Methods
Encode(string, BarcodeFormat)
Encodes a value as a barcode.
public Barcode Encode(string value, BarcodeFormat format = BarcodeFormat.Code128)
Parameters
valuestringThe value to encode.
formatBarcodeFormatThe barcode format. Defaults to Code128.
Returns
- Barcode
The encoded barcode.
Exceptions
- ArgumentNullException
valueis null.- SymbolEncodingException
The value cannot be encoded in
format.
TryEncode(string?, BarcodeFormat, out Barcode?)
Tries to encode a value as a barcode, without throwing when the value does not suit the format.
public bool TryEncode(string? value, BarcodeFormat format, out Barcode? barcode)
Parameters
valuestringThe value to encode.
formatBarcodeFormatThe barcode format.
barcodeBarcodeThe encoded barcode, or null when the value cannot be encoded.