Share via


PosPrinter.PrintBitmap Method

2/27/2008

Prints a bitmap on the specified printer station.

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

Syntax

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

Parameters

  • station
    The printer station to be used. Possible values are defined by the PrinterStation enumeration. Valid values are PrinterStation.Receipt or PrinterStation.Slip.
  • fileName
    Name of Windows bitmap file. The file must be in uncompressed format.
  • width
    Printed width of the bitmap to be performed. See Remarks in this topic.
  • alignment
    Placement of the bitmap. For possible values, see Remarks in this topic.

Remarks

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

The width parameter values are as follows:

Value

Meaning

PrinterBitmapAsIs

Print the bitmap with one bitmap pixel per printer dot.

Other values

Bitmap width, expressed in the unit of measure indicated by the MapMode property.

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.

The width parameter controls transformation of the bitmap. If width is set to PrinterBitmapAsIs, no transformation is performed. The bitmap is printed with one bitmap pixel per printer dot. Advantages of this option are that it:

  • Provides the highest performance bitmap printing.

  • Works well for bitmaps tuned for a specific printer’s aspect ratio between horizontal dots and vertical dots.

If width is nonzero, the bitmap will be transformed by stretching or compressing the bitmap in such a way that its width is the specified width and the aspect ratio is unchanged. Advantages of this option are that it:

  • Sizes a bitmap to fit many printers.

  • Maintains the bitmap’s aspect ratio.

Disadvantages are as follows:

  • Lower performance than untransformed data.

  • Some lines and images that are "smooth" in the original bitmap may show some "ratcheting."

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

PrintBitmap 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 bitmaps for the specified station.

  • The specified width is less than or equal to 0 (zero) but is not specified as PrinterBitmapAsIs.

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

NoExist

The specified fileName was not found.

Extended

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

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

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