ePOS SDK JavaScript Migration Guide en Revf
ePOS SDK JavaScript Migration Guide en Revf
Migration Guide
Migration Overview
Appendix
M00100105
Rev. F
Cautions
No part of this document may be reproduced, stored in a retrieval system, or transmitted in any form or by
any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permis-
sion of Seiko Epson Corporation.
The contents of this document are subject to change without notice. Please contact us for the latest informa-
tion.
While every precaution has been taken in the preparation of this document, Seiko Epson Corporation
assumes no responsibility for errors or omissions.
Neither is any liability assumed for damages resulting from the use of the information contained herein.
Neither Seiko Epson Corporation nor its affiliates shall be liable to the purchaser of this product or third
parties for damages, losses, costs, or expenses incurred by the purchaser or third parties as a result of:
accident, misuse, or abuse of this product or unauthorized modifications, repairs, or alterations to this
product, or (excluding the U.S.) failure to strictly comply with Seiko Epson Corporation’s operating and
maintenance instructions.
Seiko Epson Corporation shall not be liable against any damages or problems arising from the use of any
options or any consumable products other than those specified as Original Epson Products or Epson
Approved Products by Seiko Epson Corporation.
Trademarks
EPSON is a registered trademark of Seiko Epson Corporation.
Exceed Your Vision is registered trademark or trademark of Seiko Epson Corporation.
All other trademarks are the property of their respective owners and used for identification purpose only.
2
Restriction of Use
When this product is used for applications requiring high reliability/safety, such as transportation devices
related to aviation, rail, marine, automotive, etc.; disaster prevention devices; various safety devices, etc.; or
functional/precision devices, etc., you should use this product only after giving consideration to including fail-
safes and redundancies into your design to maintain safety and total system reliability. Because this product was
not intended for use in applications requiring extremely high reliability/safety, such as aerospace equipment,
main communication equipment, nuclear power control equipment, or medical equipment related to direct
medical care, etc., please make your own judgment on this product's suitability after a full evaluation.
3
Contents
■ Restriction of Use ....................................................................................................................3
■ Contents....................................................................................................................................4
Migration Overview.........................................................................................5
■ Migration Types.......................................................................................................................5
Migration from ePOS-Print SDK .................................................................................................................................... 5
Migration from ePOS-Device SDK................................................................................................................................ 5
Appendix.........................................................................................................25
■ ePOS-Print SDK-compatible API........................................................................................ 25
TM-m10................................................................................................................................................................................25
TM-m30................................................................................................................................................................................28
TM-T88VI..............................................................................................................................................................................31
TM-T88VI-iHUB ..................................................................................................................................................................33
4
Chapter 1 Migration Overview
Migration Overview
This manual explains how to modify applications created with following development tools in order to run
these applications in Epson ePOS SDK for Android ("Epson ePOS SDK").
ePOS-Print SDK for Android ("ePOS-Print SDK")
ePOS-Device SDK for Android ("ePOS-Device SDK")
ePOS-Print SDK and ePOS-Device SDK will no longer be optimized for new products and new functions. Refer
to this document to perform migration to ePOS SDK-compatible application.
Migration Types
Epson ePOS SDK contains ePOS-Print SDK-compatible APIs and can use existing APIs as they are.
Existing applications can be migrated into an Epson ePOS SDK-compatible application by making
minimal changes, such as modifying the referenced library file names.
By modifying the existing application into a program that uses Epson ePOS SDK APIs, you can migrate to
an Epson ePOS SDK-compatible application. This requires many program modifications, such as
changing the programming sequence and APIs.
The support policy for ePOS-Print SDK-compatible APIs and Epson ePOS SDK towards new products and new
functions is described below.
New products and functions ePOS-Print SDK-compatible API Epson ePOS SDK
Epson TM printers ✔ ✔
New functions of Epson TM printers -* ✔
New tablets and smartphone models ✔ ✔
✔ : Compatible -: Incompatible
* Not compatible with the new functions that require new APIs or API modifications.
5
Chapter 2 Migration from ePOS-Print SDK
Migration procedure
The migration procedure is described below.
Procedure Description
1 SDK file replacement Class file and library file replacement
Refer to "SDK file replacement".
The Appendix of '"Epson ePOS SDK for JavaScript Migration Guide" (this document)
6
Chapter 2 Migration from ePOS-Print SDK
Migration procedure
The migration procedure is described below.
Procedure Description
1 SDK file replacement Class file and library file replacement
Refer to " SDK file replacement".
2 Changing package names Changing the package name of the ePOS-Print SDK to the package name of Epson
ePOS SDK
Refer to " Changing package names".
3 Changing objects Changing the ePOS-Print SDK object to the Epson ePOS SDK object
Refer to " Changing objects".
4 Changing APIs Modifying the program or changing the ePOS-Print SDK APIs that have different
specifications from those of Epson ePOS SDK
The changes are described below.
❏ Modifying the program to enable specific functions
Modify the functions listed below.
Establishing and cutting the communication with the printer
Refer to " Establishing and cutting the communication with the printer".
Printing from ePOS-Print API
Refer to " Printing from ePOS-Print API".
Printing from Canvas API
Refer to " Printing from Canvas API".
Status monitoring
Refer to " Monitoring of the status".
❏ Changing API name
API names to be changed (You may need to change parameters too)
Refer to " Changing API name".
❏ Changing API objects
Refer to " Changing API objects".
❏ Changing events
Refer to " Changing events".
This completes the migration with the Epson ePOS SDK API.
7
Chapter 2 Migration from ePOS-Print SDK
Changing objects
Change the object of ePOS-Print SDK used in the application project to the object of Epson ePOS SDK.
8
Chapter 2 Migration from ePOS-Print SDK
connect()
send()
send()
Disconnection
disconnect()
Program differences
❏ ePOS-Print SDK
9
Chapter 2 Migration from ePOS-Print SDK
function connect(){
//Connect to device
ePosDev.connect('192.168.192.168', '8008', callback_connect);
}
function callback_connect(resultConnect){
if ((resultConnect == 'OK') || (resultConnect == 'SSL_CONNECT_OK')) {
//Get the Printer object
ePosDev.createDevice('local_printer', ePosDev.DEVICE_TYPE_PRINTER, {'crypto' :
false, 'buffer' : false}, callback_createDevice);
}
else {
//Display the error message
}
}
function disconnect(){
//Discard the Printer object
ePosDev.deleteDevice(printer, callback_deleteDevice);
}
function callback_deleteDevice(errorCode){
//Disconnect to device
ePosDev.disconnect();
}
10
Chapter 2 Migration from ePOS-Print SDK
Connect to printer
addText()
addText()
toString()
Transmission
send() send()
Result Acquisition
Callback:
11
Chapter 2 Migration from ePOS-Print SDK
Program differences
❏ ePOS-Print SDK
12
Chapter 2 Migration from ePOS-Print SDK
function callback_connect(resultConnect){
if ((resultConnect == 'OK') || (resultConnect == 'SSL_CONNECT_OK')) {
//Get the Printer object
ePosDev.createDevice('local_printer', ePosDev.DEVICE_TYPE_PRINTER, {'crypto' :
false, 'buffer' : false}, callback_createDevice);
}
else {
//Display the error message
}
}
function print(){
//Create the printing data
printer.addText('Hello\n');
function disconnect(){
//Discard the Printer object
ePosDev.deleteDevice(printer, callback_deleteDevice);
}
function callback_deleteDevice(errorCode){
//Disconnect to device
ePosDev.disconnect();
}
13
Chapter 2 Migration from ePOS-Print SDK
Create the print image with Canvas Create the print image with Canvas
Transmission
print() print()
Result Acquisition
Callback:
14
Chapter 2 Migration from ePOS-Print SDK
Program differences
❏ ePOS-Print SDK
//Draw in Canvas
var canvas = document.getElementById('canvas');
if (canvas.getContext) {
var context = canvas.getContext('2d');
context.fillText("Test", 100, 100);
}
//Perform printing
epos.print(canvas);
15
Chapter 2 Migration from ePOS-Print SDK
function connect(){
//Connect to device
ePosDev.connect('192.168.192.168', '8008', callback_connect);
}
function callback_connect(resultConnect){
if ((resultConnect == 'OK') || (resultConnect == 'SSL_CONNECT_OK')) {
//Get the Printer object
ePosDev.createDevice('local_printer', ePosDev.DEVICE_TYPE_PRINTER, {'crypto' :
false, 'buffer' : false}, callback_createDevice);
}
else {
//Display the error message
}
}
function disconnect(){
//Discard the Printer object
ePosDev.deleteDevice(printer, callback_deleteDevice);
}
function callback_deleteDevice(errorCode){
//Disconnect to device
ePosDev.disconnect();
}
16
Chapter 2 Migration from ePOS-Print SDK
open() startMonitor()
Callback Notification
close() stopMonitor()
Callback:
17
Chapter 2 Migration from ePOS-Print SDK
Program differences
❏ ePOS-Print SDK
function open(){
//Status monitoring start
epos.open();
}
//Cover open
function close(){
//Status monitoring End
epos.close();
}
18
Chapter 2 Migration from ePOS-Print SDK
function connect(){
//Connect to device
ePosDev.connect('192.168.192.168', '8008', callback_connect);
}
function callback_connect(resultConnect){
if ((resultConnect == 'OK') || (resultConnect == 'SSL_CONNECT_OK')) {
//Get the Printer object
ePosDev.createDevice('local_printer', ePosDev.DEVICE_TYPE_PRINTER, {'crypto' :
false, 'buffer' : false}, callback_createDevice);
}
else {
//Display the error message
}
}
function startMonitor(){
//Status monitoring start
printer.startMonitor();
}
function startMonitor(){
//Status monitoring end
printer.stopMonitor();
}
function disconnect(){
//Discard Printer object
ePosDev.deleteDevice(printer, callback_deleteDevice);
}
function callback_deleteDevice(errorCode){
//Disconnect to device
ePosDev.disconnect();
}
19
Chapter 2 Migration from ePOS-Print SDK
20
Chapter 2 Migration from ePOS-Print SDK
Object ePOS-Print
Response
Function SDK
Sets the printing color color This property cannot be used with Epson ePOS SDK.
(Only ePOS-Print SDK-compatible APIs can be used.)
If you want to set the color for the image data rendered in the
canvas, you cannot use the print method.
Use the addImage and send methods to set the color.
Sets the feed of label paper/black feed This property cannot be used with Epson ePOS SDK.
mark paper (Only ePOS-Print SDK-compatible APIs can be used.)
If you want to set paper feeding for label paper or black-mark
paper, you cannot use the print method.
Use the addImage, addFeed, and send methods to set paper
feeding for label paper or black-mark paper.
Sets the paper type paper This property cannot be used with Epson ePOS SDK.
(Only ePOS-Print SDK-compatible APIs can be used.)
If you want to set the paper type, you cannot use the print
method.
Use the addLayout, addFeed, and send methods to set the
paper type.
Sets the paper layout layout This property cannot be used with Epson ePOS SDK.
(Only ePOS-Print SDK-compatible APIs can be used.)
If you want to set the paper layout, you cannot use the print
method.
Use the addLayout, addImage, and send methods to set the
paper layout.
21
Chapter 2 Migration from ePOS-Print SDK
22
Chapter 2 Migration from ePOS-Print SDK
Changing events
The events that need to be changed when migrating from ePOS-Print SDK to Epson ePOS SDK are listed in the
tables below.
To see what has changed, compare APIs in the “ePOS-Print SDK for JavaScript User’s Manual” and “Epson
ePOS SDK for JavaScript User’s Manual”.
Events to be changed
Function ePOS-Print SDK Epson ePOS SDK
Notification of printer disconnect status onerror ondisconnect
23
Chapter 3 Migration from ePOS-Device SDK
Migration procedure
The migration procedure is described below.
Procedure Description
1 SDK file replacement Library file replacement
Refer to " SDK file replacement".
24
Appendix
Appendix
ePOS-Print SDK-compatible API
This section explains model information for new Epson TM printer products and APIs supported by ePOS-
Print SDK-compatible APIs.
TM-m10
The TM-m10 model information is listed in the table below.
58 mm
Resolution 203 dpi x 203 dpi (W x H)
Country ANK model
Japanese model
Traditional Chinese model
Print Width 420 dots
Characters in a Line Font A ANK: 35 characters / Kanji *1: 17 characters
Font B ANK: 42 characters / Kanji *2: 21 characters
Font C ANK: 46 characters
Character Size Font A ANK: 12 dots x 24 dots (W x H) / Kanji *1: 24 dots x 24 dots (W x H)
Font B ANK: 10 dots x 24 dots (W x H) / Kanji *2: 20 dots x 24 dots (W x H)
Font C ANK: 9 dots x 17 dots (W x H)
Character Baseline Font A ANK; At the 21st dot from the top of the character
Kanji *1: At the 21st dot from the top of the character
Font B ANK; At the 21st dot from the top of the character
Kanji *2: At the 21st dot from the top of the character
Font C At the 16th dot from the top of the character
Default Line Feed Space 30 dots
Color Specification First color
Page Mode Default Area 420 dots x 2400 dots (W x H)
Page Mode Maximum Area 420 dots x 2400 dots (W x H)
Barcode UPC-A, UPC-E, EAN13, JAN13, EAN8, JAN8, CODE39, ITF,CODABAR, CODE93,
CODE128, GS1-128, GS1 DataBar Omnidirectional, GS1 DataBar Truncated,
GS1 DataBar Limited, GS1 DataBar Expanded
Two-Dimensional Code PDF417, QR Code, MaxiCode, GS1 DataBar Stacked,
GS1 DataBar Stacked Omnidirectional, GS1 DataBar Expanded Stacked,
Aztec Code, Data Matrix (Composite Symbology not supported)
Paper Cut Cut, Feed cut
Drawer Kick-Out Supported
Buzzer Option (Pattern A ~ Pattern E, Error, No paper, Stop)
Battery Not supported
Bluetooth® connection Supported only by the TM-m10 Bluetooth® model.
25
Appendix
ePOS-Print settings
Item Value
Printing Method Thermal (203 dpi)
Character Code Tables Page 0-5,16-19,20-21,26,30-31,11-15,32-53
26
Appendix
27
Appendix
TM-m30
The TM-m30 model information is listed in the table below.
58 mm 80 mm
Resolution 203 dpi x 203 dpi (W x H)
Country ANK model
Japanese model
Simplified Chinese model
Traditional Chinese model
Korean model
Print Width 420 dots 576 dots
Characters in a Line Font A ANK: 35 characters ANK: 48 characters
Kanji *1: 17 characters Kanji *1: 24 characters
Font B ANK: 42 characters ANK: 57 characters
Kanji *2: 21 characters Kanji *2: 28 characters
Kanji *3: 26 characters Kanji *3: 36 characters
Font C ANK: 46 characters ANK: 64 characters
*1: 24 dots x 24 dots (W x H)
Character Size Font A ANK: 12 dots x 24 dots (W x H) / Kanji
Font B 10 dots x 24 dots (W x H)
Kanji *2: 20 dots x 24 dots (W x H) / Kanji *3: 16 dots x 16 dots (W x H)
Font C 9 dots x 17 dots (W x H)
Character Baseline Font A ANK; At the 21st dot from the top of the character
Kanji *1: At the 21st dot from the top of the character
Font B At the 21st dot from the top of the character
Kanji *2: At the 21st dot from the top of the character
Kanji *3: At the 15th dot from the top of the character
Font C At the 16th dot from the top of the character
Default Line Feed Space 30 dots
Color Specification First color
Page Mode Default Area 420 dots x 2400 dots (W x H) 576 dots x 2400 dots (W x H)
Page Mode Maximum Area 420 dots x 2400 dots (W x H) 576 dots x 2400 dots (W x H)
Barcode UPC-A, UPC-E, EAN13, JAN13, EAN8, JAN8, CODE39, ITF,CODABAR, CODE93,
CODE128, GS1-128, GS1 DataBar Omnidirectional, GS1 DataBar Truncated,
GS1 DataBar Limited, GS1 DataBar Expanded
Two-Dimensional Code PDF417, QR Code, MaxiCode, GS1 DataBar Stacked,
GS1 DataBar Stacked Omnidirectional, GS1 DataBar Expanded Stacked,
Aztec Code, Data Matrix (Composite Symbology not supported)
Paper Cut Cut, Feed cut
Drawer Kick-Out Supported
Buzzer Option (Pattern A ~ Pattern E, Error, No paper, Stop)
Battery Not supported
Bluetooth connection Supported only by the TM-m30 Bluetooth® model.
28
Appendix
ePOS-Print settings
Item Value
Printing Method Thermal (203 dpi)
Character Code Tables Page 0-5,16-19,20-21,26,30-31,11-15,32-53
29
Appendix
30
Appendix
TM-T88VI
The TM-T88VI model information is listed in the table below.
58 mm 80 mm
Resolution 180 dpi x 180 dpi (W x H)
Country ANK model
Japanese model
Simplified Chinese model
Traditional Chinese model
Korean model
South Asian model
Print Width 360 dots 512 dots
Characters in a Line Font A ANK: 30 characters ANK: 42 characters
Kanji *1: 15 characters Kanji *1: 21 characters
Font B ANK: 40 characters ANK: 56 characters
Kanji *2: 22 characters Kanji *2: 32 characters
*3
Special font A 30 characters 42 characters
*3
Special font B 40 characters 56 characters
*1: 24 dots x 24 dots (W x H)
Character Size Font A ANK: 12 dots x 24 dots (W x H) / Kanji
Font B 9 dots x 17 dots (W x H) / Kanji *2: 16 dots x 16 dots (W x H)
*3
Special font A 12 dots x 24 dots (W x H)
*3
Special font B 9 dots x 24 dots (W x H)
Character Baseline Font A ANK; At the 21st dot from the top of the character
Kanji *1: At the 21st dot from the top of the character
Font B At the 16th dot from the top of the character
Kanji *2: At the 15th dot from the top of the character
*3
Special font A At the 20th dot from the top of the character
*3
Special font B At the 20th dot from the top of the character
Default Line Feed Space 30 dots
Color Specification First color
Page Mode Default Area 360 dots x 831 dots (W x H) 512 dots x 831 dots (W x H)
Page Mode Maximum Area 360 dots x 2400 dots (W x H) 512 dots x 2400 dots (W x H)
Barcode UPC-A, UPC-E, EAN13, JAN13, EAN8, JAN8, CODE39, ITF,CODABAR, CODE93,
CODE128, GS1-128, GS1 DataBar Omnidirectional, GS1 DataBar Truncated,
GS1 DataBar Limited, GS1 DataBar Expanded
Two-Dimensional Code PDF417, QR Code, MaxiCode, GS1 DataBar Stacked, GS1 DataBar Stacked
Omnidirectional, GS1 DataBar Expanded Stacked, Aztec Code, Data Matrix
(Composite Symbology not supported)
Paper Cut Cut, Feed cut
Drawer Kick-Out Supported
Buzzer Option (Pattern A ~ Pattern E, Error, No paper, Stop)
Battery Not supported
Bluetooth connection Supported only by the TM-T88VI Bluetooth® model.
31
Appendix
ePOS-Print settings
Item Value
Printing Method Thermal (203 dpi)
Character Code Tables Page 0-5,16-19,20-21,26,30-31,11-15,32-53
32
Appendix
TM-T88VI-iHUB
The TM-T88VI-iHUB model information is listed in the table below.
58 mm 80 mm
Resolution 180 dpi x 180 dpi (W x H)
Country ANK model
Japanese model
Simplified Chinese model
Traditional Chinese model
Korean model
South Asian model
Print Width 360 dots 512 dots
Characters in a Line Font A ANK: 30 characters ANK: 42 characters
Kanji *1: 15 characters Kanji *1: 21 characters
Font B ANK: 40 characters ANK: 56 characters
Kanji *2: 22 characters Kanji *2: 32 characters
*3
Special font A 30 characters 42 characters
*3
Special font B 40 characters 56 characters
*1: 24 dots x 24 dots (W x H)
Character Size Font A ANK: 12 dots x 24 dots (W x H) / Kanji
Font B 9 dots x 17 dots (W x H) / Kanji *2: 16 dots x 16 dots (W x H)
*3
Special font A 12 dots x 24 dots (W x H)
*3
Special font B 9 dots x 24 dots (W x H)
Character Baseline Font A ANK; At the 21st dot from the top of the character
Kanji *1: At the 21st dot from the top of the character
Font B At the 16th dot from the top of the character
Kanji *2: At the 15th dot from the top of the character
*3
Special font A At the 20th dot from the top of the character
*3
Special font B At the 20th dot from the top of the character
Default Line Feed Space 30 dots
Color Specification First color
Page Mode Default Area 360 dots x 831 dots (W x H) 512 dots x 831 dots (W x H)
Page Mode Maximum Area 360 dots x 2400 dots (W x H) 512 dots x 2400 dots (W x H)
Barcode UPC-A, UPC-E, EAN13, JAN13, EAN8, JAN8, CODE39, ITF,CODABAR, CODE93,
CODE128, GS1-128, GS1 DataBar Omnidirectional, GS1 DataBar Truncated,
GS1 DataBar Limited, GS1 DataBar Expanded
Two-Dimensional Code PDF417, QR Code, MaxiCode, GS1 DataBar Stacked, GS1 DataBar Stacked
Omnidirectional, GS1 DataBar Expanded Stacked, Aztec Code, Data Matrix
(Composite Symbology not supported)
Paper Cut Cut, Feed cut
Drawer Kick-Out Supported
Buzzer Option (Pattern A ~ Pattern E, Error, No paper, Stop)
Battery Not supported
33
Appendix
ePOS-Print settings
Item Value
Printing Method Thermal (203 dpi)
Character Code Tables Page 0-5,16-19,20-21,26,30-31,11-15,32-53
34
Appendix
35