ReceiptPrintJob.PrintBarcode Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds an instruction to the print job to print a barcode with the specified data and symbology on the receipt printer station.
public:
virtual void PrintBarcode(Platform::String ^ data, unsigned int symbology, unsigned int height, unsigned int width, PosPrinterBarcodeTextPosition textPosition, PosPrinterAlignment alignment) = PrintBarcode;
void PrintBarcode(winrt::hstring const& data, uint32_t const& symbology, uint32_t const& height, uint32_t const& width, PosPrinterBarcodeTextPosition const& textPosition, PosPrinterAlignment const& alignment);
public void PrintBarcode(string data, uint symbology, uint height, uint width, PosPrinterBarcodeTextPosition textPosition, PosPrinterAlignment alignment);
function printBarcode(data, symbology, height, width, textPosition, alignment)
Public Sub PrintBarcode (data As String, symbology As UInteger, height As UInteger, width As UInteger, textPosition As PosPrinterBarcodeTextPosition, alignment As PosPrinterAlignment)
Parameters
- data
-
String
Platform::String
winrt::hstring
The data to be represented as a barcode.
- symbology
-
UInt32
unsigned int
uint32_t
The symbology (encoding) of the barcode. This can be determined based on the BarcodeSymbologies class static methods.
- height
-
UInt32
unsigned int
uint32_t
The height of the barcode, expressed in the unit of measurement indicated by the ClaimedPosPrinter.MapMode property.
- width
-
UInt32
unsigned int
uint32_t
The width of the barcode.
This value is interpreted in one of two ways:
The width of the entire barcode, expressed in the unit of measurement indicated by the ClaimedPosPrinter.MapMode property.
or, (though we discourage using this method) if the value is less than or equal to 6, it is interprested as described below:
ESC/POS control language is used for most Windows POS device communication, and ESC/POS only accepts integers from 2 to 6. Each value contains a matched measurement for the thin and thick elements of a barcode. In order for a barcode to be read properly, the width of the lines is crucial, especially when scaling. Additionally, the minimum width capability varies by printer model.
Actual sizes are dependent on the capabilities of the target printer, but approximate sizes for accepted values are:
Width Value | Thin Element | Thick Element |
---|---|---|
2 | 0.250 - 0.282 mm | 0.625 - 0.706 mm |
3 | 0.375 - 0.423 mm | 1.000 - 1.129 mm |
4 | 0.500 - 0.564 mm | 1.250 - 1.411 mm |
5 | 0.625 - 0.706 mm | 1.625 - 1.834 mm |
6 | 0.750 - 0.847 mm | 2.000 - 2.258 mm |
See the remarks in POS Printer for more information on ESC/POS.
- textPosition
- PosPrinterBarcodeTextPosition
The vertical position of the barcode text relative to the barcode.
- alignment
- PosPrinterAlignment
The horizontal alignment of the barcode on the page.