Share via


ReceiptPrintJob.PrintBarcode Method

Definition

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 ValueThin ElementThick Element
20.250 - 0.282 mm0.625 - 0.706 mm
30.375 - 0.423 mm1.000 - 1.129 mm
40.500 - 0.564 mm1.250 - 1.411 mm
50.625 - 0.706 mm1.625 - 1.834 mm
60.750 - 0.847 mm2.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.

Implements

M:Windows.Devices.PointOfService.IReceiptOrSlipJob.PrintBarcode(System.String,System.UInt32,System.UInt32,System.UInt32,Windows.Devices.PointOfService.PosPrinterBarcodeTextPosition,Windows.Devices.PointOfService.PosPrinterAlignment) M:Windows.Devices.PointOfService.IReceiptOrSlipJob.PrintBarcode(Platform::String,unsigned int,unsigned int,unsigned int,Windows.Devices.PointOfService.PosPrinterBarcodeTextPosition,Windows.Devices.PointOfService.PosPrinterAlignment) M:Windows.Devices.PointOfService.IReceiptOrSlipJob.PrintBarcode(winrt::hstring,uint32_t,uint32_t,uint32_t,Windows.Devices.PointOfService.PosPrinterBarcodeTextPosition,Windows.Devices.PointOfService.PosPrinterAlignment)

Applies to

See also