You are on page 1of 11

AXPrint ActiveX control documentation

Version 1.0, 21/4/2010

Description
AXPrint is an ActiveX control that provides methods for using non fiscal mobile printers via
PrinterUtility drivers package. This ActiveX control works only on devices with Windows
Mobile 5.0 and above.

Installation
Install and configure PrinterUtility drivers package. It is required to do that before
ActiveX control installation.
Install the ActiveX control with double click AXPrint.cab on device.

Usage in HTML
...
<OBJECT
ID="AXPrint"
CLASSID="clsid:4E507664-D8FB-4E2E-BBA7-01CDB7998F37"
WIDTH=0
HEIGHT=0
>
</OBJECT>

AXPrint.OpenPrinter(REGISTER_KEY);
if (AXPrint.ResultCode < 0) {
Alert("Failed to open printer");
}

AXPrint Generic Methods


OpenPrinter - Initiates a connection with printer. A proper register key must be provided or
an error message shell appear to notify that the component is not registered.
Params:
registerKey the component registration key.
Example:
AXPrint.OpenPrinter(7532-3447-2134)

ClosePrinter - Close connection with printer.


Example:
AXPrint.ClosePrinter()
PrintTaggedText- Prints a text that may contains specific tags that controls test style. The
valid tags are:
[BEL] - Bel.
[HT] - Horizontal tab.
[LF] - Line feed.
[U+] - Start underline.
[U-] - End underline.
[I+] - Start italic.
[I-] - End italic.
[B+] - Start highlight.
[B-] - End highlight.
[FI] - Select internal fontset.
[FL] - Select loadable fontset.
[FA] - Select font A.
[FB] - Select font B.
[DW+] - Start double width text.
[DW-] - End double width text.
[DH+] - Start double height text.
[DH-] - End double height text.
[FV+] - Flip chars vertical.
[FV-] - End flip chars vertical.
[RC+] - Start rotate characters right (90 degrees).
[RC-] - End rotate characters right (90 degrees).
[Ilxxx] - Set intensity level: IL70, IL80, IL90, IL100, IL120, IL150.
[LEFT] - Align text to left. Valid only to next new line.
[CENTER] - Align text to center. Valid only to next new line.
[RIGHT] - Align text to right. Valid only to next new line.
Params:
text the text to print.
Example:
AXPrint.PrintTaggedText([B+]Bold text[B-])

PrintBarcode- Prints a barcode with specified various barcode parameters.


Params:
align specifies where barcode shall be printed.
ALIGN_LEFT = 0
ALIGN_CENTER = 1
ALIGN_RIGHT = 2
smallText specifies whether to use small font to print HRI code.
NORMAL_FONT = 0
SMALL_FONT = 1
scale the scale factor, value between 2 and 4.
hri the print position of HRI code.
HRI_NONE = 0
HRI_ABOVE = 1
HRI_BELOW = 2
HRI_BOTH = 3
type the barcode type.
BARCODE_UPCA = 0
BARCODE_UPCE = 1
BARCODE_EAN13 = 2
BARCODE_EAN8 = 3
BARCODE_CODE39 = 4
BARCODE_ITF = 5
BARCODE_CODABAR = 6
BARCODE_CODE93 = 7
BARCODE_CODE128 = 8
BARCODE_PDF417 = 9
BARCODE_CODE128AUTO = 10
BARCODE_EAN128AUTO = 11
data the barcode data in hex string format.
Example:
AXPrint.PrintBarcode(ALIGN_CENTER, NORMAL_FONT, 2,
HRI_BELOW, 90, BARCODE_EAN13, "123456789012")

PrintLogo - Prints the bit image stored into printer.


Example:
AXPrint.PrintLogo()
FeedPaper Feeds paper with specified lines number.
Params:
lines the lines number, value between 0 and 255.
Example:
AXPrint.FeedPaper(100)
LoadLogo Loads bit image into printer.
Params:
width the bit image width in pixels.
height the bit image height in pixels.
data the bit image binary data in hex string format. This data consist of
bytes from left to right and from top to bottom, where each positive bits
defines a dot.
Example:
data = 0000000000 ...
AXPrint.LoadLogo(384, 200, data)
WritePrinter Sends data to printer.
Params:
data the data in hex string format.
Example:
AXPrint.WritePrinter(1B2E)
ReadSerialNumberEx - Reads printer serial number. If methods completes successful the
serial number can be obtained from ResultData property.
Example:
AXPrint.ReadSerialNumberEx()
PrintImage - Prints the bit image.
Params:
width the bit image width in pixels.

height the bit image height in pixels.


align specifies where image shall be printed.
ALIGN_LEFT = 0
ALIGN_CENTER = 1
ALIGN_RIGHT = 2
data the bit image binary data in hex string format. This data consist of
bytes from left to right and from top to bottom, where each positive bits
defines a dot.
Example:
data = 0000000000 ...
AXPrint.PrintImage(408, 480, ALIGN_LEFT, data)

AXPrint Page Mode Methods


PageMode_Start Starts printing in page mode.
Example:
AXPrint.PageMode_Start()
PageMode_End Ends printing in page mode.
Example:
AXPrint.PageMode_End()
PageMode_Print Prints the page content.
Example:
AXPrint.PageMode_Print()
PageMode_SetWorkingArea Sets working area into global page area.
Params:
x the X position of rectangle.
y the Y position of rectangle.
width the width of rectangle.
height the height of rectangle.
direction the rectangle direction.
PAGE_LEFT = 0
PAGE_BOTTOM = 1
PAGE_RIGHT = 2
PAGE_TOP = 3
Example:
AXPrint.PageMode_SetWorkingArea(0, 0, 160, 320, PAGE_LEFT)
PageMode_SetPosition Sets position in working area.
Params:
x the X position.
y the Y position.
Example:
AXPrint.PageMode_SetPosition(0, 4)

PageMode_ FillRectangle Fills or inverts rectangle in page mode.


Params:
x the X position of rectangle.
y the Y position of rectangle.
width the width of rectangle.
height the height of rectangle.
color the fill color.
FILL_WHITE = 0
FILL_BLACK = 1
FILL_INVERTED = 2
Example:
AXPrint.PageMode_FillRectangle(0, 0, 160, 32, FILL_INVERTED);
PageMode_ RectangleFrame Draws rectangle frame.
Params:
x the X position of rectangle.
y the Y position of rectangle.
width the width of rectangle.
height the height of rectangle.
pixels the border width in pixels.
color the fill color.
FILL_WHITE = 0
FILL_BLACK = 1
FILL_INVERTED = 2
Example:
AXPrint.PageMode_FillRectangle(0, 0, 160, 32, FILL_INVERTED);

AXPrint Smart Card Methods


SCR_PowerOn Powers on the smart card. This method must be execute before APDU
commands.
Example:
AXPrint.SCR_PowerOn()
SCR_PowerOff Powers off the smart card.
Example:
AXPrint.SCR_PowerOff()
SCR_SetCardType Sets the smart card type.
Params:
cardType the smart card type.
MCU =0
Example:
AXPrint.SCR_SetCardType(0)
SCR_SetCardSlotType Sets the smart card slot type.
Params:
cardSlotType the smart card slot type.
SLOT_MCU =0
SLOT_SAM =1
Example:
AXPrint.SCR_SetCardSlotType(SLOT_MCU)
SCR_MCU_Reset - Resets smart card. If methods completes successful the ATR string can
be obtained from ResultData property.
Example:
AXPrint.SCR_MCU_Reset()

SCR_MCU_APDU_IN - Executes smart card ADPU IN command. If methods completes


successful the result from APDU command can be obtained from ResultData property.
Params:
data the APDU command data in hex string format.
Example:
AXPrint.SCR_MCU_APDU_IN(8010000000)
SCR_MCU_APDU_OUT - Executes smart card ADPU OUT command. If methods
completes successful the result from APDU command can be obtained from ResultData
property.
Params:
data the APDU command data in hex string format.
Example:
AXPrint.SCR_MCU_APDU_OUT(8010000000)
SCR_MCU_C_APDU - Executes smart card combined (IN, OUT) ADPU command. If
methods completes successful the result from APDU command can be obtained from
ResultData.
Params:
data the APDU command data in hex string format.
Example:
AXPrint.SCR_MCU_C_APDU(8010000000)

AXPrint Properties
ResultCode - Read only property that contains result from method execution. If the value is
negative then an error occurs. The error can be one of:
ENONE = 0
EGENERAL = -1
ENOIMPLEMENTED = -2
EINTERRUPTED = -3
EBUSY = -4
EMEMORY = -5
ETIMEOUT = -6
EINVALIDPARAMS = -7
EFAILED = -8
Example:
AXPrint.OpenPrinter(REGISTER_KEY) ;
if (AXPrint.ResultCode < 0) {
Alert("Failed to open printer");
}
ResultData - Read only property that contains data from method execution. The all data
returned is in hex string format.
Example:
AXPrint.ReadSerialNumberEx() ;
serialNumber = AXPrint.ResultData;
IsSmartCardAvailable - Read only property that returns if smart card is available into
reader. After property execution the ResultCode contains whether the property returns a
valid value.
Example:
available = AXPrint.IsSmartCardAvailable;
if (AXPrint.ResultCode < 0) {
Alert("Failed to get smart card availability");
}

Release History
Version 1.0.2.1 (May 4, 2010)
Add align parameter to PrintImage method.
Version 1.0.1.1 (May 3, 2010)
Add PrintImage method.
Change the parameters in LoadLogo method.
Version 1.0.0.1 (April 21, 2010)
Initial public release.

You might also like