PosPrinter.PrintBarCode Method

2/27/2008

Prints a bar code on the specified printer station.

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

Syntax

'Declaration
Public MustOverride Sub PrintBarCode ( _
    station As PrinterStation, _
    data As String, _
    symbology As BarCodeSymbology, _
    height As Integer, _
    width As Integer, _
    alignment As Integer, _
    textPosition As BarCodeTextPosition _
)
public abstract 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
) abstract
public abstract void PrintBarCode (
    PrinterStation station, 
    String data, 
    BarCodeSymbology symbology, 
    int height, 
    int width, 
    int alignment, 
    BarCodeTextPosition textPosition
)
public abstract 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
    Character string to be bar-coded.
  • 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. Expressed in the unit of measure indicated by the MapMode property.
  • alignment
    Placement of the bar code. For possible values, see Remarks in this topic.
  • textPosition
    Placement of the readable character string. Possible values are defined by the BarCodeTextPosition enumeration.

Remarks

The alignment parameter values are as follows:

Value

Meaning

PrinterBarCodeLeft

Align with the leftmost print column.

PrinterBarCodeCenter

Align with the center of the station.

PrinterBarCodeRight

Align with the rightmost print column.

Other values

The distance from the leftmost print column to the start of the bar code, expressed in the unit of measure indicated by the MapMode property.

PrintBarCode is performed synchronously if AsyncMode is FALSE, and asynchronously if AsyncMode is true.

If the RotateSpecial property indicates that the bar code is to be rotated, then perform the rotation. The height, width, and textPosition parameters are applied to the bar code before the rotation. For example, if the bar code text position is specified as Below and the bar code is rotated left, the text will appear on the paper to the right side of the bar code.

Before it calls this method, the application must open, claim, and enable the device.

PrintBarCode may throw a PosControlException with the following ErrorCodes:

Value

Meaning

Busy

Cannot perform while output is in progress.

(Can be returned only if AsyncMode is false.)

Illegal

One of the following conditions has occurred:

  • The specified station code is invalid—it can only be Slip or Receipt.

  • The specified station is not supported (that is, the appropriate CapSlpPresent or CapRecPresent is set to false).

  • The printer is currently in Insertion mode.

  • The printer is currently in Removal mode.

  • The printer does not support bar codes for the specified station.

  • The specified height is less than or equal to 0 (zero).

  • The specified width is less than or equal to 0 (zero).

  • The specified alignment is either less than or equal to 0 (zero), or not set to one of the PrinterBarCode et al constants.

  • The specified textPosition does not exist in the BarCodeTextPositions enumeration.

  • The specified symbology does not exist in the BarCodeSymbology enumeration.

Extended

ExtendedErrorCoverOpen: The printer cover is open. (Can be returned only if AsyncMode is false.)

ExtendedErrorRecEmpty: The receipt station was specified but is out of paper. (Can be returned only if AsyncMode is false.)

ExtendedErrorRecCartridgeEmpty: A receipt cartridge is empty. (Can be returned only if AsyncMode is false.)

ExtendedErrorRecCartridgeRemoved: A receipt cartridge is removed. (Can be returned only if AsyncMode is false.)

ExtendedErrorRecHeadCleaning: A receipt head is being cleaned. (Can be returned only if AsyncMode is false.)

ExtendedErrorSlpEmpty: The slip station was specified, but a form is not inserted. (Can be returned only if AsyncMode is false.)

ExtendedErrorSlpCartridgeEmpty: A slip cartridge is empty. (Can be returned only if AsyncMode is false.)

ExtendedErrorSlpCartridgeRemoved: A slip cartridge is removed. (Can be returned only if AsyncMode is false.)

ExtendedErrorSlpHeadCleaning: A slip head is being cleaned. (Can be returned only if AsyncMode is false.)

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

PosPrinter Class
PosPrinter Members
Microsoft.PointOfService Namespace
MapMode
RotateSpecial
PrinterStation
BarCodeSymbology Enumeration