PosPrinterBase.PrintBarCode Method (POS for .NET v1.14 SDK Documentation)

3/2/2014

Prints a bar code on the specified printer station.

Namespace: Microsoft.PointOfService.BaseServiceObjects
Assembly: Microsoft.PointOfService.ControlBase (in microsoft.pointofservice.controlbase.dll)

Syntax

'Declaration
Public Overrides Sub PrintBarCode ( _
    station As PrinterStation, _
    data As String, _
    symbology As BarCodeSymbology, _
    height As Integer, _
    width As Integer, _
    alignment As Integer, _
    textPosition As BarCodeTextPosition _
)
public override void PrintBarCode (
    PrinterStation station,
    string data,
    BarCodeSymbology symbology,
    int height,
    int width,
    int alignment,
    BarCodeTextPosition textPosition
)
public:
virtual void PrintBarCode (
    PrinterStation station, 
    String^ data, 
    BarCodeSymbology symbology, 
    int height, 
    int width, 
    int alignment, 
    BarCodeTextPosition textPosition
) override
public void PrintBarCode (
    PrinterStation station, 
    String data, 
    BarCodeSymbology symbology, 
    int height, 
    int width, 
    int alignment, 
    BarCodeTextPosition textPosition
)
public override function PrintBarCode (
    station : PrinterStation, 
    data : String, 
    symbology : BarCodeSymbology, 
    height : int, 
    width : int, 
    alignment : int, 
    textPosition : BarCodeTextPosition
)

Parameters

  • station
    The printer station to be used. Possible values are defined by the PrinterStation enumeration. Valid values are PrinterStation.Receipt or PrinterStation.Slip.
  • data
    The bar code data to be printed.
  • symbology
    Bar code symbol type to use. Possible values are defined by the BarCodeSymbology enumeration.
  • height
    Bar code height. Expressed in the unit of measure indicated by the MapMode property
  • width
    Bar code width.
  • alignment
    Placement of the bar code. For possible values, see Remarks below.
  • textPosition
    Placement of the readable character string. Possible values are defined by the BarCodeTextPosition enumeration.

Remarks

The PosPrinterBase class verifies that the application has the device opened, claimed, and enabled. PosPrinterBase validates the parameters and device state, and may throw PosControlException exceptions with the following values:

Value

Meaning

Busy

Busy: the State property is set to ControlState.Busy (applies only if the AsyncMode property has been set to false).

Other values

A physical condition exists that would preclude the operation—for example, the cover is open, the paper is removed, and so on. A full list of these exceptions is provided under PosPrinter.PrintBarCode.

Illegal

a) the requested printer station isn’t valid; b) the requested printer station isn’t PrinterStation.Receipt or PrinterStation.Slip; c) the specified bar code symbology isn’t valid; d) the specified bar code alignment is invalid; e) the specified bar code text position is invalid; f) the width parameter less than or equal to 0 (zero); g) the height parameter is less than or equal to 0 (zero); h) the CapRecPresent property is set to false; or h) the specified station doesn’t support barcodes.

If no exception is thrown, the PosPrinterBase class calls PrintBarCodeImpl.

PrintBarCodeImpl is performed synchronously if AsyncMode is false, and asynchronously if AsyncMode is true.

Refer to PrintBarCode for additional information.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread-safe. Any instance members are not guaranteed to be thread-safe.

See Also

Reference

PosPrinterBase Class
PosPrinterBase Members
Microsoft.PointOfService.BaseServiceObjects Namespace
PosPrinter.PrintBarCode Method
PrintBarCodeImpl