Share via


PosPrinter.SetBitmap Method

2/27/2008

Saves information about a bitmap for later printing.

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

Syntax

'Declaration
Public MustOverride Sub SetBitmap ( _
    bitmapNumber As Integer, _
    station As PrinterStation, _
    fileName As String, _
    width As Integer, _
    alignment As Integer _
)
public abstract void SetBitmap (
    int bitmapNumber,
    PrinterStation station,
    string fileName,
    int width,
    int alignment
)
public:
virtual void SetBitmap (
    int bitmapNumber, 
    PrinterStation station, 
    String^ fileName, 
    int width, 
    int alignment
) abstract
public abstract void SetBitmap (
    int bitmapNumber, 
    PrinterStation station, 
    String fileName, 
    int width, 
    int alignment
)
public abstract function SetBitmap (
    bitmapNumber : int, 
    station : PrinterStation, 
    fileName : String, 
    width : int, 
    alignment : int
)

Parameters

  • bitmapNumber
    The number to be assigned to this bitmap. Two bitmaps, numbered 1 and 2, may be set.
  • station
    The printer station to be used. Possible values are defined by the PrinterStation enumeration. Valid values are as follows: PrinterStation.Receipt or PrinterStation.Slip.
  • fileName
    Name of Windows bitmap file. The file must be in uncompressed format. If set to an empty string (""), the bitmap is unset.
  • width
    Printed width of the bitmap to be performed. See the PrintBitmap method for values.
  • alignment
    Placement of the bitmap.

Remarks

The alignment parameter values are as follows:

Value

Meaning

PrinterBitmapLeft

Align with the leftmost print column.

PrinterBitmapCenter

Align with the center of the station.

PrinterBitmapRight

Align with the rightmost print column.

Other values

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

As soon as the bitmap is set, it can then be printed by calling the PrintNormal or PrintImmediate method with the print bitmap escape sequence in the print data. The print bitmap escape sequence will typically be included in a string for printing top and bottom transaction headers.

A service object may choose to cache the bitmap for later use to provide better performance. Regardless, the bitmap file and parameters are validated for correctness by SetBitmap.

The application must make sure that the printer station metrics, such as character width, line height, and line spacing are set for the station before it calls SetBitmap. The service object can perform transformations on the bitmap in preparation for later printing based on the current values.

The application can set bitmaps numbered 1 and 2 for each of the two valid stations. If you want, the same bitmap fileName can be set to the same bitmapNumber for each station so that the same print bitmap escape sequence can be used for either station.

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

SetBitmap may throw a PosControlException with the following ErrorCodes:

Value

Meaning

Illegal

One of the following conditions has occurred:

  • The specified station is invalid—it must be either Slip or Receipt.

  • The specified station does not support printing of bitmaps (that is, the appropriate CapSlpBitmap or CapRecBitmap property is set to false).

  • The printer is currently in Insertion mode.

  • The printer is currently in Removal mode.

  • The number that is specified for bitmapNumber is less than 1 or greater than 20 and therefore invalid.

  • The value for width is less than or equal to zero but not set to PrinterBitmapAsIs and therefore invalid.

NoExist

fileName was not found.

Extended

ExtendedErrorTooBig: The bitmap is either too wide to print without transformation, or it is too big to transform.

ExtendedErrorBadFormat: The specified file is either not a bitmap file, or it is in an unsupported format.

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
PosPrinter.PrintNormal Method
PosPrinter.PrintImmediate Method
PosPrinter.PrintBitmap Method
PrinterStation