Preview only show first 10 pages with watermark. For full document please download

Epos-device Sdk For Javascript User`s Manual

   EMBED


Share

Transcript

ePOS-Device SDK for JavaScript User’s Manual Overview Describes the features and development environment. Building Environment Describes environment building for ePOS-Device Service I/F. Programming Guide Describes how to write programs in Web application development. API Reference Describes the APIs provided in ePOS-Device SDK for JavaScript. Device Control Script Describes the device control script. Sample Program Describes the sample program. Appendix Describes the list of keycode and printer specifications. M00055809 Rev.J 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 permission of Seiko Epson Corporation. • The contents of this document are subject to change without notice. Please contact us for the latest information. • While every precaution has 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 designated 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 and ESC/POS are registered trademarks or trademarks of Seiko Epson Corporation. Windows and Internet Explorer are either registered trademarks or trademarks of Microsoft Corporation in the United States and other countries. SafariTM and TrueType are either registered trademarks or trademarks of Apple Inc. in the United States and other countries. AndroidTM and Google ChromeTM are either registered trademarks or trademarks of Google Inc. in the United States and other countries. Mozilla and Firefox are either registered trademarks or trademarks of Mozilla Foundation in the United States and other countries. iOS is registered trademarks or trademarks of Cisco in the United States and other countries. All other trademarks are the property of their respective owners and used for identification purpose only. ESC/POS® Command System EPSON has been taking industry’s initiatives with its own POS printer command system (ESC/POS). ESC/POS has a large number of commands including patented ones. Its high scalability enables users to build versatile POS systems. The system is compatible with all types of EPSON POS printers (excluding the TM-C100) and displays. Moreover, its flexibility makes it easy to upgrade the future. The functionality and the user-friendliness is valued around the world. © Seiko Epson Corporation 2014. All rights reserved. 2 For Safety Key to Symbols The symbols in this manual are identified by their level of importance, as defined below. Read the following carefully before handling the product. Provides information that must be observed to avoid damage to your equipment or a malfunction. Provides important information and useful tips. 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 About this Manual Aim of the Manual This manual is intended to provide development engineers with all the information necessary for building/designing an ePOS-Device system or developing/designing an ePOS-Device application, by using TM-Intelligent. The TM-Intelligent series in this manual is a generic term for the TM-DT series and TM-i series. The TM-DT series is a generic term for the following printers.  TM-T88V-DT  TM-T70II-DT  TM-H6000IV-DT The TM-i series is a generic term for the following printers.  TM-T88V-i (TM-i firmware Ver.4.0 or later )  TM-T70-i (TM-i firmware Ver.4.0 or later )  TM-T20II-i  TM-T82II-i  TM-T83II-i Manual Content The manual is made up of the following sections: Chapter 1 Overview Chapter 2 Building Environment Chapter 3 Programming Guide Chapter 4 API Reference Chapter 5 Device Control Script Chapter 6 Sample Program Appendix List of KeyCode Printer Specifications 4 Contents ■ For Safety .............................................................................................................................. 3 Key to Symbols ....................................................................................................................................... 3 ■ Restriction of Use .................................................................................................................. 3 ■ About this Manual ................................................................................................................ 4 Aim of the Manual ................................................................................................................................. 4 Manual Content .................................................................................................................................... 4 ■ Contents................................................................................................................................ 5 Overview ......................................................................................11 ■ ePOS-Device SDK............................................................................................................... 11 Features................................................................................................................................................. 12 System Configuration Example .......................................................................................................... 13 How to Use the Communication Box................................................................................................. 16 Specifying the Print Job ID from the Application ............................................................................. 19 Spooler Function .................................................................................................................................. 20 ■ Operating Environment ..................................................................................................... 23 Web Browser on Terminal .................................................................................................................... 23 TM-Intelligent Series.............................................................................................................................. 23 ePOS-Device Service Versions............................................................................................................ 23 TM Printer............................................................................................................................................... 24 Customer Display ................................................................................................................................. 25 Peripheral Device ................................................................................................................................ 25 ■ Contents in the Package................................................................................................... 26 Package ............................................................................................................................................... 26 Other Manual ....................................................................................................................................... 26 Download ............................................................................................................................................. 26 ■ Restrictions.......................................................................................................................... 27 Building Environment ...................................................................29 ■ Workflow.............................................................................................................................. 29 TM-DT Series .......................................................................................................................................... 29 TM-i Series.............................................................................................................................................. 30 ■ Registration of Device........................................................................................................ 31 TM-DT Series .......................................................................................................................................... 31 TM-i Series.............................................................................................................................................. 33 5 Programming Guide.................................................................... 35 ■ Embedding of ePOS-Device SDK for JavaScript ............................................................. 35 ■ Programming Flow ............................................................................................................. 36 If Automatically Reconnecting to the Network ................................................................................37 Programming flow for the Communication Box................................................................................39 ■ Using the Spooler Function................................................................................................ 43 API Reference .............................................................................. 45 ■ List of ePOS-Device API ..................................................................................................... 45 ePOSDevice Object.............................................................................................................................46 Common to Device Object ................................................................................................................46 Display Object ......................................................................................................................................47 Keyboard Object..................................................................................................................................48 Printer Object........................................................................................................................................49 HybridPrinter Object.............................................................................................................................52 Scanner Object ....................................................................................................................................56 SimpleSerial Object ..............................................................................................................................56 DeviceHubTerminal object..................................................................................................................57 CommBoxManager Object ................................................................................................................57 CommBox Object ................................................................................................................................57 ■ ePOS-Device Object ......................................................................................................... 58 Constructor ...........................................................................................................................................58 connect method ..................................................................................................................................58 disconnect method ............................................................................................................................59 isConnected method .........................................................................................................................59 createDevice method.........................................................................................................................60 deleteDevice method .........................................................................................................................62 getAdmin method ...............................................................................................................................62 getLocation method............................................................................................................................62 getCommBoxManager method ........................................................................................................63 onreconnecting event.........................................................................................................................63 onreconnect event ..............................................................................................................................63 ondisconnect event.............................................................................................................................63 ■ Common to Device Object............................................................................................... 64 callEvent method .................................................................................................................................64 ■ Display Object.................................................................................................................... 65 reset method.........................................................................................................................................65 createWindow method .......................................................................................................................66 destroyWindow method ......................................................................................................................67 setCurrentWindow method.................................................................................................................67 clearWindow method..........................................................................................................................67 setCursorPosition method ....................................................................................................................68 moveCursorPosition method ...............................................................................................................68 setCursorType method.........................................................................................................................69 addText method...................................................................................................................................69 addReverseText method .....................................................................................................................70 addMarquee method .........................................................................................................................71 setBlink method ....................................................................................................................................72 6 setBrightness method .......................................................................................................................... 72 showClock method ............................................................................................................................. 73 addCommand method...................................................................................................................... 73 send method ........................................................................................................................................ 73 onreceive event................................................................................................................................... 74 ■ Keyboard Object ............................................................................................................... 75 setPrefix method .................................................................................................................................. 75 onkeypress event ................................................................................................................................. 75 onstring event....................................................................................................................................... 75 setMSRPrefix method (expansion method for keyboard with MSR)............................................... 76 ondata event (event for keyboard with an MSR) ............................................................................ 76 ■ Printer Object ..................................................................................................................... 77 addTextAlign method.......................................................................................................................... 77 addTextLineSpace method ................................................................................................................ 78 addTextRotate method ...................................................................................................................... 79 addText method .................................................................................................................................. 80 addTextLang method.......................................................................................................................... 81 addTextFont method........................................................................................................................... 83 addTextSmooth method ..................................................................................................................... 84 addTextDouble method ..................................................................................................................... 85 addTextSize method ............................................................................................................................ 86 addTextStyle method .......................................................................................................................... 87 addTextPosition method ..................................................................................................................... 89 addTextVPosition method................................................................................................................... 90 addFeedUnit method.......................................................................................................................... 91 addFeedLine method ......................................................................................................................... 92 addFeedPosition method ................................................................................................................... 93 addFeed method ................................................................................................................................ 93 addImage method.............................................................................................................................. 94 addLogo method ................................................................................................................................ 96 addBarcode method.......................................................................................................................... 97 addSymbol method .......................................................................................................................... 101 addHLine method.............................................................................................................................. 106 addVLineBegin method.................................................................................................................... 107 addVLineEnd method....................................................................................................................... 108 addPageBegin method.................................................................................................................... 109 addPageEnd method ....................................................................................................................... 109 addPageArea method ..................................................................................................................... 110 addPageDirection method .............................................................................................................. 111 addPagePosition method................................................................................................................. 112 addPageLine method....................................................................................................................... 113 addPageRectangle method ........................................................................................................... 114 addCut method................................................................................................................................. 115 addPulse method .............................................................................................................................. 116 addSound method ............................................................................................................................ 117 addLayout method ........................................................................................................................... 119 addRecovery method ...................................................................................................................... 122 addReset method ............................................................................................................................. 122 addCommand method.................................................................................................................... 123 send method ...................................................................................................................................... 124 print method....................................................................................................................................... 125 getPrintJobStatus method ................................................................................................................ 127 startMonitor method.......................................................................................................................... 127 stopMonitor method.......................................................................................................................... 127 recover method ................................................................................................................................. 127 7 reset method.......................................................................................................................................127 halftone property ...............................................................................................................................128 brightness property ............................................................................................................................128 force property.....................................................................................................................................128 timeout property ................................................................................................................................129 interval property .................................................................................................................................129 onreceive event .................................................................................................................................130 onstatuschange event ......................................................................................................................132 onbatterystatuschange event..........................................................................................................132 ononline event....................................................................................................................................132 onoffline event ....................................................................................................................................132 onpoweroff event ...............................................................................................................................132 oncoverok event ................................................................................................................................133 oncoveropen event ...........................................................................................................................133 onpaperok event ...............................................................................................................................133 onpapernearend event ....................................................................................................................133 onpaperend event ............................................................................................................................133 ondrawerclosed event ......................................................................................................................134 ondraweropen event.........................................................................................................................134 onbatteryok event .............................................................................................................................134 onbatterylow event ...........................................................................................................................134 ■ HybridPrinter Object ........................................................................................................ 135 API for creating print documents .....................................................................................................135 lock method........................................................................................................................................138 unlock method ...................................................................................................................................138 ReceiptPrinter.send method .............................................................................................................138 ReceiptPrinter.print method ..............................................................................................................139 SlipPrinter.send method .....................................................................................................................140 SlipPrinter.cancel method .................................................................................................................140 SlipPrinter.timeout property ...............................................................................................................140 EndorsePrinter.enable40cplMode method.....................................................................................140 EndorsePrinter.send method .............................................................................................................141 EndorsePrinter.cancel method .........................................................................................................141 EndorsePrinter.timeout property .......................................................................................................141 MICRReader.read method................................................................................................................141 MICRReader.cancel method............................................................................................................142 MICRReader.eject method ...............................................................................................................142 MICRReader.cleaning method.........................................................................................................142 MICRReader.timeout property..........................................................................................................142 startMonitor method ..........................................................................................................................143 stopMonitor method ..........................................................................................................................143 interval property .................................................................................................................................143 recover method..................................................................................................................................143 reset method.......................................................................................................................................143 halftone property ...............................................................................................................................144 brightness property ............................................................................................................................144 force property.....................................................................................................................................145 onreceive event .................................................................................................................................146 ■ Scanner Object ................................................................................................................ 148 ondata event......................................................................................................................................148 ■ SimpleSerial Object ......................................................................................................... 149 sendCommand method ...................................................................................................................149 oncommandreply event ...................................................................................................................149 8 ■ DeviceHubTerminal object ............................................................................................. 150 shutdown method ..............................................................................................................................150 ■ CommBoxManager Object ............................................................................................ 151 openCommBox method ...................................................................................................................151 closeCommBox method....................................................................................................................152 ■ CommBox Object ............................................................................................................ 153 getCommHistory method .................................................................................................................153 send method ......................................................................................................................................154 onreceive event .................................................................................................................................155 Device Control Script ................................................................ 157 ■ Programming.................................................................................................................... 157 Using Device Control Script ...............................................................................................................157 Configuration of Device Control Script............................................................................................158 ■ List of Device Control Script API...................................................................................... 160 ClientConnection object ..................................................................................................................160 DeviceConnection object ................................................................................................................160 Device Control Script Name object.................................................................................................160 ■ ClientConnection Object ................................................................................................ 161 send .....................................................................................................................................................161 ■ DeviceConnection Object.............................................................................................. 162 send .....................................................................................................................................................162 ■ Device Control Script Name Object .............................................................................. 163 onDeviceData event (Input Device That Can Run with a HID Driver) .........................................163 onDeviceData event (Serial Communication Device) .................................................................163 Any event ............................................................................................................................................164 Sample Program ........................................................................ 165 ■ Overview........................................................................................................................... 165 ■ Operating Environment ................................................................................................... 168 ■ Environment Setting for TM-DT Series.............................................................................. 169 Setting the Devices ............................................................................................................................170 ■ Environment Setting for TM-i Series ................................................................................. 171 Setting the Devices ............................................................................................................................172 ■ Starting the Sample Program .......................................................................................... 173 ■ How to Use the Sample Program .................................................................................... 174 POS Terminal Sample .........................................................................................................................174 Entry Terminal ......................................................................................................................................180 Receipt Designer ................................................................................................................................183 Printer Sample.....................................................................................................................................189 Hybrid Printer Sample.........................................................................................................................191 Customer Display Sample .................................................................................................................194 Keyboard Sample...............................................................................................................................196 Barcode Scanner Sample .................................................................................................................198 9 Appendix.................................................................................... 199 ■ List of KeyCode................................................................................................................. 199 ■ Printer Specifications ....................................................................................................... 200 TM-H6000IV-DT/ TM-H6000IV ..............................................................................................................200 TM-T70II-DT/ TM-T70II ...........................................................................................................................202 TM-T88V-DT/ TM-T88V-i/ TM-T88V........................................................................................................203 TM-T20II-i...............................................................................................................................................205 TM-T70-i/ TM-T70 ..................................................................................................................................207 TM-T82II-i/ TM-T82II ...............................................................................................................................208 TM-T83II-i/ TM-T83II ...............................................................................................................................210 TM-L90 ..................................................................................................................................................212 TM-P20..................................................................................................................................................214 TM-P60II ................................................................................................................................................216 TM-P60II with Peeler ............................................................................................................................218 TM-P80..................................................................................................................................................220 TM-T20 ..................................................................................................................................................221 TM-T20II.................................................................................................................................................222 TM-T88IV ...............................................................................................................................................224 TM-T90 ..................................................................................................................................................225 TM-U220 ...............................................................................................................................................227 10 Chapter 1 Overview Overview This chapter describes the features of and the specifications for ePOS-Device SDK for JavaScript. ePOS-Device SDK 1 Web Browser Web Application Callback API Call ePOS-Device SDK for JavaScript Response /Event Request TM-Intelligent Series ePOS-Device Service I/F Device Control Script (JavaScript) Local Printer Customer Display Serial Communication Device Key Input Device Network Printer ePOS-Device SDK for JavaScript is a function used to control the peripheral devices connected to TMIntelligent series in a multi-platform environment. Using ePOS-Device SDK for JavaScript, you can directly control the peripheral devices from Web browsers on personal computers, smart phones, or tablet computer. 11 Features ❏ Available from anywhere when used with a terminal with a Web browser installed in a network environment. ❏ No need to prepare any device (such as a PC) to act as a controller to control the peripheral devices. ❏ Allows encryption of the data communicated with the peripheral devices. ❏ Devices that run with the OS-standard driver can be used with a device control script without any driver installed. As the device control script is written in JavaScript, it can be developed using the same language as the Web application. *1 ❏ Accessing a device using ePOS-Device SDK for JavaScript automatically locks the device exclusively. Even if accessed from multiple terminals simultaneously, the device is not under multiple controls. When the terminal that has controlled the device releases the device, the device becomes controllable from another terminal. ❏ If the network is cut off, you can easily re-establish the connection. ❏ Data can be sent and received between web applications. For details, refer to How to Use the Communication Box(p.16). ❏ Printing requests can be made to the printer by specifying the printing job ID. *2 For details, refer to Specifying the Print Job ID from the Application(p.19). ❏ Printing data can be sent to the printer without waiting for a printing complete response from the printer. (Spooler) *2 For details, refer to Spooler Function(p.20). ❏ Print data can be sent to another printer if the printer sends an error response (PAPER END, COVER OPEN, etc.) or does not return a response. (Print forwarding) *2 For details, refer to Forwarding(p.22). ❏ You can shut down the TM-DT from the application. *1 (DeviceHubTerminal object) *1 TM-DT series is supported only. *2 ePOS-Device Service Ver. 2.6 or later versions supported 12 Chapter 1 Overview System Configuration Example The following systems can be configured:  System in which an application server is deployed. (p.13)  System that uses a TM intelligent printer as an application server. (p.14) When a TM-i is used as an application server, the functions will be limited. For details, see the TM-i Technical Reference Guide or the TM-i Series PHP Setup Manual. System with Application Server 1 2 3 4 5 6 1 Place a Web application in the server. Display the Web application with a Web browser. The Web browser sends a request message to TM-Intelligent. TM-Intelligent sends data to devices that can be controlled. The devices and network printers connected to TM-Intelligent are controlled. TM-Intelligent returns a response to the Web application. 13 System to Use TM-DT as Application Server 1 2 3 4 5 6 14 Place a Web application in TM-DT. Display the Web application with a Web browser. The Web browser sends a request message to TM-DT. TM-DT sends data to devices that can be controlled. The devices and network printers connected to TM-DT are controlled. TM-DT returns a response to the Web browser. Chapter 1 Overview System to Use TM-i as Application Server 1 1 2 3 4 5 6 Place a Web application in TM-i. Display the Web application with a Web browser. The Web browser sends a request message to TM-i. TM-i sends data to devices that can be controlled. The devices and network printers connected to TM-i are controlled. TM-i returns a response to the Web browser. 15 How to Use the Communication Box The Communication Box is a virtual data space that is provided by the ePOS-Device Service I/F for sending and receiving data between applications. It is provided in ePOS-Device Service Ver.2.5 and later. The ePOS-Device is providing a virtual space and structure for sending and receiving data between applications. Create the data to be sent and received according to your application's specifications. App1 App2 The Communication Box can be used in the following ways.  Using a tablet terminal as a POS display terminal  Displaying digital signage  Using a tablet terminal as an entry terminal 16 Chapter 1 Overview Example of data processing using the Communication Box App1 1 App2 1 2 3 4 5 6 The TM-Intelligent receives the barcode data scanned by the scanner. The ePOS-Device Service I/F notifies App2 of the barcode data. App2 acquires barcode data and converts to POS data. App2 sends the POS data to the ePOS-Device Service I/F's Communication Box. The ePOS-Device Service I/F notifies App1 that the POS data is stored in the Communication Box. App1 acquires the POS data stored in the Communication Box. 17 Structure of the Communication Box -App1 -App2 -App1 App1 -App2 App2 The ePOS-Device Service I/F manages Communication Boxes with Box IDs (BoxID in the figure above). Data can be sent and received between applications belonging to the Communication Box. In the figure above, applications App1 and App2 can send and receive data with one another using the BoxID:1 Communication Box. Specifications of the Communication Box 18 Maximum number of Communication Boxes that can be created 20 Maximum number of applications that can belong to one Communication Box 20 Space of transfer history that one Communication Box can maintain 10240 Byte Size of data that can be sent at one time 1024 Byte Chapter 1 Overview Specifying the Print Job ID from the Application A response containing the specified print job ID will be returned when sending a request from the application by specifying the print job ID. (ePOS-Device Service Ver. 2.6 or later versions) Job ID : ABC123 Job ID : ABC123 Print data Response data 1 19 Spooler Function The spooler function is a function used to temporarily store printing data received from the application in the TM-Intelligent to carry out background printings sequentially. (ePOS-Device Service Ver. 2.6 or later versions) This function cannot be used on TM-DT series printers. TM-Intelligent return response data to the application the moment the printing data enters the spooler to make it possible for applications to proceed to the next process without waiting for a printing complete response. The application can use the job ID included in the response data to send an inquiry on the printing status. EPSON TMNet WebConfig is used to configure the spooler. Perform the following settings. For details, refer to the Technical Reference Guide for each TM-Intelligent.  Settings to enable the spooler  Print process retry settings Forwarding can be used to send a printing job to a different printer if the printer does not respond to retry processing. For details, refer to Forwarding(p.22). Example 20 1 Send print data A to a TM-Intelligent (ePOS-Device Service I/F) from the input terminal. 2 The TM-Intelligent will save the print data A to the spooler and will return response data to the input terminal. 3 The TM-Intelligent will retrieve the print data and issue a print command to another TM-i printer. Chapter 1 4 5 6 7 8 9 Overview Print data B will be sent to the TM-Intelligent from the input terminal. The TM-Intelligent will save the print data B to the spooler and will return response data to the input terminal. The TM-Intelligent will retrieve the print data B and issue a print command to printer A. Print data A is complete. A query on print data A results will be sent to the TM-Intelligent from the input terminal. The TM-Intelligent will return response data back to the input terminal signifying that print data A completed without error. 21 1 Forwarding • EPSON TMNet WebConfig is used to configure forwarding settings. For details, refer to the Technical Reference Guide for each TM-Intelligent Printer. • This function cannot be used on TM-DT series printers. 1 2 3 4 5 22 Send print data to ePOS-Device Service I/F from the input terminal. The TM-Intelligent issues a print command to printer A. Printer A does not respond. The TM-Intelligent reissues a print command to printer A.  If printer A still does not respond to the reissued print command, the print command will be issued to printer B. Print data sent from the input terminal will be printed using printer B. Chapter 1 Overview Operating Environment Web Browser on Terminal Use the following Web browsers: ❏ Windows Internet Explorer 8 or later (To use the "print" method of the Printer object, Windows Internet Explorer 9 or later is required.) ❏ Mozilla Firefox 12.0 or later ❏ Google Chrome 21 or later 1 ❏ Safari in iOS 5.0 or later TM-Intelligent Series Updating the version of the ePOS-Device used will make it possible to use new functions on the ePOS-Device. For details on performing updates, refer to the Technical Reference Guide for each TM-Intelligent Printer. TM-DT Series ❏ TM-T88V-DT ❏ TM-T70II-DT ❏ TM-H6000IV-DT TM-i Series ❏ TM-T88V-i (TM-i Firmware Ver.4.0 or later) ❏ TM-T70-i (TM-i Firmware Ver.4.0 or later) ❏ TM-T20II-i ❏ TM-T82II-i ❏ TM-T83II-i ePOS-Device Service Versions The versions of the ePOS-Device service support the following TM-DT Software version and TM-i firmware  version. ePOS-Device Service TM-DT Software TM-i Firmware 1.0x 1.0x - 2.0x 2.0x - 2.2x 2.2x - 2.5x 2.5x 4.0x 2.6x - 4.1x 23 TM Printer Besides a TM-Intelligent printer, the TM printers below can be controlled. TM Printer TM-DT Series TM-i Series TM-T20II-i - ✔ TM-T70-i (TM-i firmware Ver.4.0 or later ) - ✔ TM-T82II-i - ✔ TM-T83II-i *2 - ✔ - ✔ ✔ - TM-T88V-i (TM-i firmware Ver.4.0 or later ) TM-H6000IV *1 *1 ✔ ✔ TM-P20 - ✔ *2 TM-P60II ✔ ✔ TM-P60II Peeler ✔ ✔ TM-P80 - ✔ TM-T20 *1 ✔ ✔ - ✔ ✔ ✔ TM-L90 TM-T20II *1 TM-T70 *1 *1 ✔ ✔ TM-T82II *1 - ✔ TM-T83II *1,2 - ✔ TM-T88IV *1 - ✔ TM-T70II *1 ✔ ✔ TM-T90 *1 ✔ ✔ TM-U220 *1 ✔ ✔ TM-T88V *1 Ethernet model (UB-E02/ UB-E03), or wireless LAN model (UB-R03/ UB-R04).  Other interface models are not supported. *2 ePOS-Device Service Ver. 2.6 or later versions supported TM-T20II-i cannot control other TM printers. Interface Use a TM printer with the following interface: ❏ Wired LAN (UB-E02/ UB-E03) ❏ Wireless LAN (UB-R03/ UB-R04) 24 Chapter 1 Overview Customer Display The following customer display is available: ❏ TM-T88V-DT  DM-D110 USB Interface for TM-T88V-DT ❏ Other TM-DT series  DM-D110 USB Interface ❏ TM-i series  DM-D110 USB Interface 1 Peripheral Device Device * TM-DT Series TM-i Series Keyboard device ✔ ✔ Barcode scanner ✔ ✔ Input device ✔ ✔ Serial communication device ✔ ✔ USB device that can provide a control level equivalent to serial communication devices * ✔ - Will require separate installation of a serial-USB conversion driver.  Serial-USB conversion drivers with certain specifications may not be usable. With the TM-DT Series, a peripheral device can be used with a device control script file developed by the user to match the device. Also, an API for device control script is available. For details, see Device Control Script(p.157). 25 Contents in the Package Package The following are included: ❏ epos-device-*.js (ePOS-Device JavaScript for embedding) ❏ ePOS-Device SDK for JavaScript User’s Manual (This Document) ❏ ePOS-Device_Sample_JS_Vx.x.xE.zip (Sample program) ❏ ePOS-Device_Sample_Barcode.pdf (Barcode data for the sample program) ❏ DeviceControlScript_Sample.zip (Sample for device control script) File Target Device Keyboard_Generic.js Keyboard Scanner_Generic.js Barcode scanner SimpleSerial_Generic.js Serial communication device DeviceControlScript_Sample.zip contains a sample of a device control script for the TM-DT. It cannot be used with the TM-i series. Other Manual ❏ ePOS-Device XML User’s Manual ❏ TM-T88V-DT Technical Reference Guide ❏ TM-T70II-DT Technical Reference Guide ❏ TM-H6000IV-DT Technical Reference Guide ❏ TM-T88V-i (TM-i Firmware Ver.4.0 or later) Technical Reference Guide ❏ TM-T70-i (TM-i Firmware Ver.4.0 or later) Technical Reference Guide ❏ TM-T20II-i Technical Reference Guide ❏ TM-T82II-i Technical Reference Guide ❏ TM-T83II-i Technical Reference Guide Download For customers in North America, go to the following web site: http://www.epsonexpert.com/ and follow the on-screen instructions. For customers in other countries, go to the following web site: https://download.epson-biz.com/?service=pos 26 Chapter 1 Overview Restrictions ❏ The ruled line command is available only when the printer supports the "ruled line command". ❏ The drawer and the buzzer cannot be used together. ❏ The buzzer function cannot be used if the printer is not provided with the buzzer. ❏ When a 2D-code scanner is used, multibyte characters such as Japanese cannot be obtained properly. ❏ When 2D-code data contains an ASCII control code (0x00 to 0x1F), control codes cannot be obtained. ❏ Keycodes that can be obtained from the keyboard are restricted. For the key codes that can be obtained, refer to List of KeyCode(p.199). ❏ Internet Explorer 9 does not allow printing to the printer to be performed from security-protected Web pages (HTTPS). 1 ❏ prototype.js in the JavaScript library will compete with eposdevice-2.x.x.js in the library of ePOS-Device SDK for JavaScript, and so cannot be used together with that file. ❏ Device control script files cannot be registered in a TM-i Series printer. ❏ Serial communication devices cannot be used with a TM-i Series printer with the specification of "without Serial port". ❏ The PHP function and print spooler function cannot be used simultaneously on a TM-i series printer. 27 28 Chapter 2 Building Environment Building Environment This chapter describes environment building for ePOS-Device Service I/F. Workflow TM-DT Series 1. Network Settings Configure the system and TM-DT network settings.  These settings can be made via the following.  Windows network settings 2  EPSON TMNet WinConfig 2. Registration of Web Content Register Web content to TM-DT from a Web browser. For details, refer to the Technical Reference Guide for each TM-DT printer. 3. Connection of Device to TM-DT Connect a device to TM-DT. For the devices that can be connected, refer to Operating Environment (p.23). (Though TM-DT has only one port for serial communication device, USB connection is available with a serial-USB conversion cable and driver.) 4. Registration of Device Control Script Register a device control script prepared by the customer to control non-Epson devices with a TM-DT printer or to customize device data processes. Registration is performed via your web browser. For details, refer to the Technical Reference Guide for each TM-DT printer. 5. Registration of Device (p.31) Register the device to be connected into TM-DT. Make registration using a Web browser. Necessary step Optional step 29 TM-i Series 1. Connection of Device to TM-i Connect a device to TM-i. For the devices that can be connected, refer to Operating Environment (p.23). 2. Network Settings Configure the system and TM-i network settings. These settings can be made via the following. For details, refer to the Technical Reference Guide of each TM-i.  EPSON TMNet WebConfig  EpsonNet Config  Easy Kitting 3. Registration of Device (p.31) Register the device to be connected into TM-i. Make registration using a Web browser. 4. Registration of Web Content If you use the TM-i as a web server, register the web contents via EPSON TMNet WebConfig. For details, refer to the Technical Reference Guide for each TM-i printer. Necessary step Optional step 30 Chapter 2 Building Environment Registration of Device Register the device to be controlled by ePOS-Device SDK for JavaScript into TM-Intelligent. Configure the settings using EPSON TMNet WebConfig. EPSON TMNet WebConfig can be launched from your web browser. For details, refer to the Technical Reference Guide for each TM-Intelligent. TM-DT Series Configure the following settings for each device connected to the TM-DT printer. Printer Setting Setting Value Device ID Enter the ID (any character string) of the printer to be controlled. Type Select "Network printer". Model no. Select the model of the printer to be controlled. IP Address Specify the IP address of the printer for each device ID. Retry interval Specify the retry interval after timeout. 2 Customer Display Setting Setting Value Customer Display Set whether or not this is used. Communications settings Set the communication speed, data bit and parity. Brightness settings Set the brightness of the customer display. The device ID of the customer display is fixed to "local_display". Key input device Setting Setting Value Device ID Enter the device ID (any character string). Device name Select the device name of the key input device. Control Script Select the device control script to be used for the key input device. 31 Serial communications Setting Setting Value Device ID Enter the device ID (any character string). Device name Select the device name of the serial communication device. The name can be selected from the product names and ports. Control script Select the device control script to be used for the serial communication device. Communication speed(bps) Set the communication speed of the device. Data bit Set the data bit. Parity Set the parity. Stop bit Set the stop bit. Flow control Set the flow control. Other Setting 32 Setting Value Device ID Enter the device ID (any character string). Control script Select the device control script to be used for the connected device. Chapter 2 Building Environment TM-i Series Configure the following settings for each device connected to the TM-i printer. Printer Setting Setting Value Device ID Enter the ID (any character string) of the printer to be controlled. Model Select the model of the printer to be controlled. IP Address Specify the IP address of the printer for each device ID. Retry interval(ms) Specify the retry interval after timeout. Customer Display Setting Setting Value Customer Display Set whether or not this is used. Communications settings Set the communication speed, data bit and parity. Brightness settings Set the brightness of the customer display. 2 The device ID of the customer display is fixed to "local_display". Key input device Setting Setting Value Device ID Enter the device ID (any character string). Device name Select the device name of the key input device. Control Script Select the device control script to be used for the key input device. Serial communications Setting Setting Value Serial communications Set whether or not this is used. Communication speed(bps) Set the communication speed of the device. Data bit Set the data bit. Parity Set the parity. Stop bit Set the stop bit. Flow control Set the flow control. The device ID of the serial communication device is fixed to "local_serial". 33 34 Chapter 3 Programming Guide Programming Guide This chapter describes how to write programs in the application development using ePOS-Device SDK for JavaScript. Embedding of ePOS-Device SDK for JavaScript The ePOS-Device SDK for JavaScript is provided so that ePOS-Device can be used from the JavaScript on the client side. It is provided as JavaScript, and its file name is “epos-device-*.js”. The ePOS-Device SDK for JavaScript is used by embedding epos-device-*.js into applications. Preparation To use the ePOS-Device API, place epos-device-*.js on the Web server. Embedding into Web pages Embed the script into the Web page by using the HTML 35 Programming Flow The basic programming sequence of ePOS-Device SDK for JavaScript is as follows: Applications ePOS-Device Device 1 : new epson.ePOSDevice() Create an ePOSDevice object 2 : connect() Establish a communication path to ePOS-Device Service I/F 2.1 : callback('OK') * 3 : createDevice(DEVICE_TYPE_PRINTER) Obtain a device object 3.1 : Cmd() 4 : Device open 4.1 : callback(Object, 'OK') 5 : Registration of callback according to the device 6 : Method according to the device 6.1 : Cmd() 6.1.1 : Execute 5.1 : Execution result 5.2 : callback('success') 7: deleteDevice(Object) Release a device object 8.1 : callback('OK') 9: disconnect() Disconnect the communication path to ePOS-Device Service I/F *: "SSL_CONNECT_OK" (SSL Communication) 36 7.1 : Cmd() 8: Device close Chapter 3 Programming Guide If Automatically Reconnecting to the Network The following is a sequence for automatically reconnecting if network communication is cut off with the TMIntelligent. The following uses a case where the barcode scanner is used as an example. Applications ePOS-Device Barcode Scanner [1/2] 1 : new epson.ePOSDevice() Create an ePOSDevice object 2 : connect() Establish a communication path to ePOS-Device Service I/F 2.1 : callback('OK') *1 3 : Registration a re-establish callback *2 3 4 : createDevice(DEVICE_TYPE_PRINTER)*3 4.1 : Cmd() Obtain a device object 5 : Device open 5.1 : callback(Object, 'OK') 6 : Registration of callback according to the device Network is cut off 4.2 : onreconnecting Event Notify the starting of reconnection 7 : Scan 7.1 : Scan data Retains data in the ePOS-Device Service I/F Network reconnection was done successfully 4.3 : onreconnect Event Notify the reconnection completion 7.1.1 : callback:ondata Event Sends data that retained in the ePOS-Device Service I/F *1: "SSL_CONNECT_OK" (SSL Communication). *2: Includes the reconnection started event / reconnection completed event / reconnection failed event. *3: Sets options parameters to resend data when reconnected to the network. 37 Applications ePOS-Device 8: deleteDevice(Object) Release a device object 9.1 : callback('OK') 10: disconnect() Disconnect the communication path to ePOS-Device Service I/F 38 Barcode Scanner 8.1 : Cmd() 9: Device close [2/2] Chapter 3 Programming Guide Programming flow for the Communication Box The following indicates the basic programming sequence using the Communication Box. A "Client" in the sequence figure refers to an application. Client A ePOS-Device Client B Client C [1/2] 1 : new epson.ePOSDevice() Creates ePOS-Device object 1 : new epson.ePOSDevice() Creates ePOS-Device object 1 : new epson.ePOSDevice() Creates ePOS-Device object 2 : connect() Establishes communication path with ePOS-Device Service I/F 2.1 : callback('OK') * 2 : connect() Establishes communication path with ePOS-Device Service I/F 2.1 : callback('OK') * 2 : connect() 3 Establishes communication path with ePOS-Device Service I/F 2.1 : callback('OK') * 3 : getCommboxManager() Acquires CommboxManager object 3 : getCommboxManager() 3 : getCommboxManager() 4 : openCommbBox() Opens the Communication Box 4.1 : Creates the Communication Box Acquires CommboxManager object 4.2 : Adds Client A to members Acquires CommboxManager object 4.3 : callback('OK') 4 : openCommbBox() Opens the Communication Box 4.2 : Adds Client B to members 4.3 : callback('OK') 5 : Registers the onreceive event *: "SSL_CONNECT_OK" (SSL Communication). 39 Client A ePOS-Device Client B Client C 4 : openCommbBox() Opens the Communication Box 4.2 : Adds Client C to members 4.3 : callback('OK') 5 : Registers the onreceive event 6 : send() 6.1 : Designates client to forward the data to Sends data 6.2 : onreceive() event Forwards data 6.2 : onreceive() event Forwards data 7 : closeCommBox() 7.1 : Deletes Client C from members Closes the Communication Box 7.2 : callback('OK') 7 : closeCommBox() Closes the Communication Box 7.1 : Deletes Client B from members 7.2 : callback('OK') 7 : closeCommBox() Closes the Communication Box 7.2 : callback('OK') 40 7.1 : Deletes Client A from members [2/2] Chapter 3 Programming Guide If automatically reconnecting the network If network communication with the TM-Intelligent was reconnected, the Communication Box sequence is as follows. A "Client" in the sequence figure refers to an application. Client A ePOS-Device [1/2] Client B 1 : new epson.ePOSDevice() Creates ePOS-Device object 1 : new epson.ePOSDevice() Creates ePOS-Device object 2 : connect() Establishes communication path with ePOS-Device Service I/F 2.1 : callback('OK') *1 2 : connect() Establishes communication path with ePOS-Device Service I/F 2.1 : callback('OK') *1 3 : Registers the reconnection callback *2 4 : getCommboxManager() 3 Acquires CommboxManager object 5 : openCommbox() 4 : getCommboxManager() Opens the Communication Box Acquires CommboxManager object callback('OK') 5 : openCommbox() 6 : Registers the onreceive event Opens the Communication Box callback('OK') 6 : Registers the onreceive event Network is disconnected 7 : send() 3.2 : onreconnecting event Notification for starting the reconnection Sends a message to the Communication Box. Network successfully reconnects 3.3 : onreconnect event Notification for starting the reconnection 7.1 : onreceive event Forwards data received while the network was disconnected *1: "SSL_CONNECT_OK" (SSL Communication). *2: Includes the reconnection started event / reconnection completed event / reconnection failed event. 41 Client A ePOS-Device Client B 8 : closeCommbox() Closes the Communication Box callback('OK') 8 : closeCommbox() Closes the Communication Box callback('OK') 42 [2/2] Chapter 3 Programming Guide Using the Spooler Function A printing job will be executed immediately and a response will be returned to the application after printing is complete when sending a printing request to ePOS-Device Service I/F from the application when the spooler function is disabled. ePOS-Device Application Printer 1 : sendData() 1.1 : Cmd() 1.1.1 : Print() 1.2 : Printing results 1.3 : callback(” success” ) The print data job will be added to the queue and a response will be returned to the application without waiting for printing to complete when sending a printing request to ePOS-Device Service I/F from the application when the spooler function is enabled. ePOS-Device Application Printer Spooler 3 1 : sendData(printjobid) 1.1 : send() 1.2 : Execution result 1.3 : callback(” success” ) 2 : Cmd() 2.1 : Print() Print result 3 : getPrintJobStatus(printjobid) 3.1 : getPrintJobStatus() 3.2 : Print result 3.3 : callback(” success” ) 43 Even if the output printer cannot complete the printing task, ePOS-Device Service I/F does not return an error to the application. Enabling forward printing will allow for the printing task to be completed on a substitute printer, with the application acquiring the printing results afterward. Refer to the sequence diagram below. Application ePOS-Device Printer Spooler Forwarding printer 1 : sendData(printjobid) 1.1 : send() 1.2 : Execution result 1.3 : callback(” success” ) 2 : Cmd() 2.1 : Print() Printing results (Failure) 3 : Cmd() 3.1 : Print() Printing results (Success) 4 : getPrintJobStatus(printjobid) 4.1 : getPrintJobStatus() 4.2 : Printing result 4.3 : callback(” success” ) Programming Example A response containing the specified print job ID will be returned when the spooler function is enabled. ePOS-Device Service I/F will issue a print job ID if the print job ID is not specified by the application. The print job status can be acquired using the print job ID contained in the response. var printjobid = ''; function sendJob() { printer.addText('Hello, World!\n'); printer.addCut(); printer.onreceive = function (res) { if (res.success) { printjobid = res.printjobid; } } printer.onerror = function (err) { alert(err.status); }; printer.send(); } function getJobStatus() { if (printjobid.length > 0) { printer.onreceive = function (res) { alert(res.success); }; printer.onerror = function (err) { alert(err.status); }; printer.getPrintJobStatus(printjobid); } } 44 Chapter 4 API Reference API Reference This section describes the API that is available with ePOS-Device SDK for JavaScript. List of ePOS-Device API ePOS-Device SDK for JavaScript provides the following objects: The objects supported vary with the TM-Intelligent. Object * TM-DT Series TM-i Series Page ePOSDevice object  (window.epson.ePOSDevice) ✔ ✔ 46 Common to Device object ✔ - 46 Display object ✔ ✔ 47 Keyboard object ✔ ✔ 48 Printer object ✔ ✔ 49 HybridPrinter object ✔ - 52 Scanner object ✔ ✔ 56 SimpleSerial object ✔ ✔* 56 DeviceHubTerminal object ✔ - 57 CommBoxManager object ✔ ✔ 57 CommBox object ✔ ✔ 57 SimpleSerial objects cannot be used with a TM-i Series printer with the specification of "without a Serial port". 45 4 ePOSDevice Object Element API Description Page Constructor Initialization ePOSDevice Initializes an ePOSDevice object. 58 connect Establishes a communication path. 58 disconnect Disconnects a communication path. 59 isConnected Obtains communication path status. 59 Method Communication Path createDevice Obtains a device object. 60 deleteDevice Deletes a device object. 62 getAdmin Obtains the administrator information. 62 getLocation Obtains the installation location information. 62 Communication between applications getCommBox Manager Acquires CommboxManager object 63 Starting reconnection onreconnecting Reconnection started event 63 Completing reconnection onreconnect Reconnection completed event 63 Disconnection ondisconnect Network disconnection event 63 Device Administration Information Event Constant Value to specify the device type. DEVICE_TYPE_* Used for the createDevice parameter. Common to Device Object Element API Description Page Calls any event on the device control script according to the device object. 64 Method Event Call callEvent (SimpleSerial object is not supported.) 46 Chapter 4 API Reference Display Object Element API Description Page Method Initialization Window Cursor Text Display reset Reset 65 createWindow Define the display area. 66 destroyWindow Destroys the display area. 67 setCurrentWindow Switches the display area. 67 clearWindow Clears the current display area. 67 setCursorPosition Moves the cursor position. 68 moveCursorPosition Moves the cursor position in the current display area. 68 setCursorType Changes the cursor display. 69 addText Displays text. 69 addReverseText Displays reversed text. 70 addMarquee Displays marquee. 71 Display  Attribute setBlink Display blinking. 72 setBrightness Changes the display brightness. 72 Clock showClock Displays the clock. 73 Send  Command addCommand Executes a command. 73 Send send Sends a control instruction. 73 Receive Result onreceive Control result receipt event 74 Event 4 Constant SCROLL_* Specifies the window scroll mode. MOVE_* Specifies the cursor destination. CURSOR_* How to display the cursor BRIGHTNESS_* Display brightness MARQUEE_* How to customer display marquee 47 Keyboard Object Element API Description Page Method String settings setPrefix Specifies the conditions for handling input as a series of strings. 75 Detect Key onkeypress Key press detection event. 75 Detect String onstring String detection event. 75 Set conditions for handling data as MSR data. 76 Card data detection event. 76 Event Expansion method for keyboard with an MSR MSR data settings setMSRPrefix Expansion event for keyboard with an MSR Detect Data 48 ondata Chapter 4 API Reference Printer Object Element API Description Page Method Text Paper Feed addTextAlign Adds the text alignment settings to the command buffer. 77 addTextLineSpace Adds the line feed space settings to the command buffer. 78 addTextRotate Adds the text rotation print settings to the command buffer. 79 addText Adds text printing to the command buffer. 80 addTextLang Adds the target language settings to the command buffer. 81 addTextFont Adds the text font settings to the command buffer. 83 addTextSmooth Adds the text smoothing settings to the command buffer. 84 addTextDouble Adds the double-sized text settings to the command buffer. 85 addTextSize Adds the text scale settings to the command buffer. 86 addTextStyle Adds the text style settings to the command buffer. 87 addTextPosition Adds the print position settings to the command buffer. 89 addTextVPosition *1 Adds a tag for specifying the print vertical position of text. 90 addFeedUnit Adds a tag for paper feeding (in dots). 91 addFeedLine Adds a tag for paper feeding (in lines). 92 addFeedPosition Adds control of label paper/black mark paper to command buffer. 93 addFeed Adds a line feed to the command buffer. 93 addImage Adds raster image printing to the command buffer. 94 addLogo Adds NV logo printing to the command buffer. 96 addBarcode Adds barcode printing to the command buffer. 97 addSymbol Adds 2D-Code printing to the command buffer. 101 addHLine Adds horizontal line printing to the command buffer. 106 addVLineBegin Adds vertical line start to the command buffer. 107 addVLineEnd Adds vertical line end to the command buffer. 108 Graphic Barcode Ruled Line 4 49 Element API Description Page Method addPageBegin Adds page mode start to the command buffer. 109 addPageEnd Adds page mode end to the command buffer. 109 addPageArea Adds the print area settings in the page mode to the command buffer. 110 addPageDirection Adds the print direction settings in the page mode to the command buffer. 111 addPagePosition Adds the print position settings in the page mode to the command buffer. 112 addPageLine Adds drawing a line in the page mode to the command buffer. 113 addPageRectangle Adds drawing a rectangle in the page mode to the command buffer. 114 Cut addCut Adds paper cut to the command buffer. 115 Drawer addPulse Adds drawer kick-out to the command buffer. 116 Buzzer addSound Adds turning on the buzzer to the command buffer. 117 Layout addLayout *1 Adds the paper layout setup to command buffer 119 recover *2 Recovers from an error that can be recovered from. 127 addRecovery *1 Adds a tag for recovering from an error. 122 Page Mode Recovery Reset Send Command Send *2 Resets the printer. 127 addReset *1 Adds a tag for resetting the printer. 122 addCommand Adds a command to the command buffer. 123 send Sends a print document. 124 Prints HTML5 Canvas. 125 reset print *3 Print job getPrintJobStatus Acquires print job status. 127 Status Monitoring startMonitor Enables a status event. 127 stopMonitor Disables a status event. 127 halftone Raster image halftone processing method 128 Property Image 50 brightness Raster image brightness correction value 128 Forced transmission force *1 Forced transmission mode 128 Timeout timeout Sending timeout time 129 Monitoring Interval interval Printer status update interval 129 Chapter 4 Element API Description API Reference Page Event Receive Result onreceive Response document receipt event 130 onstatuschange Status change event 132 onbatterystatus change *1 Battery status change event 132 ononline Online event 132 onoffline Offline event 132 onpoweroff Non-response event 132 oncoverok Cover close event 133 oncoveropen Cover open event 133 onpaperok Paper remaining event 133 onpaperend Paper end event 133 onpapernearend Paper near end event 133 ondrawerclosed Drawer close event 134 ondraweropen Drawer open event 134 Battery OK event 134 Battery low event 134 onbatteryok *1 onbatterylow *1 Constant FONT_* Font ALIGN_* Alignment COLOR_* Color specification HALFTONE_* Halftone type MODE_* Color mode BARCODE_* barcode type HRI_* HRI position SYMBOL_* 2D-Code type LEVEL_* Error correction level LINE_* Line style DIRECTION_* Page mode print direction CUT_* Paper cut type DRAWER_* Drawer kick-out connector PLUSE_* Drawer kick-out pulse length PATTERN_* Buzzer sound pattern FEED_* Paper feed ASB_* Response document status LAYOUT_* Type of papers *1 ePOS-Device Service Ver. 2.2 or later versions supported *2 ePOS-Device Service Ver. 2.5 or later versions supported *3 ePOS-Device Service Ver. 2.6 or later versions supported 4 51 HybridPrinter Object Element API Description Page Method lock Locks the device. 138 unlock Unlocks the device. 138 ReceiptPrinter.send Sends the print document. 138 ReceiptPrinter.print Prints HTML5 Canvas. 139 SlipPrinter.send Sends the print document. 140 SlipPrinter.cancel Cancels the paper insert wait status. 140 EndorsePrinter.send Sends the print document. 141 EndorsePrinter. cancel Cancels the paper insert wait status. 141 EndorsePrinter. enable40 cplMode Sets the 40 cpl mode. 140 MICRReader.read Executes MICR reading. 141 MICRReader.cancel Cancels the paper insert wait status. 142 MICRReader.eject Ejects the check paper. 142 MICRReader. cleaning Cleans the MICR mechanism. 142 Status Monitoring startMonitor Enables a status event. 143 stopMonitor Disables a status event. 143 Recovery recover Recovers from an error that can be recovered from. 143 Reset reset Resets the printer. 143 SlipPrinter.timeout Timeout time for the paper insert wait status. 140 EndorsePrinter. timeout Timeout time for the paper insert wait status. 141 MICRReader. timeout Timeout time for the paper insert wait status. 142 interval Printer status update interval 143 halftone Raster image halftone processing method 144 brightness Raster image brightness correction value 144 force Forced transmission mode 145 Device lock Receipt printing Slip printing Endorse printing MICR Property Timeout Monitoring Interval Image Forced transmission 52 Chapter 4 Element API Description API Reference Page Event Receive Result onreceive Response document receipt event 130 onstatuschange Status change event 132 ononline Online event 132 onoffline Offline event 132 onpoweroff Non-response event 132 oncoverok Cover close event 133 oncoveropen Cover open event 133 onpaperok Paper remaining event 133 onpaperend Paper end event 133 onpapernearend Paper near end event 133 ondrawerclosed Drawer close event 134 ondraweropen Drawer open event 134 Constant ASB_* Response document status MICR_* Type of papers 4 53 API for creating print documents *Only in standard mode. Description Receipt printing Slip printing Endorse printing Endorse printing 40 cpl mode Element Page addTextAlign Adds the text alignment settings to the command buffer. ✔ ✔ ✔ - 77 addTextLineSpace Adds the line feed space settings to the command buffer. ✔ ✔ ✔ - 78 addTextRotate Adds the text rotation print settings to the command buffer. ✔ ✔ ✔ ✔ 79 addText Adds text printing to the command buffer. ✔ ✔ ✔ ✔ 80 addTextLang Adds the target language settings to the command buffer. ✔ ✔ - - 81 addTextFont Adds the text font settings to the command buffer. ✔ ✔ ✔ - 83 addTextSmooth Adds the text smoothing settings to the command buffer. ✔ - - - 84 addTextDouble Adds the double-sized text settings to the command buffer. ✔ ✔ ✔ - 85 addTextSize Adds the text scale settings to the command buffer. ✔ ✔ ✔ - 86 addTextStyle Adds the text style settings to the command buffer. ✔ ✔ ✔ - 87 addTextPosition Adds the print position settings to the command buffer. ✔ ✔ ✔ ✔ 89 addTextVPosition Adds a tag for specifying the print vertical position of text. ✔ ✔ - - 90 addFeedUnit Adds a tag for paper feeding (in dots). ✔ ✔ ✔ ✔ 91 addFeedLine Adds a tag for paper feeding (in lines). ✔ ✔ ✔ - 92 addFeedPosition Adds control of label paper/ black mark paper to command buffer. - - - - 93 addFeed Adds a line feed to the command buffer. ✔ ✔ ✔ ✔ 93 addImage Adds raster image printing to the command buffer. ✔ - - - 94 addLogo Adds NV logo printing to the command buffer. ✔ ✔ - - 96 API Method Text Paper Feed Graphic 54 Chapter 4 API Reference *Only in standard mode. Receipt printing Slip printing Endorse printing Endorse printing 40 cpl mode Element Page addBarcode Adds barcode printing to the command buffer. ✔ ✔* - - 97 addSymbol Adds 2D-Code printing to the command buffer. ✔ - - - 101 addHLine Adds horizontal line printing to the command buffer. - - - - 106 addVLineBegin Adds vertical line start to the command buffer. - - - - 107 addVLineEnd Adds vertical line end to the command buffer. - - - - 108 addPageBegin Adds page mode start to the command buffer. ✔ ✔ - - 109 addPageEnd Adds page mode end to the command buffer. ✔ ✔ - - 109 addPageArea Adds the print area settings in the page mode to the command buffer. ✔ ✔ - - 110 addPageDirection Adds the print direction settings in the page mode to the command buffer. ✔ ✔ - - 111 addPagePosition Adds the print position settings in the page mode to the command buffer. ✔ ✔ - - 112 addPageLine Adds drawing a line in the page mode to the command buffer. - - - - 113 Adds drawing a rectangle in the addPageRectangle page mode to the command buffer. - - - - 114 API Description Method Barcode Ruled Line Page Mode Cut addCut Adds paper cut to the command buffer. ✔ - - - 115 Drawer addPulse Adds drawer kick-out to the command buffer. ✔ ✔ ✔ ✔ 116 Buzzer addSound Adds turning on the buzzer to the command buffer. - - - - 117 Layout addLayout Adds the paper layout setup to command buffer. - - - - 119 Send Command addCommand Adds a command to the command buffer. ✔ ✔ ✔ ✔ 123 55 4 Endorse printing 40 cpl mode Description API Endorse printing Receipt printing Element Slip printing *Only in standard mode. Page Constant FONT_* Font ALIGN_* Alignment COLOR_* Color specification HALFTONE_* Halftone type MODE_* Color mode BARCODE_* Barcode type HRI_* HRI position SYMBOL_* 2D-Code type LEVEL_* Error correction level LINE_* Line style DIRECTION_* Page mode print direction CUT_* Paper cut type DRAWER_* Drawer kick-out connector PLUSE_* Drawer kick-out pulse length PATTERN_* Buzzer sound pattern FEED_* Paper feed LAYOUT_* Type of papers Scanner Object Element API Description Page Event Detect Data ondata Barcode data detection event 148 SimpleSerial Object Element API Description Page Method String  settings sendCommand Sends a command. 149 Detect Response oncommandreply Command sending result notification event 149 Event 56 Chapter 4 API Reference DeviceHubTerminal object Element API Description Page Method Shutdown shutdown Shuts the TM-DT down. 150 CommBoxManager Object Element API Description Page Method Communication between  applications openCommBox Opens the Communication Box. 151 closeCommBox Closes the Communication Box. 152 CommBox Object Element API Description Page Method Transfer history getCommHistory Acquires the message transfer history. 153 Send send Sends a message to the Communication Box. 154 Receive onreceive Notifies that the message in the Communication Box was received. 155 4 Event 57 ePOS-Device Object Constructor Constructor for an ePOS-Device object. Creates a new ePOS-Device object and initializes it. Syntax ePOSDevice(); Return value  ePOS-Device object connect method Establishes a communication path to ePOS-Device Service I/F of TM-Intelligent. TM-i does not support SSL communication. Syntax connect(ipAddress, port, callback); Parameter  ipAddress: Object type : (String) Specifies the IP address of TM-Intelligent.  port: Object type : (Number) Specifies "8008" (port number of ePOS-Device Service I/F). For SSL communication, specify 8043.  callback: Object type : (Function) Specifies the callback to receive the processing results. To the first parameter of the callback, the following string is returned: String 58 Description "OK" Connected successfully. "SSL_CONNECT_OK" Connected successfully. (SSL Communication) "ERROR_TIMEOUT" A timeout occurred. "ERROR_PARAMETER" Parameter error Chapter 4 API Reference disconnect method Disconnects the communication path connected with "connect". Syntax disconnect(); isConnected method Obtains status of the communication path connected with connect method (p.58). If the terminal goes to sleep, the returned value may not be the correct value. Syntax isConnected(); Return value  The connection status of the communication path Return value Description true Connected false Not connected 4 59 createDevice method Obtains a device object to act as the interface with the device. • When this method is successfully executed, the specified device is exclusively locked and calling "createDevice" from a different Web browser returns "DEVICE_IN_USE". The printer is not locked exclusively and can obtain device objects with "createDevice" from multiple Web browsers. • If "createDevice" is executed immediately during a return process after an ondisconnect event, "DEVICE_IN_USE" occurs. In this case, retry until a value other than "DEVICE_IN_USE" is obtained. Syntax ❏ Recommended createDevice(deviceId, deviceType, options, callback); ❏ Previous format createDevice(deviceId, deviceType, crypto, callback); Parameter  deviceId: Object type: (String) Specifies the device ID. When specifying "DEVICE_TYPE_DISPLAY" to the second parameter (deviceType), specify "local_display".  deviceType: Object type : (String) Specifies any of the following device types: String Description DEVICE_TYPE_DISPLAY Specifies the customer display for the device type. DEVICE_TYPE_KEYBOARD Specifies the keyboard for the device type. DEVICE_TYPE_PRINTER Specifies the printer for the device type. DEVICE_TYPE_SCANNER Specifies the scanner for the device type. DEVICE_TYPE_SIMPLE_SERIAL Specifies the serial communication device for the device type. DEVICE_TYPE_HYBRIDPRINTER Specifies the hybrid printer for the device type. DEVICE_TYPE_DT Specifies the device hub terminal for the device type.  With TM-i, the following objects are not supported:  DEVICE_TYPE_HYBRIDPRINTER  DEVICE_TYPE_DT  A TM-i Series printer with the specification of "without a Serial port" does not support DEVICE_TYPE_SIMPLE_SERIAL. 60 Chapter 4  options: API Reference Object type : (Object) Specify the following properties. Property crypto Description Specifies whether encryption of the communication data is required. (true/false) buffer Specifies if it is necessary to buffer the data that occurred in the device during reconnection and resend the data upon reconnection. (true/false)  crypto: Object type :( Boolean) Specifies whether encryption of the communication data is required.  callback: Object type : (Function) Specifies the callback to receive the processing results. When the second parameter of the callback is "OK", the device object is returned to the first parameter. To the second parameter, the following string is returned: String "OK" Description Obtained the device object successfully. "DEVICE_NOT_FOUND" Device is not found. "DEVICE_IN_USE" Device is in use. "DEVICE_OPEN_ERROR" Failed to open the device. "DEVICE_CATEGORY_INVALID" Invalid device type. "SYSTEM_ERROR" Other error occurred. 4 61 deleteDevice method Releases a device to be available from other clients. Syntax deleteDevice(deviceObject, callback); Parameter  deviceObject :Object type : (Object) Specifies the device object.  callback: Object type: (Function) Specifies the callback to receive the processing results. To the parameter of the callback, the following string is returned: String Description "OK" Device close succeeded. "DEVICE_NOT_OPEN" Device not open. "DEVICE_CLOSE_ERROR" Failed to close the device. "SYSTEM_ERROR" Other error occurred. getAdmin method Obtains the administrator name set in TM-Intelligent. (The administrator name can be set with EPSON TMNet WebConfig.) Syntax getAdmin(); Return value  String of administrator name(String) getLocation method Obtains the installation location information set in TM-Intelligent. The string of the installation location can be set with EPSON TMNet WebConfig. Syntax getLocation(); Return value  String of installation location (String) 62 Chapter 4 API Reference getCommBoxManager method Obtains the CommBoxManager object that performs communication between applications. Syntax getCommBoxManager(); Return value  CommBoxManager object onreconnecting event Receives that the reconnection was started due to a disconnection that occurred in the network. If this event occurred, perform processing so that a message is displayed saying that reconnection was started. Syntax Function(); onreconnect event Receives that reconnection was successfully done. 4 If this event occurred, perform processing so that the message displayed during reconnection is removed. Syntax Function(); ondisconnect event Receives that reconnection failed. If this event occurred, perform processing for taking measures against network disconnections, such as establishing a side connection. Syntax Function(); 63 Common to Device Object Cannot be used with TM-i Series. callEvent method Calls any event on the device control script side according to the device object. For details, refer to Device Control Script (p.157). Syntax callEvent(eventName, data); Parameter  eventName: Object type : (String) Specifies the event name on the device control script side.  data: 64 Object type : (Object) Specifies the data to be passed to the event to be called. Simple JSON data consisting of a set of property name and value can be specified. Chapter 4 API Reference Display Object reset method Adds the initialization settings of the customer display to the command buffer. Initialization changes the status as follows:  All the displayed characters are cleared and all the registered windows are deleted.  The cursor is restored to the default status and moves to the customer display origin.  The display blinking and brightness settings are restored to the default status. Syntax reset(); Return value  Display object 4 65 createWindow method Adds the window settings to the command buffer. Define a window so that it does not overlap with a defined window. Specify the size to fit in the customer display size (20 digits x 2 rows). Syntax createWindow(number, x, y, width, height, scrollMode); Parameter  number: Object type : (Number) Specifies the window number. Specify a number between 1 and 4.  x: Object type : (Number) Specifies the x-coordinate of the window origin on the customer display.  Specify a number between 1 and 20.  y: Object type : (Number) Specifies the y-coordinate of the window origin on the customer display.  Specify "1" or "2".  width: Object type : (Number) Specifies the window width.  height: Object type : (Number) Specifies the window height.  scrollMode: Object type : (String) Specifies the window scroll mode from the following: Set value Return value  Display object 66 Description SCROLL_OVERWRITE When characters are displayed while the display position is at the upper right end, the display position moves to the lower left end. When characters are displayed while the display position is at the lower right end, the position moves to the upper left end. SCROLL_VERTICAL When characters are displayed while the display position is at the upper right end, the display position moves to the lower left end. When characters are displayed while the display position is at the lower right end, the characters already displayed in the lower row are scrolled to the upper row and the lower row is cleared. SCROLL_HORIZONTAL When characters are displayed while the display position is at the right end, all the characters already displayed in the row where the cursor exists are scrolled one character to the left and a new character is displayed at the right end. Chapter 4 API Reference destroyWindow method Adds the destroy settings for the defined window to the command buffer. Syntax destroyWindow(number); Parameter  number: Object type : (Number) Specifies the window number to be destroyed. Specify a number between 1 and 4. Return value  Display object setCurrentWindow method Adds the change settings of the current window to the command buffer. Sets the specified window as the current window and moves the cursor to the origin of the current window. Syntax setCurrentWindow(number); Parameter  number: Object type : (Number) Specifies the destination window number. Specify a number between 1 and 4. 4 Return value  Display object clearWindow method Adds the current window display clear to the command buffer. Syntax clearWindow(); Return value  Display object 67 setCursorPosition method Adds the cursor position settings to the command buffer. Syntax setCursorPosition(x, y); Parameter  x: Object type : (Number) Specifies the x-coordinate of the destination. Specify a number between 1 and 20.  y: Object type : (Number) Specifies the y-coordinate of the destination. Specify "1" or "2". Return value  Display object moveCursorPosition method Adds the cursor position settings in the current window to the command buffer. Syntax moveCursorPosition(position); Parameter  position: Object type : (String) Specifies the cursor destination in the current window by selecting from the following: Set value Return value  Display object 68 Description MOVE_TOP_LEFT Sets the destination at the top left. MOVE_TOP_RIGHT Sets the destination at the top right. MOVE_BOTTOM_LEFT Sets the destination at the bottom left. MOVE_BOTTOM_RIGHT Sets the destination at the bottom right. Chapter 4 API Reference setCursorType method Adds the cursor display settings to the command buffer. Syntax setCursorType(type); Parameter  type: Object type : (String) Specifies the cursor display method by selecting from the following: Set value Description CURSOR_NONE No cursor display CURSOR_UNDERLINE Underline Return value  Display object addText method Adds string display to the command buffer. Syntax ❏ ❏ ❏ ❏ addText(data); addText(data, lang); addText(data, x, y); addText(data, x, y, lang); 4 Parameter  data: Object type : (String) Specifies the string to be displayed.  lang: Object type : (String) Specifies the language to display the string from the following: Set value Description “en” (default) Specifies English for the display language. “ja” Specifies Japanese for the display language.  x: Object type : (Number) Specifies the x-coordinate of the display position. Specify a number between 1 and 20.  y: Object type : (Number) Specifies the y-coordinate of the display position. Specify "1" or "2". Return value  Display object 69 addReverseText method Adds reversed string display to the command buffer. Syntax ❏ ❏ ❏ ❏ addReverseText(data); addReverseText(data, lang); addReverseText(data, x, y); addReverseText(data, x, y, lang); Parameter  data: Object type : (String) Specifies the string to be displayed.  lang: Object type : (String) Specifies the language to display the string from the following: Set value "en" (default) Specifies English for the display language. "ja" Specifies Japanese for the display language.  x: Object type : (Number) Specifies the x-coordinate of the display position. Specify a number between 1 and 20.  y: Object type : (Number) Specifies the y-coordinate of the display position. Specify "1" or "2". Return value  Display object 70 Description Chapter 4 API Reference addMarquee method Adds marquee display to the command buffer. Marquee is displayed in the horizontal scroll mode in one line, regardless of the scroll mode set for the display window. Syntax addMarquee(data, format, unitWait, repeatWait, repeatCount, lang); Parameter  data: Object type : (String) Specifies the string to be displayed.  format: Object type : (String) Specifies the string display method by selecting from the following: Set value Description MARQUEE_WALK Displays the string from the right end of the window. MARQUEE_PLACE Displays the string from the left end of the window.  unitWait: Object type : (Number) Specifies the display interval (ms) for each character. A value between 1 and 2000 can be specified.  repeatWait: Object type : (Number) Specifies the interval (ms) to repeat the string display. A value between 1 and 2000 can be specified.  repeatCount: Object type : (Number) Specifies the number of times to repeat the string display. A value between 1 and 127 can be specified. When "0" is specified, display is repeated unlimitedly.  lang: Object type : (String) Specifies the language to display the string from the following: Set value Description "en"(Default) Specifies English for the display language. "ja" Specifies Japanese for the display language. Return value  Display object 71 4 setBlink method Adds the screen blinking settings to the command buffer. Syntax setBlink(interval); Parameter  interval: Object type : (Number) Specifies the blinking time (ms). Specify a number between 1 and 12700. The specified values are rounded in units of 50ms. When "0" is specified, the display lights on. Return value  Display object setBrightness method Adds the customer display brightness settings to the command buffer. Syntax setBrightness(brightness); Parameter  brightness: Object type : (Number) Specifies the customer display brightness level by selecting from the following: Set value Return value  Display object 72 Description BRIGHTNESS_20 Set the customer display brightness to "20%". BRIGHTNESS_40 Set the customer display brightness to "40%". BRIGHTNESS_60 Set the customer display brightness to "60%". BRIGHTNESS_100 Set the customer display brightness to "100%". Chapter 4 API Reference showClock method Adds time display to the command buffer. Enabling time display clears all the displayed strings. Sending another command during time display finishes time display. Syntax showClock(); Return value  Display object addCommand method Adds commands to the command buffer. For information about ESC/POS commands, see the ESC/POS Command Reference.  You can view the ESC/POS Command Reference from https://reference.epson-biz.com/. Syntax addCommand(data); Parameter  data: 4 Object type : (String) Specifies ESC/POS command with binary data. Return value  Display object send method Sends commands in the command buffer. Syntax send(); 73 onreceive event Receives the command execution results. Syntax Function(response); Parameter of the callback function  response: Object type : (Object) Receives the command execution results. The following properties are included: Property Name Object type success Command execution result Boolean code Error code string String Value of success Set value Description true/1 Process succeeded. false/0 Process failed. Value of code Set value 74 Description “EDSP_NOT_FOUND” Device is not found. “EDSP_NOT_OPEN” Failed to open the device. “EDSP_INVALID_WINDOW” The specified window is not registered. “EX_BADPORT” An internal communication error with the device occurred. “EX_TIMEOUT” A timeout error occurred in communication with the device. “EX_INVALID_VALUE” An invalid parameter is detected. Chapter 4 API Reference Keyboard Object setPrefix method Sets the keycode to identify the beginning of a string when receiving keyboard input collectively as a series of strings. Syntax setPrefix(data); Parameter  data: Object type : (Array) Specifies the array of keycodes. For the keycodes, refer to List of KeyCode (p.199). onkeypress event Receives a key press event. Syntax Function(data); Parameter of the callback function  data: Object type : (Object) Receives the following properties: Property keycode 4 Description Keycode Character corresponding to the keycode. ascii "undefined" is applied when no characters corresponding to the keycode (F1 key, for example) exist. onstring event Receives a string of character input beginning with any of the strings specified with setPrefix and detected until the Enter key is detected. Syntax Function(data); Parameter of the callback function  data: Object type : (Object) Receives the following properties: Property Description input Detected string prefix Keycode identified as the beginning of a string 75 setMSRPrefix method (expansion method for keyboard with MSR) Uses a keyboard with an MSR to set a key code for determining the beginning of card information. This method is the expansion method. Use callEvent to call it. Syntax callEvent('setPrefix', data); Parameter  'setPrefix': Fixed value.  data: Object type : (Object) Specifies the following properties. Property keycode Description Sets the keycode for determining the beginning when card information is received. For the keycodes, refer to List of KeyCode (p.199). Return value  Sequence number ondata event (event for keyboard with an MSR) Receives scanned events of card information in keyboards with an MSR. Syntax Function(data); Parameter of the callback function  data: Object type : (Object) Receives the following properties: Property 76 Description track1 Entire data of track1 track2 Entire data of track2 track4 Entire data of track4 (JIS2 track) account_number Account number expiration_date Expiration date ("YYMM" format) surname Surname first_name First name middle_initial Middle name/initial title Title service_code Service code track1_dd Desired data of track1 track2_dd Desired data of track2 Chapter 4 API Reference Printer Object addTextAlign method Adds the text alignment setting to the command buffer. • This API setting is applied to raster image/NV logo/barcode/2D-Code. • When using the standard mode, specify addTextAlign in "Position at the beginning of lines". • In the page mode, addTextAlign method specification cannot be used. In the page mode, use the addTextPosition method to designate the horizontal print position. When the page mode is selected for the print mode, to set text rotation, use the addPageDirection method (p. 111) instead of this API function. Syntax addTextAlign(align); Parameter  align : (Required parameter, Object type : String) Specifies the text alignment. Constant(align) Description ALIGN_LEFT (default) Alignment to the left ALIGN_CENTER Alignment to the center ALIGN_RIGHT Alignment to the right 4 Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid Object type Error 77 addTextLineSpace method Adds the line feed space setting to the command buffer. Syntax addTextLineSpace(linespc); Parameter  linespc : (Required parameter, Object type : Number) Specifies the line feed space (in dots). Specifies an integer from 0 to 255. Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid 78 Object type Error Chapter 4 API Reference addTextRotate method Adds the text rotation setting to the command buffer. • This API setting also applies to barcodes/two dimensional symbols. • When using the standard mode, specify addTextAlign in "Position at the beginning of lines". • In the page mode, addTextAlign method specification cannot be used. When the page mode is selected for the print mode, to set text rotation, use the addPageDirection method (p.111) instead of this API function. Syntax addTextRotate(rotate); Parameter  rotate : (Required parameter, Object type : Boolean) Specifies whether to rotate text. Setting Description true/1 Specifies rotated printing of text. false/0 (default) Cancels rotated printing of text. Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter 4 Exception Exception Parameter " ... " is invalid Object type Error 79 addText method Adds the printing of text to the command buffer. After printing text, to print content other than text, execute line feed or paper feed. In page mode, characters are laid out in the current print position with the reference point being the character baseline dot (Printer Specifications (p.200)). Syntax addText(data); Parameter  data : (Required parameter, Object type : String) Specify a character string to be printed. For the horizontal tab/line feed, use the following escape sequences: String Description \t Horizontal tab (HT) \n Line feed (LF) \\ Carriage return Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid 80 Object type Error Chapter 4 API Reference addTextLang method Adds the language setting to the command buffer. Syntax addTextLang(lang); Parameter  lang : (Required parameter, Object type : String) Specifies the target language. Setting Language en(default) English (ANK) de German (ANK) fr French (ANK) it Italian (ANK) es Spanish (ANK) ja Japanese (International character set changes to Japan.) ja-jp Japanese (International character set changes to Japan.) ko Korean (International character set changes to Korean.) ko-kr Korean (International character set changes to Korean.) zh-hans * Simplified Chinese (International character set changes to China.) zh-cn Simplified Chinese (International character set changes to China.) zh-hant * Traditional Chinese zh-tw Traditional Chinese th Thai (Only for South Asia model.) Language code besides above English (ANK) * 4 ePOS-Device Service Ver. 2.2 or later versions supported Characters not installed in a printer cannot be printed. For printable character code, refer to the Technical Reference Guide of your printer. 81 Depending on language specification, a part of characters is printed as follows. Language Characters $(U+0024) Characters \(U+005C) Japanese $ ¥ Korean $ ₩ Simplified Chinese ¥ \ Traditional Chinese $ \ Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid 82 Object type Error Chapter 4 API Reference addTextFont method Adds the text font setting to the command buffer. Syntax addTextFont(font); Parameter  font : (Required parameter, Object type : String) Specifies the font. Constant (font) Language FONT_A (default) Font A FONT_B Font B FONT_C Font C FONT_D Font D FONT_E Font E FONT_SPECIAL_A Special font A FONT_SPECIAL_B Special font B Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter 4 Exception Exception Parameter " ... " is invalid Object type Error 83 addTextSmooth method Adds the smoothing setting to the command buffer. Syntax addTextSmooth(smooth); Parameter  smooth : (Required parameter, Object type : Boolean) Specifies whether to enable smoothing. Setting Description true/1 Specifies smoothing. false/0 (default) Cancels smoothing Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid 84 Object type Error Chapter 4 API Reference addTextDouble method Adds the double-sized text setting to the command buffer. Syntax addTextDouble(dw, dh); Parameter  dw : (Optional parameter, Object type : Boolean) Specifies the double-sized width. Setting true/1 Specifies the double-sized width. false/0 (default) Cancels the double-sized width undefined (When not specified)  dh : Description Retains the current setting for double-sized width. ( Optional parameter, Object type : Boolean) Specifies the double-sized height. Setting Description true/1 Specifies the double-sized height false/0 (default) Cancels the double-sized height undefined (When not specified) Retains the current setting for double-sized height 4 When true /1 is set for both the dw and dh parameters, double width and height characters are printed. Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid Object type Error 85 addTextSize method Adds the text scale setting to the command buffer. Syntax addTextSize(width, height); Parameter  width : ( Optional parameter, Object type : Number) Specifies the horizontal scale of text. Setting Integer from 1 to 8 undefined (When not specified)  height : Description Horizontal scale (default : 1) Retains the current setting for the horizontal scale. ( Optional parameter, Object type : Number) Specifies the vertical scale of text. Setting Integer from 1 to 8 undefined (When not specified) Description Vertical scale (default : 1) Retains the current setting for the vertical scale. Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid 86 Object type Error Chapter 4 API Reference addTextStyle method Adds the text style setting to the command buffer. Syntax addTextStyle(reverse, ul, em, color); Parameter  reverse : ( Optional parameter, Object type : Boolean) Specifies inversion of black and white for text. Setting true/1 Specifies the inversion of black and white parts of characters. false/0 (default) Cancels the inversion of black and white parts of characters. undefined (When not specified)  ul : Description Retains the current setting for inversion of black and white. ( Optional parameter, Object type : Boolean) Specifies the underline style. Setting true/1 Specifies underlining. false/0 (default) Cancels underlining. undefined (When not specified)  em : Description Retains the current underlining setting. Setting Description true/1 Specifies emphasized printing of characters. false/0 (default) Cancels emphasized printing of characters. undefined Retains the current setting for emphasized printing. (When not specified)  color : 4 ( Optional parameter, Object type : Boolean) Specifies the bold style. (Optional parameter, Object type : String) Specifies the color. Setting Description COLOR_NONE Characters are not printed. COLOR_1 (default) First color COLOR_2 Second color COLOR_3 Third color COLOR_4 Fourth color undefined (When not specified) Retains the current color setting 87 Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid 88 Object type Error Chapter 4 API Reference addTextPosition method Adds the horizontal print start position of text to the command buffer. Syntax addTextPosition(x); Parameter  x: (Required parameter, Object type : Number) Specifies the horizontal print start position (in dots).  Specifies an integer from 0 to 65535. Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid Object type Error 4 89 addTextVPosition method Adds the vertical print start position of text to the command buffer. (in ePOS-Device Service Ver.2.2 and later) Use this API function by inserting it between addPageBegin to addPageEnd. Syntax addTextVPosition(y); Parameter  y: (Required parameter, Object type : Number) Specifies the vertical print start position (in dots).  Specifies an integer from 0 to 65535. Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid 90 Object type Error Chapter 4 API Reference addFeedUnit method Adds paper feeding in dots to the command buffer. Syntax addFeedUnit(unit); Parameter  unit : (Required parameter, Object type : Number) Specifies the paper feed space (in dots). Specifies an integer from 0 to 255. Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid Object type Error 4 91 addFeedLine method Adds paper feeding in lines to the command buffer. Syntax addFeedLine(line); Parameter  line : (Required parameter, Object type : Number) Specifies the paper feed space (in lines). Specifies an integer from 0 to 255. Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid 92 Object type Error Chapter 4 API Reference addFeedPosition method Adds label / black mark paper feeding to the command buffer. • Control of label paper/black mark paper must be done in the standard mode. • In the page mode, addFeedPosition method specification cannot be used. Syntax addFeedPosition(pos); Parameter  pos : (Required parameter, Object type : String) Specifies the feed position. Setting Description FEED_PEELING Feeds to the peeling position. FEED_CUTTING Feeds to the cutting position. FEED_CURRENT_TOF Feeds to the top of the current label. FEED_NEXT_TOF Feeds to the top of the next label. Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter 4 Exception Exception Parameter " ... " is invalid Object type Error addFeed method Adds a line feed to the command buffer. Syntax addFeed(); Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter 93 addImage method Adds raster image printing to the command buffer. Prints graphics rendered in HTML5 Canvas. Converts the specified range in a RGBA full-color image of HTML5 Canvas into raster image data according to the settings of the halftone and brightness properties. One pixel in an image equals to one printer dot. When an image contains any transparent color, the background color of the image is assumed to be white. • To print a raster image at high speed, specify ALIGN_LEFT for the addTextAlign method (p. 77), and specify a multiple of 8 not exceeding the printer's paper width for the width parameter of this API. • In page mode, a raster image is laid out in the current print position with the reference point being its bottom left dot. The print position will not move. • If an HTML5 Canvas image contains images downloaded from different domains, you cannot print the image. In this case, a security error occurs due to violation of the same origin policy of JavaScript. • Page mode does not support printing in multiple tones. Multiple tone graphics can only be printed in standard mode. Syntax addImage(context, x, y, width, height, color, mode); Parameter  context : (Required parameter, Object type : Context) Specifies the 2D context of HTML5 Canvas.  x: (Required parameter, Object type : Number) Specifies the horizontal start position in the print area. Specifies an integer from 0 to 65535.  y: (Required parameter, Object type : Number) Specifies the vertical start position in the print area. Specifies an integer from 0 to 65535.  width : (Required parameter, Object type : Number) Specifies the width of the print area. Specifies an integer from 0 to 65535.  height : (Required parameter, Object type : Number) Specifies the height of the print area. Specifies an integer from 0 to 65535.  color : (Optional parameter, Object type : String) Specifies the color. Setting Characters are not printed. COLOR_1 (default) First color COLOR_2 Second color COLOR_3 Third color COLOR_4 Fourth color undefined (When not specified) 94 Description COLOR_NONE First color Chapter 4  mode : API Reference (Optional parameter, Object type : String) Specifies the color mode. Setting Description MODE_MONO Monochrome (two-tone) MODE_GRAY16 Gray scale (16-tone) undefined (When not specified) Monochrome (two-tone) Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid Object type Error 4 95 addLogo method Adds NV logo printing to the command buffer. Prints a logo registered in the NV memory of the printer. • Using Model-dedicated Utility or logo registration utility (TMFLogo), register a logo in the printer in advance. • In page mode, a logo is laid out in the current print position with the reference point being its bottom left dot. Page mode does not support printing in multiple tones. Multiple tone graphics can only be printed in standard mode. Syntax addLogo(key1, key2); Parameter  key1 : (Required parameter, Object type : Number) Specifies the key code 1 of an NV logo. Specifies an integer from 0 to 255.  key2 : (Required parameter, Object type : Number) Specifies the key code 2 of an NV logo. Specifies an integer from 0 to 255. Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid 96 Object type Error Chapter 4 API Reference addBarcode method Adds barcode printing to the command buffer. In page mode, a barcode is laid out in the current print position with the reference point being its bottom left dot (except for HRI). Syntax addBarcode(data, type, hri, font, width, height); Parameter  data : (Required parameter, Object type : String) Specifies the barcode data as a string. Specify a string that follows the barcode standard specified by the type parameter. If the specified string does not conform to the standard, a barcode will not be printed. Barcode type Description When an 11-digit number is specified, a check digit is automatically added. UPC-A When a 12-digit number is specified, the 12th digit is processed as a check digit but the check digit is not validated. Specify 0 as the first digit. 4 Specify the manufacturer code in the digits 2 to 6. UPC-E Specify (right-align) the item code in the digits 7 to 11. The number of item code digits varies depending on the manufacturer code. Specify 0s in empty digits. When an 11-digit number is specified, a check digit is automatically added. When a 12-digit number is specified, the 12th digit is processed as a check digit but the check digit is not validated. EAN13 JAN13 EAN8 JAN8 CODE39 ITF When an 12-digit number is specified, a check digit is automatically added. When a 13-digit number is specified, the 12th digit is processed as a check digit but the check digit is not validated. When a 7-digit number is specified, a check digit is automatically added. When an 8-digit number is specified, the 8th digit is processed as a check digit but the check digit is not validated. When the first character is *, the character is processed as the start character. In other cases, a start character is automatically added. Start and stop codes are automatically added. Check digits are not added or validated. 97 Barcode type Description Specify a start character (A to D, a to d). CODABAR Specify a stop character (A to D, a to d). Check digits are not added or validated. CODE93 Start and stop characters are automatically added. A check digit is automatically calculated and added. Specify a start character (CODE A, CODE B, CODE C). A stop character is automatically added. A check digit is automatically calculated and added. To encode each of the following characters, specify two characters starting with the character "{": CODE128 FNC1: {1 FNC2: {2 FNC3: {3 FNC4: {4 CODE A: {A CODE B: {B CODE C: {C SHIFT: {S {: {{ A start character, FNC1, a check digit, and a stop character are automatically added. To automatically calculate and add a check digit for an application identifier (AI) and the subsequent data, specify the character "*" in the position of the check digit. You can enclose an application identifier (AI) in parentheses. The parentheses are used as HRI print characters and are not encoded as data. GS1-128 You can insert spaces between an application identifier (AI) and data. The spaces are used as HRI print characters and are not encoded as data. To encode each of the following characters, specify two characters starting with the character "{": GS1 DataBar Omnidirectional GS1 DataBar Truncated GS1 DataBar Limited 98 FNC1: {1 FNC3: {3 (: {( ): {) *: {* {: {{ Specify a 13-digit global trade item number (GTIN) not including an application identifier (AI) or a check digit. Chapter 4 Barcode type API Reference Description You can enclose an application identifier (AI) in parentheses. The parentheses are used as HRI print characters and are not encoded as data. GS1 DataBar Expanded To encode each of the following characters, specify two characters starting with the character "{": FNC1: {1 (: {( ): {) To specify binary data that cannot be represented by character strings, use the following escape sequences. String  type : Description \xnn Control code \\ Back slash (Required parameter, Object type : String) Specifies the barcode type. Constant (type)  hri : Barcode type BARCODE_UPC_A UPC-A BARCODE_UPC_E UPC-E BARCODE_EAN13 EAN13 BARCODE_JAN13 JAN13 BARCODE_EAN8 EAN8 BARCODE_JAN8 JAN8 BARCODE_CODE39 CODE39 BARCODE_ITF ITF BARCODE_CODABAR CODABAR BARCODE_CODE93 CODE93 BARCODE_CODE128 CODE128 BARCODE_GS1_128 GS1-128 BARCODE_GS1_DATABAR_OMNIDIRECTIONAL GS1 DataBar Omnidirectional BARCODE_GS1_DATABAR_TRUNCATED GS1 DataBar Truncated BARCODE_GS1_DATABAR_LIMITED GS1 DataBar Limited BARCODE_GS1_DATABAR_EXPANDED GS1 DataBar Expanded 4 (Optional parameter, Object type : String) Specifies the HRI position. Constant (hri) Description HRI_NONE (default) HRI not printed HRI_ABOVE Above the barcode HRI_BELOW Below the barcode HRI_BOTH Both above and below the barcode 99  font : (Optional parameter, Object type : String) Specifies the HRI font. Constant (font) Language FONT_A(default) Font A FONT_B Font B FONT_C Font C FONT_D Font D FONT_E Font E  width : (Optional parameter, Object type : Number) Specifies the width of each module in dots. Specifies an integer from 2 to 6.  height : (Optional parameter, Object type : Number) Specifies the barcode height in dots. Specifies an integer from 1 to 255. Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid 100 Object type Error Chapter 4 API Reference addSymbol method Adds 2D-Code printing to the command buffer. In page mode, a 2D-Code is laid out in the current print position with the reference point being its bottom left dot. Syntax addSymbol(data, type, level, width, height, size); Parameter  data : (Required parameter, Object type : String) Specifies 2D-Code data as a character string. Specify a string that follows the 2D-Code standard specified by the type parameter. If the specified string does not conform to the standard, a 2D-Code will not be printed. 2D-Code type Description Standard PDF417 Convert the character string to the string in UTF8, apply the escape sequence, and then encode the string. Truncated PDF417 The data area can contain up to 928 code words in a maximum of 90 rows, each of which can contain up to 30 code words. QR Code Model 1 Convert the character string to the string in ShiftJIS, apply the escape sequence, and then encode the string based on the data type as shown below. QR Code Model 2 Number: Micro QR Code 0 to 9 Alphanumeric character: 0 to 9, A to Z, space, $, %, *, +, -, ., /, : Kanji character: Shift-JIS value 8-bit, byte data: 0x00 to 0xff 101 4 2D-Code type MaxiCode Mode 2 MaxiCode Mode 3 MaxiCode Mode 4 MaxiCode Mode 5 Description Convert the character string to the string in UTF8, apply the escape sequence, and then encode the string. In Modes 2 and 3, when the first piece of data is [)>\ x1e01\x1dyy (where yy is a two-digit number), this is processed as the message header, and the subsequent data is processed as the primary message. In other cases, from the first piece of data, data is processed as the primary message. In Mode 2, specify the primary message in the following format: MaxiCode Mode 6 Postal code (1- to 9-digit number) GS:(\x1d) ISO country code (1- to 3-digit number) GS:(\x1d) Service class code (1- to 3-digit number) In Mode 3, specify the primary message in the following format: Postal code (1 to 6 pieces of data convertible by Code Set A) GS:(\x1d) ISO country code (1to 3-digit number) GS:(\x1d) Service class code (1- to 3-digit number) GS1 DataBar Stacked GS1 DataBar Stacked  Omnidirectional Convert the character string to the string in UTF8, apply the escape sequence, and then encode the string. Specify a 13-digit global trade item number (GTIN) not including an application identifier (AI) or a check digit. Convert the character string to the string in UTF8, apply the escape sequence, and then encode the string. You can enclose an application identifier (AI) in parentheses. The parentheses are used as HRI print characters and are not encoded as data. GS1 DataBar Expanded Stacked To encode each of the following characters, specify two characters starting with the character "{": FNC1: {1 (: {( ): {) Aztec Code After converting the character string to UTF-8, conduct the escape sequence and encode. DataMatrix After converting the character string to UTF-8, conduct the escape sequence and encode. To specify binary data that cannot be represented by character strings, use the following escape sequences. String 102 Description \xnn Control code \\ Back slash Chapter 4  type : API Reference (Required parameter, Object type : String) Specifies the 2D-Code type. Constant (type) 2D-Code type SYMBOL_PDF417_STANDARD Standard PDF417 SYMBOL_PDF417_TRUNCATED Truncated PDF417 SYMBOL_QRCODE_MODEL_1 QR Code Model 1 SYMBOL_QRCODE_MODEL_2 QR Code Model 2 SYMBOL_QRCODE_MICRO *2 Micro QR Code SYMBOL_MAXICODE_MODE_2 MaxiCode Mode 2 SYMBOL_MAXICODE_MODE_3 MaxiCode Mode 3 SYMBOL_MAXICODE_MODE_4 MaxiCode Mode 4 SYMBOL_MAXICODE_MODE_5 MaxiCode Mode 5 SYMBOL_MAXICODE_MODE_6 MaxiCode Mode 6 SYMBOL_GS1_DATABAR_STACKED GS1 DataBar Stacked SYMBOL_GS1_DATABAR_STACKED_ OMNIDIRECTIONAL GS1 DataBar Stacked  Omnidirectional SYMBOL_GS1_DATABAR_EXPANDED_STACKED GS1 DataBar Expanded Stacked SYMBOL_AZTECCODE_FULLRANGE *1 Aztec Code Full-Range mode SYMBOL_AZTECCODE_COMPACT *1 Aztec Code Compact mode SYMBOL_DATAMATRIX_SQUARE *1 DataMatrix ECC200 square SYMBOL_DATAMATRIX_RECTANGLE_8 *1 DataMatrix ECC200 rectangle, 8 lines SYMBOL_DATAMATRIX_RECTANGLE_12 *1 DataMatrix ECC200 rectangle, 12 lines SYMBOL_DATAMATRIX_RECTANGLE_16 *1 DataMatrix ECC200 rectangle, 16 lines *1 ePOS-Device Service Ver. 2.2 or later versions supported *2 ePOS-Device Service Ver. 2.6 or later versions supported 4 103  level : (Optional parameter, Object type : String) Specifies the error correction level. Constant (level) LEVEL_0 PDF417 error correction level 0 LEVEL_1 PDF417 error correction level 1 LEVEL_2 PDF417 error correction level 2 LEVEL_3 PDF417 error correction level 3 LEVEL_4 PDF417 error correction level 4 LEVEL_5 PDF417 error correction level 5 LEVEL_6 PDF417 error correction level 6 LEVEL_7 PDF417 error correction level 7 LEVEL_8 PDF417 error correction level 8 LEVEL_L QR Code error correction level L LEVEL_M QR Code error correction level M LEVEL_Q QR Code error correction level Q LEVEL_H Integer from 5 to 95 QR Code error correction level H * LEVEL_DEFAULT * Description Aztec Code error correction level (Default: 23) Default level ePOS-Device Service Ver. 2.2 or later versions supported • Select the level according to the 2D-Code type. • For MaxiCode and two-dimensional GS1 DataBar, select LEVEL_DEFAULT. • Micro QR Code does not support LEVEL_H.  width : (Optional parameter, Object type : Number) Specifies the module width. Specifies an integer from 0 to 255. 2D-Code type  height : Valid value range PDF417 2 to 8 3 QR Code 3 to 16 3 MaxiCode Ignored 2D GS1 Databar 2 to 8 2 Aztec Code 2 to 16 3 DataMatrix 2 to 16 3 (Optional parameter, Object type : Number) Specifies the module height. Specifies an integer from 0 to 255. 2D-Code type PDF417 Valid value range 2 to 8 (Magnification for width) QR Code MaxiCode 2D GS1 Databar Aztec Code DataMatrix 104 Default value Ignored Default value 3 Chapter 4  size : API Reference (Optional parameter, Object type : Number) Specifies the 2D-Code maximum size. Specifies an integer from 0 to 65535. 2D-Code type PDF417 Default value 0 (Auto) QR Code Description Specifies the number of code words for each row Ignored MaxiCode 2D GS1 Databar 0 (Auto) Specifies the maximum width for the barcode (106 or above) Aztec Code Ignored DataMatrix Ignored (Others) Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid Object type Error 4 105 addHLine method Adds horizontal line printing to the command buffer. Draws horizontal lines. Not available in page mode. Syntax addHLine(x1, x2, style); Parameter  x1: (Required parameter, Object type : Number) Specifies the start position of the horizontal line (in dots). Specifies an integer from 0 to 65535.  x2 : (Required parameter, Object type : Number) Specifies the end position of the horizontal line (in dots). Specifies an integer from 0 to 65535.  style : (Optional parameter, Object type : String) Specifies the line type. Constant (style) Description LINE_THIN Solid line: Thin LINE_MEDIUM Solid line: Medium LINE_THICK Solid line: Thick LINE_THIN_DOUBLE Double line: Thin LINE_MEDIUM_DOUBLE Double line: Medium LINE_THICK_DOUBLE Double line: Thick undefined (When not specified) Solid line: Thin Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid 106 Object type Error Chapter 4 API Reference addVLineBegin method Adds the beginning of vertical line to the command buffer. Starts to draw vertical lines. Not available in page mode. Vertical lines are drawn until their end is specified by addVLineEnd (p. 108). Use this API function with addVLineEnd. Syntax addVLineBegin(x, style); Parameter  x: (Required parameter, Object type : Number) Specifies the start position of the vertical line (in dots). Specifies an integer from 0 to 65535.  style : (Optional parameter, Object type : String) Specifies the line type. Constant (style) Description LINE_THIN Solid line: Thin LINE_MEDIUM Solid line: Medium LINE_THICK Solid line: Thick LINE_THIN_DOUBLE Double line: Thin LINE_MEDIUM_DOUBLE Double line: Medium LINE_THICK_DOUBLE Double line: Thick undefined (When not specified) Solid line: Thin 4 Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid Object type Error 107 addVLineEnd method Adds the end of vertical line to the command buffer. Finishes drawing vertical lines. Not available in page mode. Use this API function with addVLineBegin (p. 107). Syntax addVLineEnd(x, style); Parameter  x: (Required parameter, Object type : Number) Specifies the end position of the vertical line (in dots). Specifies an integer from 0 to 65535.  style : (Optional parameter, Object type : String) Specifies the type of the line you want to finish drawing. Constant (style) Description LINE_THIN Solid line: Thin LINE_MEDIUM Solid line: Medium LINE_THICK Solid line: Thick LINE_THIN_DOUBLE Double line: Thin LINE_MEDIUM_DOUBLE Double line: Medium LINE_THICK_DOUBLE Double line: Thick undefined (When not specified) Solid line: Thin Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid 108 Object type Error Chapter 4 API Reference addPageBegin method Adds the switching to page mode to the command buffer. The page mode process starts. If using addImage or addLogo in page mode, printing in multiple tones is not supported. Vertical lines are processed in page mode until their end is specified by addPageEnd (p. 109). Use this API function with addPageEnd. Syntax addPageBegin(); Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter addPageEnd method Adds the end of page mode to the command buffer. The page mode process ends. 4 Use this API function with addPageBegin (p. 109). Syntax addPageEnd(); Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter 109 addPageArea method Adds the print area in page mode to the command buffer. Specifies the print area in page mode (coordinates). After this API function, specify a print data API function such as the addText method. Specify a print area to cover the content to be printed. If the print data extends beyond the print area, the print result will be such that the print data has been printed incompletely. Use this API function by inserting it between addPageBegin (p. 109) and addPageEnd (p. 109). Syntax addPageArea(x, y, width, height); Parameter  x: (Required parameter, Object type : Number) Specifies the origin of the horizontal axis (in dots). Specifies an integer from 0 to 65535. 0 is the left end of the printer's printable area.  y: (Required parameter, Object type : Number) Specifies the origin of the vertical axis (in dots). Specifies an integer from 0 to 65535. 0 is the position in which no paper feed has been performed.  width : (Required parameter, Object type : Number) Specifies the width of the print area (in dots). Specifies an integer from 0 to 65535.  height : (Required parameter, Object type : Number) Specifies the height of the print area (in dots). Specifies an integer from 0 to 65535. Determine the width and height of the print area according to the print direction setting. Otherwise, the print data might not be printed completely. Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid 110 Object type Error Chapter 4 API Reference addPageDirection method Adds the page mode print direction setting to the command buffer. Specifies the print direction in page mode. This function can be omitted if rotation is not required. Use this API function by inserting it between addPageBegin (p. 109) and addPageEnd (p. 109). Syntax addPageDirection(dir); Parameter  dir : (Required parameter, Object type : String) Specifies the print direction in page mode. Constant (dir) Description Left to right DIRECTION_LEFT_TO_RIGHT(default) (No rotation.Data is printed from the top left corner to the right.) Bottom to top DIRECTION_BOTTOM_TO_TOP (Counterclockwise rotation by 90 degrees. Data is printed from the bottom left corner to the top.) Right to left DIRECTION_RIGHT_TO_LEFT (Rotation by 180 degrees.Data is printed from the bottom right corner to the left.) 4 Top to bottom DIRECTION_TOP_TO_BOTTOM (Clockwise rotation by 90 degrees. Data is printed from the top right corner to the bottom.) Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid Object type Error 111 addPagePosition method Adds the page mode print-position-set area to the command buffer. Specifies the print start position (coordinates) in the area specified by the addPageArea method. Use this API function by inserting it between addPageBegin (p. 109) and addPageEnd (p. 109). Syntax addPagePosition(x, y); Parameter  x: (Required parameter, Object type : Number) Specifies the horizontal print position (in dots). Specifies an integer from 0 to 65535.  y: (Required parameter, Object type : Number) Specifies the vertical print position (in dots). Specifies an integer from 0 to 65535. Specify the print start position (coordinates) according to the content to be printed. Refer to the following.  To print a character string:  Specify the left end of the baseline for the first character. This can be omitted for left-aligned printing of standard-sized characters. To print double-sized height characters, specify a value equal to or greater than 42 for y.  To print a barcode:  Specify the bottom left of the symbol. And specify the barcode height for y.  To print a graphic/logo:  Specify the bottom left of the graphic data. And specify the graphic data height for y.  To print a 2D-Code:  Specify the top left of the symbol. This can be omitted when printing from the top left. Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid 112 Object type Error Chapter 4 API Reference addPageLine method Adds line drawing in page mode to the command buffer. Draws a line in page mode. Diagonal lines cannot be drawn. Use this API function by inserting it between addPageBegin (p. 109) and addPageEnd (p. 109). Syntax addPageLine(x1, y1, x2, y2, style); Parameter  x1: (Required parameter, Object type : Number) Specifies the horizontal start position of the line (in dots). Specifies an integer from 0 to 65535.  y1: (Required parameter, Object type : Number) Specifies the vertical start position of the line (in dots). Specifies an integer from 0 to 65535.  x2 : (Required parameter, Object type : Number) Specifies the horizontal end position of the line (in dots). Specifies an integer from 0 to 65535.  y2 : (Required parameter, Object type : Number) Specifies the vertical end position of the line (in dots). Specifies an integer from 0 to 65535.  style : (Optional parameter, Object type : String) Specifies the line type. Constant (style) Description LINE_THIN Solid line: Thin LINE_MEDIUM Solid line: Medium LINE_THICK Solid line: Thick LINE_THIN_DOUBLE Double line: Thin LINE_MEDIUM_DOUBLE Double line: Medium LINE_THICK_DOUBLE Double line: Thick undefined (When not specified) Solid line: Thin Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid Object type Error 113 4 addPageRectangle method Adds rectangle drawing in page mode to the command buffer. Draws a rectangle in page mode. Use this API function by inserting it between addPageBegin (p. 109) and addPageEnd (p. 109). Syntax addPageRectangle(x1, y1, x2, y2, style); Parameter  x1: (Required parameter, Object type : Number) Specifies the horizontal start position of the line (in dots). Specifies an integer from 0 to 65535.  y1: (Required parameter, Object type : Number) Specifies the vertical start position of the line (in dots). Specifies an integer from 0 to 65535.  x2 : (Required parameter, Object type : Number) Specifies the horizontal end position of the line (in dots). Specifies an integer from 0 to 65535.  y2 : (Required parameter, Object type : Number) Specifies the vertical end position of the line (in dots). Specifies an integer from 0 to 65535.  style : (Optional parameter, Object type : String) Specifies the line type. Constant (style) Description LINE_THIN Solid line: Thin LINE_MEDIUM Solid line: Medium LINE_THICK Solid line: Thick LINE_THIN_DOUBLE Double line: Thin LINE_MEDIUM_DOUBLE Double line: Medium LINE_THICK_DOUBLE Double line: Thick undefined (When not specified) Solid line: Thin Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid 114 Object type Error Chapter 4 API Reference addCut method Adds paper cut to the command buffer. Sets paper cut. Not available in page mode. Syntax addCut(type); Parameter  type : (Optional parameter, Object type : String) Specifies the paper cut type. Setting Description Cut without feeding CUT_NO_FEED (The paper is cut without being fed.) Feed cut CUT_FEED (The paper is fed to the cut position and then is cut.) Cut reservation CUT_RESERVE (Printing continues until the cut position is reached, at which the paper is cut.) undefined Feed cut (When not specified) (The paper is fed to the cut position and then is cut.) 4 Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid Object type Error 115 addPulse method Adds the drawer kick to the command buffer. Sets the drawer kick. • Not available in page mode. • The drawer and the buzzer cannot be used together. Syntax addPulse(drawer, time); Parameter  drawer : (Optional parameter, Object type : String) Specifies the drawer kick connector. Setting DRAWER_1 Pin 2 of the drawer kick-out connector DRAWER_2 Pin 5 of the drawer kick-out connector undefined (When not specified)  time : Description Pin 2 of the drawer kick-out connector ( Optional parameter, Object type : String) Specifies the ON time of the drawer kick signal. Setting Description PULSE_100 100 ms PULSE_200 200 ms PULSE_300 300 ms PULSE_400 400 ms PULSE_500 500 ms undefined (When not specified) 100 ms Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid 116 Object type Error Chapter 4 API Reference addSound method Adds the turning on of the buzzer to the command buffer. Sets the buzzer. • Not available in page mode. • The buzzer function and the drawer cannot be used together. • This API function cannot be used if the printer is not provided with the buzzer. Syntax addSound(pattern, repeat, cycle); Parameter  pattern : (Optional parameter, Object type : String) Specifies the buzzer pattern. Setting PATTERN_NONE Stop PATTERN_A Pattern A PATTERN_B Pattern B PATTERN_C Pattern C PATTERN_D Pattern D PATTERN_E Pattern E PATTERN_ERROR Error sound pattern PATTERN_PAPER_END Pattern when there is no paper PATERN_1 * Pattern 1 PATERN_2 * Pattern 2 PATERN_3 * Pattern 3 PATERN_4 * Pattern 4 PATERN_5 * Pattern 5 PATERN_6 * Pattern 6 PATERN_7 * Pattern 7 PATERN_8 * Pattern 8 PATERN_9 * Pattern 9 PATERN_10 * Pattern 10 undefined (When not specified) Pattern A *  repeat : Description 4 ePOS-Device Service Ver. 2.2 or later versions supported (Optional parameter, Object type : String) Specifies the number of repeats. Setting Description 0 The buzzer does not stop. 1 to 255 Number of repeats undefined (When not specified) One time After “0” is specified for repeat, if you want to stop the buzzer, execute this API function and specify PATTERN_NONE for pattern. 117  cycle : (Optional parameter, Object type : String, When not specified : 1000) Specifies the buzzer sounding cycle (in units of milliseconds) Setting Description 1000 to 25500 1000 to 25500 milliseconds undefined 1000 milliseconds PATTERN_A to PATTERN_E/PATTERN_ERROR/PATTERN_PAPER_END is disregarded. Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid 118 Object type Error Chapter 4 API Reference addLayout method Adds paper layout information to the command buffer. Setting of page layout must be done in the standard mode. In the page mode, addLayout cannot be specified. Syntax addLayout(type, width, height, margin_top,  margin_bottom, offset_cut, offset_label); Parameter  type : ( Required parameter, Object type : String) Specifies the paper type. Constant (type) Description LAYOUT_RECEIPT Receipt (without black mark) LAYOUT_RECEIPT_BM Receipt (with black mark) LAYOUT_LABEL Die-cut label (without black mark) LAYOUT_LABEL_BM Die-cut label (with black mark)  width : (Optional parameter, Object type : Number, When not specified : 580) Specifies paper width (in units of 0.1 mm). Specifies an integer from 290 to 600.  height : (Optional parameter, Object type : Number, When not specified : 0) Specifies paper height (in units of 0.1 mm). Paper Type Receipt  (without black mark) Valid value range 0 0 (Auto) 284 to 1550 (Manual) Distance from the top of label to the top of next label Distance from the bottom of black mark to the bottom of next black mark. Die-cut label (with black mark)  margin_top : Setup not necessary Distance from the top of black mark to the top of next black mark Receipt (with black mark) Die-cut label  (without black mark) 4 Description (Optional parameter, Object type : Number, When not specified : 0) Specifies top margin (in units of 0.1 mm). Paper Type Valid value range Description Receipt  (without black mark) 0 Setup not necessary Receipt (with black mark) -150 to 1500 Distance from the top of black mark Die-cut label  (without black mark) 0 to 1500 Distance from the top of label Die-cut label (with black mark) -15 to 1500 Distance from the bottom of black mark 119  margin_bottom :(Optional parameter, Object type : Number, When not specified : 0) Specifies bottom margin (in units of 0.1 mm). Paper Type 0 Receipt (with black mark) 0 Die-cut label  (without black mark) -15 to 0 Distance from the bottom of label (paper feed direction is a positive number) -15 to 15 Distance from the top of black mark (paper feed direction is a positive number) Valid value range Description Receipt  (without black mark) 0 Setup not necessary Receipt (with black mark) -290 to 50 Distance from the top of black mark to the cutting position Die-cut label  (without black mark) 0 to 50 Distance from the bottom of label to the cutting position 0 to 50 Distance from the top of black mark to the cutting position Die-cut label (with black mark) (Optional parameter, Object type : Number, When not specified : 0) Specifies label bottom position (sd) per 0.1 mm unit. Paper Type 120 Setup not necessary (Optional parameter, Object type : Number, When not specified : 0) Specifies cut position (in units of 0.1 mm). In case of die cut label paper, it is a distance from the bottom of label. When a paper has black mark, it is a distance from the beginning of black mark. Paper Type  offset_label : Description Receipt  (without black mark) Die-cut label (with black mark)  offset_cut : Valid value range Valid value range Receipt  (without black mark) 0 Receipt (with black mark) 0 Die-cut label  (without black mark) 0 Die-cut label (with black mark) 0 to 15 Description Setup not necessary Distance from the top of black mark to the bottom of label Chapter 4 API Reference Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Object type Parameter " ... " is invalid Error Detailed description See below for the parameters that can be specified for each type of paper, and the positions for those parameters. Mark Parameter sf width sa height sb margin_top se margin_bottom sc offset_cut sd offset_label sf sf sb sc Top position 4 Cut Receipt sa sc sf sf Cut sb Top position Top position Label Cut sb Bottom edge of print area se sa sc Bottom edge of print area Standard eject Bottom edge of label sa se sd sc 121 addRecovery method Adds the recovery from errors to the command buffer. (in ePOS-Device Service Ver.2.2 and later) This method is executed when a error that can be automatically recovered from occurs. • If this API is included in a print command, other print commands included in the print document are not executed. • We recommend using the recover method (p.127) for this function. Syntax addRecovery(); Return value Return value Printer Object Object type Printer Exception Exception Parameter " ... " is invalid Object type Error addReset method Adds the printer reset to the command buffer. (in ePOS-Device Service Ver.2.2 and later) • Other printing commands in the print document are ignored. • We recommend using the reset method (p.127) for this function. Syntax addReset(); Return value Return value Printer Object Object type Printer Exception Exception Parameter " ... " is invalid 122 Object type Error Chapter 4 API Reference addCommand method Adds commands to the command buffer. Sends ESC/POS commands. For information about ESC/POS commands, see the ESC/POS Command Reference.  You can view the ESC/POS Command Reference from https://reference.epson-biz.com/. Syntax addCommand(data); Parameter  data : (Optional parameter, Object type : String) Specifies ESC/POS command as a character string. Return value Return value Object type Printer Object Printer HybridPrinter Object HybridPrinter Exception Exception Parameter " ... " is invalid Object type Error 4 123 send method Sends an command buffer. With this API, if print commands are sent successively to the same printer, printing may time out at the point where the printer's simultaneously connectable number is reached. If this happens, you are recommended to check the print results using an onreceive event (p.130), then send the next print command. Execution of this API results in the value of the force property (p.128) as "false". Syntax ❏ send(); ❏ For acquiring the job ID send(printjobid); The syntax used to specify job IDs is only compatible with ePOS-Device Service Ver.2.6 or later. For details, refer to Specifying the Print Job ID from the Application (p.19). Parameter  printjobid : (Optional parameter, Object type : String) Specify the print job ID. (ePOS-Device Service Ver. 2.6 or later versions) 1 to 30 alphanumeric characters, including underscores, hyphens and periods, may be used. Programming Example var printjobid = 'ABC123'; printer.addText('Hello, World!\n'); printer.addCut(); printer.onreceive = function (res) { alert(res.printjobid); }; printer.onerror = function (err) { alert(err.status); }; printer.send(printjobid); 124 Chapter 4 API Reference print method Prints an image rendered in HTML5 Canvas. Converts the specified range in a RGBA full-color image of HTML5 Canvas into raster image data according to the settings of the halftone and brightness properties. One pixel in an image equals to one printer dot. When an image contains any transparent color, the background color of the image is assumed to be white. • If an HTML5 Canvas image contains images downloaded from different domains, you cannot print the image. In this case, a security error occurs due to violation of the same origin policy of JavaScript.  With this API, if print commands are sent successively to the same printer, printing may time out at the point where the printer's simultaneously connectable number is reached. If this happens, you are recommended to check the print results using an onreceive event (p.130), then send the next print command. Syntax ❏ print(canvas, cut, mode); ❏ For acquiring the job ID print(canvas, cut, mode, printjobid); The syntax used to specify job IDs is only compatible with ePOS-Device Service Ver.2.6 or later. For details, refer to Specifying the Print Job ID from the Application (p.19). Parameter  canvas : 4 (Required parameter, Object type : canvas) Specify the HTML5 Canvas object to be printed.  cut : (Optional parameter, Object type : Boolean) Sets whether to cut paper. Setting  mode : Description true or 1 Cuts the paper after printing false or 0 Does not cut the paper after printing undefined Does not cut the paper after printing (Optional parameter, Object type : String) Specifies the color mode. Setting Description MODE_MONO Monochrome (two-tone) MODE_GRAY16 Multiple tones (16-tone) undefined Monochrome (two-tone) 125  printjobid : (Optional parameter, Object type : String) Specify the print job ID. (ePOS-Device Service Ver. 2.6 or later versions) 1 to 30 alphanumeric characters, including underscores, hyphens and periods, may be used. Exception Exception 126 Object type Parameter " ... " is invalid Error XMLHttpRequest is not supported Error Canvas is not supported Error Chapter 4 API Reference getPrintJobStatus method Acquires print job status. (ePOS-Device Service Ver.2.6 or later versions) • The results of executing this API will be returned to an onreceive event (p.130). • The latest print job status will be obtained when executing multiple printing processes with the same job ID. Syntax getPrintJobStatus(printjobid); Parameter  printjobid : (Required parameter, Object type : String) Specifies the print job ID to be verified. startMonitor method Enables a status event. Syntax startMonitor(); stopMonitor method 4 Disables a status event. Syntax stopMonitor(); recover method The printer recovers from the error status. This method is executed when a error that can be automatically recovered from occurs. Syntax recover(); reset method Resets the printer. Syntax reset(); 127 halftone property Halftone processing method. Object type String Description The halftone processing method to be applied to monochrome (two-tone) printing is specified. The default value is HALFTONE_DITHER. Constant Description HALFTONE_DITHER (default) Dithering, suitable for printing graphics only. HALFTONE_ERROR_DIFFUSION Error diffusion, suitable for printing text and graphics together. HALFTONE_THRESHOLD Threshold, suitable for printing text only. brightness property Brightness correction value. Object type Number Description A gamma value in the range 0.1-10.0 is specified for the brightness correction value. The default value is 1.0. force property This is the forced transmission mode. (in ePOS-Device Service Ver.2.2 and later) Object type Boolean Description If you enable forced transmission mode, print commands are forcibly sent to the printer. • Use forced transmission mode when the printer is offline. It will result in an error if the printer is online. • The following functions are enabled in forced transmission mode.  Drawer kick-out (addPulse method (p.116))  Stopping the buzzer (addSound method (p.117))  Recovery from errors that can be recovered from (addRecovery method (p.122))  Reset (addReset method (p.122))  Sending commands in real time (addCommand method (p.123)) 128 Chapter 4 API Reference timeout property Specifies the timeout time (ms) of the message sent with the "send" method (p.124). The default value is 10,000. Object type  Number interval property Specifies the interval of upgrading the status. Object type Number Description The interval of upgrading the status is specified in milliseconds. Default value: 3000 (three seconds) Minimum value: 1000 (one second or longer) When an invalid value is specified, it is assumed to be 3000. 4 129 onreceive event This property registers the callback function and obtains a response message receipt event. Syntax Function(response) Parameter of the callback function Parameters: response (See "Properties of the response object" on page 130.) Name: Response message Object type: Object Properties of the response object Property Name Object type success (p. 130) Print result Boolean code (p. 130) Error code String status (p. 131) Status Number battery (p. 131) Battery status Number printjobid (p. 131) * Print job ID String * ePOS-Device Service Ver. 2.6 or later versions supported  Value of success Value Description  Printing succeeded true or 1  Processing succeeded (When the spooler function is enabled)  Printing Failed false or 0  Processing Failed (When the spooler function is enabled)  Value of code Value 'EPTR_AUTOMATICAL' An automatically recoverable error occurred 'EPTR_BATTERY_LOW' No remaining battery 'EPTR_COVER_OPEN' A cover open error occurred 'EPTR_CUTTER' An autocutter error occurred 'EPTR_MECHANICAL' A mechanical error occurred 'EPTR_REC_EMPTY' No paper in roll paper end sensor 'EPTR_UNRECOVERABLE' An unrecoverable error occurred 'SchemaError' The request document contains a syntax error 'DeviceNotFound' The printer with the specified device ID does not exist 'PrintSystemError' An error occurred on the printing system 'EX_BADPORT' An error was detected on the communication port 'EX_TIMEOUT' A print timeout occurred 'EX_SPOOLER' * Stops the spooler 'JobNotFound' * Print job not found 'Printing' * Print job now printing * 130 Description ePOS-Device Service Ver. 2.6 or later versions supported Chapter 4 API Reference  Value of status Constant (status) Description ASB_NO_RESPONSE No response from the TM printer ASB_PRINT_SUCCESS Printing is successfully completed ASB_DRAWER_KICK Status of the 3rd pin of the drawer kick-out connector = "H" ASB_BATTERY_OFFLINE Battery offline status ASB_OFF_LINE Offline ASB_COVER_OPEN The cover is open ASB_PAPER_FEED Paper is being fed by a paper feed switch operation ASB_WAIT_ON_LINE Waiting to be brought back online ASB_PANEL_SWITCH The paper feed switch is being pressed (ON) ASB_MECHANICAL_ERR A mechanical error occurred ASB_AUTOCUTTER_ERR An autocutter error occurred ASB_UNRECOVER_ERR An unrecoverable error occurred ASB_AUTORECOVER_ERR An automatically recoverable error occurred ASB_RECEIPT_NEAR_END No paper in roll paper near end sensor ASB_RECEIPT_END No paper in roll paper end sensor ASB_BUZZER A buzzer is on (only for applicable devices) ASB_SPOOLER_IS_STOPPED * The spooler has stopped * ePOS-Device Service Ver. 2.6 or later versions supported  Value of battery Status of power Value (battery) 4 Description 0x30XX The AC adapter is connected 0x31XX The AC adapter is connected Remaining battery Value (battery) 0xXX36 Description Battery amount 6 0xXX35 Battery amount 5 0xXX34 Battery amount 4 0xXX33 Battery amount 3 0xXX32 Battery amount 2 0xXX31 Battery amount 1 (Near end) 0xXX30 Battery amount 0 (Real end) 0 is shown when the model doesn't have a battery installed.  Value of printjobid Value '…' Description Print job ID (An empty string denotes that a print job ID has not been set) 131 onstatuschange event Registers a callback function to obtain a status change event. Syntax Function(status) Parameter of the callback function Parameters: status Name: Status Object type: Number onbatterystatuschange event Registers call back function and obtains battery status change event. (in ePOS-Device Service Ver.2.2 and later) Object type Function (battery) Parameter of the callback function Parameters: battery Name: Batterystatus Object type: Number ononline event Registers a callback function to obtain a online event. Object type Function () onoffline event Registers a callback function to obtain a offline event. Object type Function () onpoweroff event Registers a callback function to obtain a non-response event. Object type Function () 132 Chapter 4 API Reference oncoverok event Registers a callback function to obtain a cover close event. Object type Function () oncoveropen event Registers a callback function to obtain a cover open event. Object type Function () onpaperok event Registers a callback function to obtain a paper remaining event. For a hybrid printer, the receipt printer's status is acquired. Object type Function () 4 onpapernearend event Registers a callback function to obtain a paper near end event. For a hybrid printer, the receipt printer's status is acquired. Object type Function () onpaperend event Registers a callback function to obtain a paper end event. For a hybrid printer, the receipt printer's status is acquired. Object type Function () 133 ondrawerclosed event Registers a callback function to obtain a drawer close event. Object type Function () ondraweropen event Registers a callback function to obtain a drawer open event. Object type Function () onbatteryok event Registers call back function and obtains remaining battery event. (in ePOS-Device Service Ver.2.2 and later) Object type Function () onbatterylow event Registers call back function and obtains no remaining battery event. (in ePOS-Device Service Ver.2.2 and later) Object type Function () 134 Chapter 4 API Reference HybridPrinter Object Cannot be used with TM-i Series. API for creating print documents Callback method The callback method for the API for creating print documents varies based on the printing method. Specify the printer object before the API. Printing method Printer object Example of use Receipt printing ReceiptPrinter ReceiptPrinter.addText(data); Slip printing SlipPrinter SlipPrinter.addText(data); EndorsePrinter EndorsePrinter.addText(data);  Endorse printing  Endorse printing (40 cpl mode) Supported API The supported API for creating print documents vary based on the printing method. *Only in standard mode Description Receipt printing Slip printing Endorse printing Endorse printing 40 cpl mode Element Page addTextAlign Adds the text alignment settings to the command buffer. ✔ ✔ ✔ - 77 addTextLineSpace Adds the line feed space settings to the command buffer. ✔ ✔ ✔ - 78 addTextRotate Adds the text rotation print settings to the command buffer. ✔ ✔ ✔ ✔ 79 addText Adds text printing to the command buffer. ✔ ✔ ✔ ✔ 80 addTextLang Adds the target language settings to the command buffer. ✔ ✔ - - 81 addTextFont Adds the text font settings to the command buffer. ✔ ✔ ✔ - 83 addTextSmooth Adds the text smoothing settings to the command buffer. ✔ - - - 84 addTextDouble Adds the double-sized text settings to the command buffer. ✔ ✔ ✔ - 85 addTextSize Adds the text scale settings to the command buffer. ✔ ✔ ✔ - 86 API Method Text 135 4 *Only in standard mode Description Receipt printing Slip printing Endorse printing Endorse printing 40 cpl mode Element Page addTextStyle Adds the text style settings to the command buffer. ✔ ✔ ✔ - 87 addTextPosition Adds the print position settings to the command buffer. ✔ ✔ ✔ ✔ 89 addTextVPosition Adds a tag for specifying the print vertical position of text. ✔ ✔ - - 90 addFeedUnit Adds a tag for paper feeding (in dots). ✔ ✔ ✔ ✔ 91 addFeedLine Adds a tag for paper feeding (in lines). ✔ ✔ ✔ - 92 addFeedPosition Adds control of label paper/ black mark paper to command buffer - - - - 93 addFeed Adds a line feed to the command buffer. ✔ ✔ ✔ ✔ 93 addImage Adds raster image printing to the command buffer. ✔ - - - 94 addLogo Adds NV logo printing to the command buffer. ✔ ✔ - - 96 addBarcode Adds barcode printing to the command buffer. ✔ ✔* - - 97 addSymbol Adds 2D-Code printing to the command buffer. ✔ - - - 101 addHLine Adds horizontal line printing to the command buffer. - - - - 106 addVLineBegin Adds vertical line start to the command buffer. - - - - 107 addVLineEnd Adds vertical line end to the command buffer. - - - - 108 addPageBegin Adds page mode start to the command buffer. ✔ ✔ - - 109 addPageEnd Adds page mode end to the command buffer. ✔ ✔ - - 109 addPageArea Adds the print area settings in the page mode to the command buffer. ✔ ✔ - - 110 addPageDirection Adds the print direction settings in the page mode to the command buffer. ✔ ✔ - - 111 addPagePosition Adds the print position settings in the page mode to the command buffer. ✔ ✔ - - 112 API Method Text Paper Feed Graphic Barcode Ruled Line Page Mode 136 Chapter 4 API Reference *Only in standard mode Description Receipt printing Slip printing Endorse printing Endorse printing 40 cpl mode Element Page addPageLine Adds drawing a line in the page mode to the command buffer. - - - - 113 addPageRectangle Adds drawing a rectangle in the page mode to the command buffer. - - - - 114 Cut addCut Adds paper cut to the command buffer. ✔ - - - 115 Drawer addPulse Adds drawer kick-out to the command buffer. ✔ ✔ ✔ ✔ 116 Buzzer addSound Adds turning on the buzzer to the command buffer. - - - - 117 Layout addLayout Adds the paper layout setup to command buffer - - - - 119 Send Command addCommand Adds a command to the command buffer. ✔ ✔ ✔ ✔ 123 API Method Page Mode Constant FONT_* Font ALIGN_* Alignment COLOR_* Color specification HALFTONE_* Halftone type MODE_* Color mode BARCODE_* Barcode type HRI_* HRI position SYMBOL_* 2D-Code type LEVEL_* Error correction level LINE_* Line style DIRECTION_* Page mode print direction CUT_* Paper cut type DRAWER_* Drawer kick-out connector PLUSE_* Drawer kick-out pulse length PATTERN_* Buzzer sound pattern FEED_* Paper feed LAYOUT_* Type of papers 4 137 lock method Locks the device port. Execute when performing MICR reading or you want to lock the device. If you locked a port with this API, be sure to execute the unlock method (p.138) before closing the application. If you close the application without executing the unlock, the next port cannot be locked for about five minutes until the ePOS-Device Service I/F unlocks the port. The onreceive event (p.146) returns "ERROR_DEVICE_BUSY". Syntax lock(); unlock method Unlocks the device port. Syntax unlock(); ReceiptPrinter.send method Sends the command buffer and prints the receipt. Syntax ReceiptPrinter.send(); 138 Chapter 4 API Reference ReceiptPrinter.print method Prints an image rendered in HTML5 Canvas. Converts the specified range in a RGBA full-color image of HTML5 Canvas into raster image data according to the settings of the halftone and brightness properties. One pixel in an image equals to one printer dot. When an image contains any transparent color, the background color of the image is assumed to be white. If an HTML5 Canvas image contains images downloaded from different domains, you cannot print the image. In this case, a security error occurs due to violation of the same origin policy of JavaScript. Syntax print(canvas, cut, mode); Parameter  canvas : (Required parameter, Object type : canvas) Specify the HTML5 Canvas object to be printed.  cut : (Optional parameter, Object type : Boolean) Sets whether to cut paper. Setting  mode : Description true or 1 Cuts the paper after printing false or 0 Does not cut the paper after printing undefined Does not cut the paper after printing 4 (Optional parameter, Object type : String) Specifies the color mode. Setting Description MODE_MONO Monochrome (two-tone) MODE_GRAY16 Multiple tones (16-tone) undefined Monochrome (two-tone) 139 SlipPrinter.send method Sends the command buffer and prints the slip. Syntax SlipPrinter.send(); SlipPrinter.cancel method Cancels the paper insert wait status after executing the SlipPrinter.send method. Syntax SlipPrinter.cancel(); SlipPrinter.timeout property Specifies the timeout time (ms) for the paper insert wait status after executing the SlipPrinter.send method. The default value is 10,000. Object type Number EndorsePrinter.enable40cplMode method Sets the 40 cpl mode for slip printing. Syntax EndorsePrinter.enable40cplMode(enable); Parameter  enable : Object type ( Boolean) Specifies if there is 40 cpl mode for slip printing or not. Setting 140 Description true Enables 40 cpl mode. false Disables 40 cpl mode. Chapter 4 API Reference EndorsePrinter.send method Sends the command buffer and performs endorse printing. Syntax EndorsePrinter.send(); EndorsePrinter.cancel method Cancels the paper insert wait status after executing the EndorsePrinter.send method. Syntax EndorsePrinter.cancel(); EndorsePrinter.timeout property Specifies the timeout time (ms) for the paper insert wait status after executing the EndorsePrinter.send method. The default value is 10,000. Object type Number 4 MICRReader.read method Executes MICR reading. If you set the paper after executing this method, MICR reading is performed. Syntax MICRReader.read(ignoreerror, font); Parameter  ignoreerror : Object type (Boolean) Specifies the operation to perform when unreadable characters are detected. Setting  font : Description true Replaces unreadable characters with "?" and continues processing. false Stops processing. Object type (String) Specifies the MICR font to read. Setting Description 'MICR_E13B' Reads the E13B font. 'MICR_CMC7' Reads the CMC7 font. 141 MICRReader.cancel method Cancels the paper insert wait status after executing the MICRReader.read method. Syntax MICRReader.cancel(); MICRReader.eject method Ejects the check paper. This method is executed after the MICR reading is complete. Syntax MICRReader.eject(); MICRReader.cleaning method Cleans the MICR mechanism. After executing this method, set the cleaning sheet to clean the MICR mechanism. Syntax MICRReader.cleaning(); MICRReader.timeout property Specifies the timeout time (ms) for the paper insert wait status after executing the MICRReader.cleaning method and the MICRReader.read method. The default value is 10,000. Object type Number 142 Chapter 4 API Reference startMonitor method Enables a status event. Notifies the printer's status using an event. The status is updated at the interval designated in the interval property. Syntax startMonitor(); stopMonitor method Disables a status event. Syntax stopMonitor(); interval property Specifies the interval of upgrading the status. Object type Number 4 Description The interval of upgrading the status is specified in milliseconds. Default value: 3000 (three seconds) Minimum value: 1000 (one second or longer) When an invalid value is specified, it is assumed to be 3000. recover method The printer recovers from the error status. This method is executed when a error that can be automatically recovered from occurs. Syntax recover(); reset method Resets the printer. Syntax reset(); 143 halftone property Halftone processing method. This property can only be used when printing receipts. Object type String Description The halftone processing method to be applied to monochrome (two-tone) printing is specified. The default value is HALFTONE_DITHER. Constant Description HALFTONE_DITHER (default) Dithering, suitable for printing graphics only. HALFTONE_ERROR_DIFFUSION Error diffusion, suitable for printing text and graphics together. HALFTONE_THRESHOLD Threshold, suitable for printing text only. brightness property Brightness correction value. This property can only be used when printing receipts. Object type Number Description A gamma value in the range 0.1-10.0 is specified for the brightness correction value. The default value is 1.0. 144 Chapter 4 API Reference force property This is the forced transmission mode. Object type Boolean Description If you enable forced transmission mode, print commands are forcibly sent to the printer. • Use forced transmission mode when the printer is offline. It will result in an error if the printer is online. • The following functions are enabled in forced transmission mode.  Drawer kick-out (addPulse method (p.116))  Stopping the buzzer (addSound method (p.117))  Recovery from errors that can be recovered from (recover method (p.143))  Reset (reset method (p.143))  Sending commands in real time (addCommand method (p.123)) 4 145 onreceive event Receives the execution result of the HybridPrinter object. Syntax Function(data, sq); Parameter of the callback function  data['eventtype'] :Object type (Boolean) Receives the method name that returns an event.  data['success'] :Object type (String) Receives the processing result of the method that returns an event. For details, refer to each method for the HybridPrinter object. Value Description true/1 Success false/0 Failure  data['code'] :Object type (String) Receives the execution result of the method that returns an event. Value 146 Description 'SUCCESS' Success 'EPTR_AUTOMATICAL' An automatically recoverable error occurred 'EPTR_COVER_OPEN' A cover open error occurred 'EPTR_CUTTER' An autocutter error occurred 'EPTR_MECHANICAL' A mechanical error occurred 'EPTR_REC_EMPTY' No paper in roll paper end sensor 'EPTR_UNRECOVERABLE' An unrecoverable error occurred 'SchemaError' The request document contains a syntax error 'DeviceNotFound' The printer with the specified device ID does not exist 'PrintSystemError' An error occurred on the printing system 'EX_BADPORT' An error was detected on the communication port 'EX_TIMEOUT' A print timeout occurred 'ERROR_DEVICE_NOT_FOUND' The device cannot be found 'ERROR_DEVICE_BUSY' Failed to open the port 'CANCEL' Cancels the paper insert wait status 'ERROR_TIMEOUT' Paper insert wait timeout 'ERROR_PARAMETER' Parameter error 'ERROR_NOT_SUPPORTED' The endorse printer is not equipped 'EPTR_SCHEMAERROR' There is an error in the syntax of the request document 'ERROR_COMMAND' The cancelled processing is not in the paper insert wait status 'EMICR_ILLEGAL_LENGTH' The inserted paper is not the correct length 'EMICR_NO_MICR' Did not detect MICR data 'EMICR_RECOGNITION' Detected unrecognizable MICR text Chapter 4 Value API Reference Description 'EMICR_READ' Error occurred during MICR reading 'EMICR_NOISE_DETECTED' Detected noise error 'EMICR_COVER_OPEN' Cover was opened during MICR reading 'EMICR_PAPER_JAM' Paper jam error occurred  data['status'] :Object type (String) Receives the printer status. Value Description ASB_NO_RESPONSE No response from the TM printer ASB_PRINT_SUCCESS Printing is successfully completed ASB_DRAWER_KICK Status of the 3rd pin of the drawer kick-out connector = "H" ASB_OFF_LINE Offline ASB_COVER_OPEN The cover is open ASB_PAPER_FEED Paper is being fed by a paper feed switch operation ASB_WAIT_ON_LINE Waiting to be brought back online ASB_PANEL_SWITCH The paper feed switch is being pressed (ON) ASB_MECHANICAL_ERR A mechanical error occurred ASB_AUTOCUTTER_ERR An autocutter error occurred ASB_UNRECOVER_ERR An unrecoverable error occurred ASB_AUTORECOVER_ERR An automatically recoverable error occurred ASB_SLIP_INSERT_WAIT Slip section is waiting for paper to be inserted ASB_RECEIPT_NEAR_END No paper in roll paper near end sensor ASB_SLIP_REMOVE_WAIT Slip section is waiting for paper to be removed ASB_RECEIPT_END No paper in roll paper end sensor ASB_SLIP_TOF No paper in the TOF detector ASB_SLIP_BOF No paper in the BOF detector ASB_BUZZER A buzzer is on (only for applicable devices) ASB_SLIP_SELECTED Slip not selected ASB_PRINT_SLIP Cannot print on a slip ASB_SPOOLER_IS_STOPPED The spooler has stopped (Not used) 4  data['data'] :Object type (String) Receives the MICR reading result. Receives a null if a method other than the MICRReader.read method was used.  sq :Object type (Number) Receives the processing sequence number. 147 Scanner Object ondata event Receives a barcode information scanning event. Syntax Function(data); Parameter of the callback function  data: Object type : (Object) Receives the following properties: Property input 148 Description Detected string Chapter 4 API Reference SimpleSerial Object This object cannot be used with a TM-i Series printer with the specification of "without a Serial port". API specifications can be customized by creating a device control script. sendCommand method Sends a desired command. When sending a command of command with the this API, specify command data strings using "\x" as a separator. Ex: "\x02\x1F\x03” Syntax sendCommand(data); Parameter  data: Object type : (String) Specifies the command with a hexadecimal string. 4 oncommandreply event Receives a response event from the device. Response data from the device may be sent split up. If so, oncommandreply events will occur multiple times. Use the oncommandreply events to check that the whole of the response data has been received. If there is data still to be received, wait for it to arrive before proceeding with the processing. Syntax Function(data); Parameter of the callback function  data: Object type : (Object) Receives the following properties: Property data Description Receives a hexadecimal string of response data. The received hexadecimal string is separated with "\x". Ex: “\x1B\x40” Object type String 149 DeviceHubTerminal object Cannot be used with TM-i Series. shutdown method Shuts down the power source of the TM-DT. If using this API, use EPSON TMNet WebConfig to perform shutdown settings for the TM-DT. ([Settings]-[System settings]-[Shutdown settings]-[ePOS-Device]) Syntax shutdown(password, callback); Parameter  password: Object type : (String) Specifies the password set in the TM-DT's EPSON TMNet WebConfig.  callback: Object type : (Function) Specifies the callback for receiving the execution result of this API. Parameter of the callback function  data: Object type : (Object) The following property is included: Property status Description Shutdown execution result Object type String Value of status Set value 150 Description "OK" Success "AUTHENTICATION_ERROR" Password authentication error “ACCESS_DENIED” If [EPSON TMNet WebConfig]-[Settings]-[System settings]-[Shutdown settings]-[ePOS-Device]-[Shutdown permission] is set to "Do not permit", the shutdown was executed from this API. "SYSTEM_ERROR" System error occurred. Chapter 4 API Reference CommBoxManager Object openCommBox method Opens the Communication Box. Syntax openCommBox(boxID, option, callback); Parameter  boxID: Object type : (String) Specifies the ID of the box to open.  option: Object type : (Object) Specify the following property. Property memberID  callback: Description Object type Member ID for identifying oneself in the Communication Box. String Object type : (Function) Specifies the callback for receiving the opening result of the Communication Box. Return value  sq: Object type (String) Receives the processing sequence number. Parameter of the callback function  obj: Object type : (Object) The commBox object is returned for the first parameter. If this method fails, null is returned.  code: Object type : (String) The execution return is returned for the second parameter. String  sq: 4 Description "OK" Successfully opened the Communication Box. "ALREADY_OPENED" The Communication Box is already opened. "MEMBERID_ALREADY_USED" The specified member ID is already in use. "BOX_COUNT_OVER" The maximum number of Communication Boxes that can be made is exceeded. "BOX_CLIENT_OVER" The maximum number that can belong to a Communication Box is exceeded. "PARAMETER_ERROR" Parameter error. "SYSTEM_ERROR" Other error occurred. Object type (String) The return value from time this method was executed and the same sequence number are returned for the third parameter. 151 closeCommBox method Closes the Communication Box. Syntax closeCommBox(commBoxObj, callback); Parameter  commBoxObj: Object type : (Object) Specifies the commBox object to be closed.  callback:: Object type : (Function) Specifies to callback for receiving the closing result of the Communication Box. Return value  sq: Object type (String) Receives the processing sequence number. Parameter of the callback function  code: Object type : (String) The execution return is returned for the first parameter. String  sq: 152 Description "OK" Successfully closed the Communication Box. "NOT_OPENED" A Communication Box is not open. "PARAMETER_ERROR" Parameter error. "SYSTEM_ERROR" Other error occurred. Object type (String) The return value from time this method was executed and the same sequence number are returned for the second parameter. Chapter 4 API Reference CommBox Object getCommHistory method Acquires the transfer history of the Communication Box. Syntax getCommHistory(callback); Parameter  callback: Object type : (Function) Specifies the callback for receiving the transfer history of the Communication Box. Return value  sq: Object type (String) Receives the processing sequence number. Parameter of the callback function  code: Object type : (String) The execution return is returned for the first parameter. String  historyList: "OK" Successfully acquired transfer history. "NOT_OPENED" A Communication Box is not open. "SYSTEM_ERROR" Other error occurred. 4 Object type : (Array) The Communication Box's transfer history is returned for the second parameter. historyList.[index]  sq: Description Description Object type senderId Sender's memberID. String receiverId Receiver's memberID. String message Received message. Hash Object type (String) The return value from time this method was executed and the same sequence number are returned for the third parameter. 153 send method Sends a message to the Communication Box. Syntax send(message, memberId, callback); Parameter  message: Object type : (String) Specifies the data to send to the Communication Box.  memberId: Object type : (String) Specifies the destination member ID. If null or " "(space) is specified, it will be sent to all members in the Communication Box except for the sender.  callback: Object type : (Function) Specifies the callback for receiving the execution result of this method. Return value  sq: Object type (String) Receives the processing sequence number. Parameter of the callback function  code: Object type : (String) The execution return is returned for the first parameter. String 154 Description "OK" Successfully sent the message. "NOT_OPENED" A Communication Box is not open. "MEMBER_NOT_FOUND" The specified member is not found. "SYSTEM_ERROR" Other error occurred.  count: Object type : (Number) The number of clients the message was sent to is returned as the second parameter.  sq: Object type (String) The return value from time this method was executed and the same sequence number are returned for the third parameter. Chapter 4 API Reference onreceive event Notifies the content the Communication Box received. Syntax Function(data); Parameter of the callback function  data: Object type : (Object) The following properties are included. Property Description Object type senderId The sender's member ID is set. If there is no specified member ID when the openCommBox method was executed, " " (space) is set. String receiverId The receiver's member ID is set. If the data was sent to all members in the Communication Box, " " (space) is set. String message The sent data is set. String 4 155 156 Chapter 5 Device Control Script Device Control Script This section describes the information that the user will need in order to develop device control script. Cannot be used with TM-i Series. Programming Using Device Control Script Using API for the device control script provided by ePOS-Device enables customization of device data processing and use of a new device from Web applications. Web Browser Web Application Function call Callback ePOS-Device API (JavaScript) Request Response/Event TM-DT ePOS-Device Service I/F Device control script object DeviceConnection ClientConnection 5 Device When "createDevice" (p.60) of an ePOSDevice object is executed, an object is created so that the ePOSDevice Service I/F on TM-DT can use the device control script supported by the requested device. The device can be controlled with the created object. Device Control Script Object The ePOS-Device Service I/F passes the objects shown below to the device control script. Using these objects enables the device control script to communicate the Web application and device. Object Description ClientConnection Object used to send data to a device object on the Web browser. DeviceConnection Object used to send/receive data to/from the device. 157 Functions Using Device Control Script Object Using API for the device control script enables the following functions: ❏ Calling a desired event of device object on the Web browser ❏ Sending data to the device ❏ Receiving data generated in the device Configuration of Device Control Script Coding of the device control script must satisfy the following conditions: ❏ Describe the codes required for device control collectively in a file. (Only one file can be registered when using the EPSON TMNet WebConfig for device setting.) ❏ The part before the first dot "." of the file name must be identical to the constructor name. (Example) File name : Keyboard_Generic.ver1.0.js -> Constructor name : Keyboard_Generic ❏ For external reference of constructor, declare exports. Ex) exports.Keyboard_Generic = Keyboard_Generic; ❏ The constructor must have two arguments. ❏ The device control script must have the properties as shown below. Set an appropriate name with the constructor.  DEVICE_TYPE property (Object type :String) Set value Description type_keyboard Specify this to use a keyboard device. type_scanner Specify this to use a barcode scanner. type_simple_serial Specify this to perform simple serial communication.  DEVICE_GROUP property (Object type :String) Set value Description group_hid Specify this to use an input device that can run with an HID driver. group_serial Specify this to use a serial communication device. group_other Specify this to use other device. ❏ The "onDeviceData" method is provided to receive data generated in the device. For details, refer to Device Control Script Name object (p.160). ❏ The method corresponding to the method of a device object that can run on the Web browser is provided. For details, refer to Any event (p.164). 158 Chapter 5 Device Control Script Configuration Example of Device Control Script exports.Keyboard_Generic = Keyboard_Generic; // Exports declaration function Keyboard_Generic(clientConn, deviceConn){ // Having two arguments and the same name as the file name // Having the "DEVICE_TYPE" property // Having the "DEVICE_GROUP" property this.DEVICE_TYPE = ‘type_keyboard’; this.DEVICE_GROUP = ‘group_hid’; this.clientConn = clientConn; this.deviceConn = deviceConn; ...... ...... } Keyboard_Generic.prototype = { onDeviceData : function(event, keycode, ascii){…}, setprefix : function(data){…} // Having the "onDeviceData" method // Having the method corresponding to the device object } 5 159 List of Device Control Script API The device control script API provides the following objects: ❏ ClientConnection object (p.160) ❏ DeviceConnection object (p.160) ❏ Device control script name object (p.160) ClientConnection object Element API Description Page Method Sends data to a device object that can run with a Web browser. send 161 DeviceConnection object Element API Description Page Method Sends data to a serial communication device. send 162 Device Control Script Name object Element API Description Page Event 160 onDeviceData Key input receipt event 163 onDeviceData Data receipt event from a serial communication device 163 Any event API execution result receipt event of a device object that runs with a Web browser 164 Chapter 5 Device Control Script ClientConnection Object The object passed to the first parameter of the constructor of the device control script. send Sends data to a device object that can run with a Web browser. Syntax send(event, data); Parameter  event :Object type : (String) Specifies the event name of the device object.  data :Object type : (Object) Specifies the data to be passed to the event of the device object. Example In the example below, the "onkeypress" event of the device object is called and 49 is obtained form data.keycode and '1' from data.ascii using the "data" parameter of the "onkeypress" event. data = {'keycode' : 49, 'ascii' : '1'}; clientConn.send('onkeypress', data) 5 161 DeviceConnection Object The object passed to the second parameter of the constructor of the device control script. send Sends data to a serial communication device. No data is sent when an input device that can run with an HID driver is used. Syntax send(data); Parameter  data 162 :Object type : (Buffer) Specifies the data to be sent to the device. Chapter 5 Device Control Script Device Control Script Name Object onDeviceData event (Input Device That Can Run with a HID Driver) The event used to receive the data detected from a key input device. For the device control script for a key input device, describe an event in this format. Syntax onDeviceData(event, keycode, ascii); Parameter  event :Object type : (Number) Receives a direction of key operation. Value Description 1 Key down 2 Key up  keycode :Object type :(Number) Receives a keycode. For details, refer to List of KeyCode (p.199).  ascii :Object type : (String) Receives a character corresponding to the operated key. "undefined" is applied when no characters corresponding to the keycode (F1 key, for example) exist. onDeviceData event (Serial Communication Device) The event used to receive the data detected from a serial communication device. For the device control script for a serial communication device, describe an event in this format. 5 Syntax onDeviceData(data); Parameter  data :Object type : (Buffer) Receives the data received from a serial communication device. 163 Any event The event used to receive the API execution results of the device object that can run with a Web browser. Syntax Name specified with callEvent(data); Parameter  data 164 :Object type : (Object) Receives the object specified with callEvent of the device object. Chapter 6 Sample Program Sample Program This chapter describes how to use the sample program. Overview The sample program provided by the ePOS-Device API SDK for JavaScript the following functions. Sample Programs Description POS Terminal  POS Terminal Sample  POS Terminal  Customer Display Sample Entry Terminal  Call Sample  Entry Sample This is the POS system sample program. It can also use the Communication Box function to display on a tablet terminal. This is an entry terminal sample program. It can use the bi-directional communication function of the Communication Box to communicate between Web browsers on a tablet, etc. Receipt Designer It can easily create and print the print data for a receipt printer. Printer Sample It can create and print the print data for the printer. For a receipt printer, we recommend creating the print data with Receipt Designer. Hybrid Printer Sample It can create printer print data, acquire MICR data, and perform printing. Cannot be used with TM-i Series. Customer Display Sample It can create and display the display data for a customer display. Keyboard Sample It can receive input from a POS keyboard. Barcode Scanner Sample It can receive barcode data using a barcode scanner. POS Terminal Sample 6 165 Entry Terminal Receipt Designer Printer Sample 166 Chapter 6 Sample Program Hybrid Printer Sample Customer Display Sample Keyboard Sample 6 Barcode Scanner Sample 167 Operating Environment The requirements for operating the sample program are as follows: ❏ Devices required (Note that you do not have to make all of the following devices available to use the sample program.)  TM-Intelligent (TM-DT series/ TM-i series)  Customer display  POS keyboard  Barcode scanner ❏ Requirements for operating TM-Intelligent.  TM-DT series : Display, Keyboard, Mouse or Tablet device(HTML5-supported Web browser)  TM-i series : Computer for making settings, Tablet device(HTML5-supported Web browser) ❏ Other  LAN cable  Sample program 168 Chapter 6 Sample Program Environment Setting for TM-DT Series The workflow of setting an environment for the sample program is shown as follows: If the Windows Security screen appears while using EPSON TMNet WebConfig, enter your user name and password. The default values are as follows: User name : epson Password : epson 1. Network Settings Configure the system and TM-DT network settings. 2. Registering the Sample Program The sample program (ePOS-Device_Sample_JS_Vx.x.xE.zip) is registered to the TM-DT printer using EPSON TMNet WebConfig. For details, refer to the Technical Reference Guide for each TM-DT printer. 3. Connecting the device Connect the device to use to TM-DT. 4. Setting the Devices (p.170) Configure the settings using EPSON TMNet WebConfig. 6 169 Setting the Devices EPSON TMNet WebConfig can be launched from your web browser. For details on settings used, refer to the Technical Reference Guide for each TM-DT. The following devices must be configured for the operating environment using the sample program. ❏ Customer display Setting Customer Display Setting Value Use The device ID of the customer display is fixed to "local_display". ❏ POS keyboard Setting Setting Value Device ID local_keyboard Device name Select the relevant device from the list. Control Script Keyboard_Generic.js ❏ Barcode scanner Setting 170 Setting Value Device ID local_scanner Device name Select the relevant device from the list. Control Script Scanner_Generic.js Chapter 6 Sample Program Environment Setting for TM-i Series The workflow of setting an environment for the sample program is shown as follows: 1. Connection of Device to TM-i Connect the device to use to TM-i. 2. Network Settings Configure the system and TM-i network settings. 3. Registering the Sample Program The sample program (ePOS-Device_Sample_JS_Vx.x.xE.zip) is registered to the TM-i printer using EPSON TMNet WebConfig. For details, refer to the Technical Reference Guide for each TM-i printer. 4. Setting the Devices (p.172) Configure the settings using EPSON TMNet WebConfig. 6 171 Setting the Devices EPSON TMNet WebConfig can be launched from your web browser. For details on settings used, refer to the Technical Reference Guide for each TM-i printer. The following devices must be configured for the operating environment using the sample program. ❏ Customer display Setting Customer Display Setting Value Use The device ID of the customer display is fixed to "local_display". ❏ POS keyboard Setting Setting Value Device ID local_keyboard Device name Select the relevant device from the list. Control Script Keyboard_Generic.js ❏ Barcode scanner Setting 172 Setting Value Device ID local_scanner Device name Select the relevant device from the list. Control Script Scanner_Generic.js Chapter 6 Sample Program Starting the Sample Program Start the sample program (ePOS-Device_Sample_JS_Vx.x.xE.zip). 1 Start the Web browser, and enter the following URL in the address bar: 2 The sample program appears. http://[IP address of TM-Intelligent]/index.html If the sample program does not appear, check that the LAN cable is connected. 6 173 How to Use the Sample Program The six items shown below exist in the sample program. Select each item to move to its corresponding screen. ❏ POS Terminal Sample (p. 174) ❏ Entry Terminal Sample (p. 180) ❏ Printer Sample (p. 189) ❏ Hybrid Printer Sample (p. 191) ❏ Customer Display Sample (p. 194) ❏ Keyboard Sample (p. 196) ❏ Barcode Scanner Sample (p. 198) POS Terminal Sample Allows the program to operate in the same way as a POS system. Preparations Start the sample program and set each device. 1 Start the following sample programs in separate Web browsers.  POS Terminal Customer Display Sample(p. 174)  POS Terminal Sample(p. 176) 2 174 The POS Terminal Customer Display Sample screen appears. Chapter 6 Sample Program 3 The "Connection Information" screen appears.  Set the IP Address/ Port for TM-Intelligent printer and click the [Connect]. 4 The following window appears. This completes setup of the POS Terminal Customer Display Sample. 6 175 5 6 The "Web-POS Sample" screen appears. Click the [Settings] button. The "Setting" screen appears. You can set the IP Address/Port/Device ID.  When the settings have been changed, click the [Connect] button to confirm that the status changes to [OK]. After confirmation, closes the screen. Normally, there is no need to change the settings. This completes setup of the POS Terminal Sample. 176 Chapter 6 7 Sample Program After a short while, the digital signage will be displayed on the POS Terminal Customer Display Sample screen. 6 177 Operation The procedure from reading merchandise data to receipt issuance is shown below. Merchandise barcode samples are attached to the sample program in PDF format. Use them by printing. 1 Input merchandise items using the barcode scanner or POS keyboard.  After inputting merchandise items, click the [Subtotal] button.  Click the [Delete Item] button to delete the currently selected item. Alternatively, click the [Delete All] button to delete all the items.  To change the quantity, after inputting a merchandise item, press the [Qty] button to enter a number. To confirm the quantity, click the [Ent] button. The POS Terminal Customer Display Sample screen displays the scanned data and the [Total]. 178 Chapter 6 Sample Program 2 Enter the received amount. After inputting the amount, click the [Ent] button. 3 The amount of change is displayed and a receipt will be printed from the printer. 6 179 Entry Terminal This is a sample program that assumes the use of a reception terminal. It uses the Communication Box function to transfer data between applications. 1 2 3 180 Start the sample program on the guest side. Select [Entry Terminal Entry Sample]. The "Connection Information" screen appears.  Set the IP Address/ Port/ Device ID for TM-Intelligent printer and click the [Connect]. The "Entry Terminal Entry Sample" screen appears. Chapter 6 4 5 Sample Program Start the sample program on the calling side. Select [Entry Terminal Call Sample]. The "Connection Information" screen appears.  Set the IP Address/ Port for TM-Intelligent printer and click the [Connect]. 6 The "Entry Terminal Call Sample" screen appears. 7 Operate according to the Entry Terminal Entry Sample screen. The reception number is printed from the TM-Intelligent printer and a wait time is displayed. 6 181 8 9 182 When you perform the operation in Step 7, the reception number is displayed on the Entry Terminal Call Sample screen, enabling [Entry]. Click [Entry]. The wait time on the Entry Terminal Entry Sample screen is updated. Chapter 6 Sample Program Receipt Designer This can easily make and print sample codes for print data of the receipt printer. • In Google Chrome, when a preview image including pictures is displayed, a "SECURITY_ERR: DOM Exception 18" error occurs. • In Windows Internet Explorer 9, when printing is performed, a "SCRIPT5: Access is denied." error occurs. Preparations 1 2 Start the sample program. Select [Receipt Designer]. The "Receipt Designer for ePOS-Device" screen appears. Click the [Setting] tab. Set the following. Item * Description Model, Paper width (Liner width) Select printer model to be used and paper width (for label paper, the mount width). The Preview screen resizes according to the paper width set to the model. IP address of the intelligent printer Specify the IP address of the printer. Be sure to specify this item. Port number Specifies the port number of ePOS-Device Service I/F. Normally, specify 8008. For SSL communication, specify 8043. Device ID of the target printer Specify the device ID of the printer. Be sure to specify this item. Print timeout (milliseconds) Specify the print timeout time in milliseconds. The maximum value is 60000 (60 seconds). Monitor the status When this checkbox is checked, the printer's status is monitored. Use print job ID * Check this for a print job ID to be assigned when printing. ePOS-Device Service Ver. 2.6 or later versions supported 183 6 Creating a Sample Code Select the [Edit] tab to display the Edit screen. Create an ePOS-Device SDK for JavaScript sample code in the Edit screen. Menu area Edit area Item 184 Description Menu area Displays the available functions. Click an icon to add it to the bottom of the edit area, and drag an icon to insert it anywhere in the edit area. Edit area Displays the functions selected in the menu area. Drag an element to change its position. An element can be deleted using the x button located on its right side. Import Using ePOS-Device XML, Receipt Designer can import XML data stored in the past. For details, refer to Import (p.188). Clear Deletes the edited details. Forced Transmission Sets forced transmission mode. Chapter 6 Sample Program Create a sample code as follows: 1 Click an icon in the menu area to add an element in the edit area. 2 Configure the added element. 3 Select the [Preview] tab to check the preview image. The position of the added function can be changed by dragging. Example: When the NV logo is added, set the key code. When a printer is connected, you can also check the image by printing.  For details, refer to Print (p.187). • Logo printing, barcode printing, 2D code printing, ESC command, buzzer sound, drawer kick, and paper cut are displayed as icons. • The layout may change depending on the preview settings. (For details, refer to Preparations (p.183)). 6 185 4 Select the [API] tab. The ePOS-Device SDK for JavaScript sample code appears. Use it by copying. The ePOS-Device XML print document is used for importing. If necessary, select the XML tab and save the content of the ePOS-Device XML print document by copying. 186 Chapter 6 Sample Program Print Using the printer, print the print document according to the printer's settings to perform test printing. (For details on the printer settings, refer to Preparations (p.183)). Item Description Data to be sent (ePOS-Device XML) The ePOS-Device XML document is displayed. Send Sends data to the printer and performs printing. Information Displays the print status. Clear Deletes the content in the [Information] box. Perform printing as follows: 1 2 Select the [Print] tab. Check the content in the [Data to be sent (ePOS-Device XML)] box and press the [Send] button. The ePOS-Device XML print document created using the [Edit] tab page is displayed in "Data to be sent (ePOS-Device XML)". 3 The print document is printed to the intelligent printer. The acquired status is displayed in the Information box. 187 6 Import Receipt designer can import and re-edit the ePOS-Device XML print document once created. Note that you cannot perform import operation using ePOS-Device SDK for JavaScript source code. Perform import operation using ePOS-Device XML print data. Item Description Data to be import (ePOS-Device XML) Paste and check the ePOS-Device XML print document to be imported. Apply Imports the ePOS-Device XML print document. Information Displays the import information. Close Closes the Import screen. Receipt designer can import an ePOS-Device XML print document as follows: 1 2 3 4 188 Select the [Edit] tab and click the [Import] button. The "Import" screen appears. Paste the ePOS-Device XML print document in the [Data to be import (ePOS-Device XML)] box. Click the [Apply] button. The "Confirmation" screen appears. Click the [Yes] button. Chapter 6 Sample Program Printer Sample Allows you to operate the printer and create a sample code for the printer. 1 2 Start the sample program. Select [Printer Sample]. The "Printer Sample Program" screen appears. Click the [Connect] button. When the connection process is successful, a message will be displayed in [Console] as shown below. There is no need to change the settings in [Device Setting]. However, if some set value has been changed such as IP address, replace it with the value after 3 Set the feature you want to operate and click the [Add] button. 6 189 190 4 The source code for the feature added in step 3 is displayed in [Printer Object Sample Code]. It can be used by copying. 5 Click the [Send] button, and the test printing operation will be performed according to the feature added in step 3. Chapter 6 Sample Program Hybrid Printer Sample You can activate the hybrid printer functions and create sample code for the hybrid printer. Cannot be used with TM-i Series. Preparation 1 2 Start the sample program. Select [Hybrid Printer Sample]. The "Hybrid Printer Sample" screen appears. Click [Connect].  If it connects successfully, the following message is displayed in the [Console] section. You do not need to change the [Device Setting] settings. However, if you are changing items such as the IP address, match it to the changed values. 6 191 How to Use the Printing Function 1 2 192 From [ePOS-Device API Hybrid Printer Object], set the function you want to activate and click [Add]. Select the printing method from [target]. 3 The source for the function added in Step 1 is displayed in the [Hybrid Printer Object Sample Code] section. You can copy it and use it. 4 Perform settings for each print method in [Test print].  Click [Print] to perform the test print that matches the function added in Step 3. Chapter 6 Sample Program How to Use the MICR Function 1 In [Test print], click [lock]. 2 Perform settings for MICR, then click [Read]. 3 Set check paper in the hybrid printer. 4 When processing is completed, click [Eject]. 5 Click [unlock]. MICR data is scanned using the settings from Step 1. The check paper is ejected. 6 193 Customer Display Sample Allows you to operate the customer display and create a sample code for the customer display. 1 2 Start the sample program. Select [Customer Display Sample]. The "Customer Display Sample Program" screen appears. Click the [Connect] button. When the connection process is successful, a message will be displayed in [Console] as shown below. Also, the display condition of the customer display will change. There is no need to change the settings in [Device Setting]. However, if some set value has been changed such as IP address, replace it with the value after change. 3 194 Set the feature you want to operate and click the [Add] button. Chapter 6 Sample Program 4 The source code for the feature added in step 3 is displayed in [Display Object Sample Code]. It can be used by copying. 5 Click the [Send] button, and the display condition will change according to the feature added in step 3. 6 195 Keyboard Sample Allows you to acquire inputs from the POS keyboard. 1 2 Start the sample program. Select [Keyboard Sample]. The "Keyboard Sample Program" screen appears. Click the [Connect] button. When the connection process is successful, a message will be displayed in [Console] as shown below. There is no need to change the settings in [Device Setting]. However, if some set value has been changed such as IP address, replace it with the value after change. 3 Select the key to be judged as the beginning of a character string and click the [Set] button. This setting requires registration on the POS keyboard side in advance. Example: F1 + Specified string + Enter 196 Chapter 6 4 Sample Program When a string is input from the POS keyboard, the result will be displayed in [ePOS Device API Keyboard Object]. Input Result When a string is directly input Displayed in the onkeypress box. When a string set to the POS key is input When the key to which a string is set is pressed, the result will be displayed the onstring box. 6 197 Barcode Scanner Sample Allows you to acquire inputs from the barcode reader. 1 2 Start the sample program. Select [Barcode Scanner Sample]. The "Barcode Scanner Sample Program" screen appears. Click the [Connect] button. When the connection process is successful, a message will be displayed in [Console] as shown below. There is no need to change the settings in [Device Setting]. However, if some set value has been changed such as IP address, replace it with the value after change. 3 198 Cause the barcode reader to read the barcode. The read information will be displayed in [ePOS Device API Scanner Object]. Appendix Appendix List of KeyCode Constant Code Constant Code Constant Code VK_BACK 0x08 VK_7 0x37 VK_Z 0x5A VK_TAB 0x09 VK_8 0x38 VK_MULTIPLY 0x6A VK_RETURN 0x0D VK_9 0x39 VK_ADD 0x6B VK_SHIFT 0x10 VK_A 0x41 VK_SUBTRACT 0x6D VK_CONTROL 0x11 VK_B 0x42 VK_F1 0x70 VK_MENU 0x12 VK_C 0x43 VK_F2 0x71 VK_CAPITAL 0x14 VK_D 0x44 VK_F3 0x72 VK_ESCAPE 0x1B VK_E 0x45 VK_F4 0x73 VK_CONVERT 0x1C VK_F 0x46 VK_F5 0x74 VK_NONCONVERT 0x1D VK_G 0x47 VK_F6 0x75 VK_SPACE 0x20 VK_H 0x48 VK_F7 0x76 VK_PRIOR 0x21 VK_I 0x49 VK_F8 0x77 VK_NEXT 0x22 VK_J 0x4A VK_F9 0x78 VK_END 0x23 VK_K 0x4B VK_F10 0x79 VK_HOME 0x24 VK_L 0x4C VK_F11 0x7A VK_LEFT 0x25 VK_M 0x4D VK_F12 0x7B VK_UP 0x26 VK_N 0x4E VK_OEM_1 0xBA VK_RIGHT 0x27 VK_O 0x4F VK_OEM_PLUS 0xBB VK_DOWN 0x28 VK_P 0x50 VK_OEM_COMMA 0xBC VK_INSERT 0x2D VK_Q 0x51 VK_OEM_MINUS 0xBD VK_DELETE 0x2E VK_R 0x52 VK_OEM_PERIOD 0xBE VK_0 0x30 VK_S 0x53 VK_OEM_2 0xBF VK_1 0x31 VK_T 0x54 VK_OEM_3 0xC0 VK_2 0x32 VK_U 0x55 VK_OEM_4 0xDB VK_3 0x33 VK_V 0x56 VK_OEM_5 0xDC VK_4 0x34 VK_W 0x57 VK_OEM_6 0xDD VK_5 0x35 VK_X 0x58 VK_OEM_7 0xDE VK_6 0x36 VK_Y 0x59 VK_OEM_ATTN 0xF0 199 Printer Specifications TM-H6000IV-DT/ TM-H6000IV Receipt Slip 80 mm Endorsement 58 mm Interface Ethernet, Wireless LAN Resolution 180 x 180 dpi - Print Width 512 dots - Characters in a Line Character Size Character Baseline Font A ANK:  42 characters ANK:  30 characters ANK:  45 characters ANK:  25 characters Font B ANK:  56 characters ANK:  40 characters ANK:  60 characters ANK:  33 characters Font A ANK: 12 dots x 24 dots (W x H) ANK: 5 dots x 9 dots (W x H) Font B ANK: 9 dots x 17 dots (W x H) ANK: 7 dots x 9 dots (W x H) Font A At the 21st dot from the top of the character - Font B At the 16th dot from the top of the character - Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 512 dots x 831 dots (W x H) 360 dots x 831 dots (W x H) - - Page Mode Maximum Area 512 dots x 1662 dots (W x H) 360 dots x 1662 dots (W x H) - - Raster Image Monochrome image, Gray scale image Monochrome image Logo Monochrome image, Gray scale image Not supported Barcode UPC-A, UPC-E, EAN13, JAN13, EAN8, JAN8, CODE39, Not supported ITF, CODABAR, CODE93, CODE128, GS1-128, GS1 DataBar Omnidirectional, GS1 DataBar Truncated, GS1 DataBar Limited, GS1 DataBar Expanded 200 - Appendix Receipt Slip 80 mm 2D-Code Endorsement 58 mm PDF417, QR Code, MaxiCode, GS1 DataBar Stacked, GS1 DataBar Stacked Omnidirectional, Not supported GS1 DataBar Expanded Stacked, Composite Symbology Ruled Line Page Mode Not supported Line Not supported Rectangle Paper Cut Cut, Feed cut Drawer Kick-Out Supported Buzzer Not supported Paper Layout Settings Not supported Command Supported MICR Supported Not supported 201 TM-T70II-DT/ TM-T70II 80 mm Interface Ethernet, Wireless LAN Resolution 203 dpi x 203 dpi (W x H) Print Width 576 dots Characters in a Line Character Size Character Baseline Font A ANK: 48 characters Font B ANK: 72 characters Font A ANK: 12 dots x 24 dots (W x H) Font B ANK: 9 dots x 17 dots (W x H) Font A At the 21st dot from the top of the character Font B At the 15th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 576 dots x 1662 dots (W x H) Page Mode Maximum Area 576 dots x 1662 dots (W x H) Raster Image Monochrome image Logo Monochrome image 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 2D-Code PDF417, QR Code, MaxiCode, GS1 DataBar Stacked, GS1 DataBar Stacked Omnidirectional, GS1 DataBar Expanded Stacked Ruled Line Not supported Page Mode Line Not supported Rectangle 202 Paper Cut Cut, Feed cut Drawer Kick-Out Supported Buzzer Supported Paper Layout Settings Not supported Command Supported Appendix TM-T88V-DT/ TM-T88V-i/ TM-T88V * Only for South Asia model 58 mm 80 mm Interface Ethernet, Wireless LAN Resolution 180 dpi x 180 dpi (W x H) Print Width 360 dots 512 dots Font A ANK: 30 characters ANK: 42 characters Font B ANK: 40 characters ANK: 56 characters Special font A* 30 characters 42 characters Special font B* 40 characters 56 characters Font A ANK: 12 dots x 24 dots (W x H) Font B ANK: 9 dots x 17 dots (W x H) Special font A* 12 dots x 24 dots (W x H) Special font B* 9 dots x 24 dots (W x H) Font A At the 21st dot from the top of the character Font B At the 16th dot from the top of the character Special font A* At the 20th dot from the top of the character Special font B* At the 20th dot from the top of the character Characters in a Line Character Size Character Baseline 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 1662 dots (W x H) 512 dots x 1662 dots (W x H) Raster Image Monochrome image, Gray scale image Logo Monochrome image, Gray scale image 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 203 * Only for South Asia model 58 mm 2D-Code PDF417, QR Code, MaxiCode, GS1 DataBar Stacked, GS1 DataBar Stacked Omnidirectional, GS1 DataBar Expanded Stacked (Composite Symbology not supported) Ruled Line Not supported Page Mode Line Not supported Rectangle 204 80 mm Paper Cut Cut, Feed cut Drawer Kick-Out Supported Buzzer Optional Paper Layout Settings Not supported Command Supported Appendix TM-T20II-i 80 mm Interface Ethernet, Wireless LAN Resolution 203 dpi x 203 dpi (W x H) Print Width (42 Column Mode) 576 dots (546 dots) Characters in a Line Font A (42 Column Mode) Font B (42 Column Mode) Character Size Font A (42 Column Mode) Font B (42 Column Mode) Character Baseline ANK: 48 characters (ANK: 42 characters) ANK: 64 characters (ANK: 60 characters) ANK: 12 dots x 24 dots (W x H) (ANK: 13 dots x 24 dots) ANK: 9 dots x 17 dots (W x H) (ANK: 9 dots x 17 dots) Font A At the 21st dot from the top of the character Font B At the 16th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 576 dots x 831 dots (W x H) Page Mode Maximum Area 576 dots x 1662 dots (W x H) Raster Image Monochrome image Logo Monochrome image 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 2D-Code PDF417, QR Code, MaxiCode, GS1 DataBar Stacked,  GS1 DataBar Stacked Omnidirectional, GS1 DataBar Expanded Stacked, Composite Symbology Ruled Line Not supported Page Mode Line Not supported Rectangle Paper Cut Cut, Feed cut Drawer Kick-Out Supported 205 80 mm 206 Buzzer Optional Paper Layout Settings Not supported Command Supported Appendix TM-T70-i/ TM-T70 80 mm Interface Ethernet, Wireless LAN Resolution 180 dpi x 180 dpi (W x H) Print Width 512 dots Characters in a Line Character Size Character Baseline Font A ANK: 42 characters Font B ANK: 56 characters Font A ANK: 12 dots x 24 dots (W x H) Font B ANK: 9 dots x 17 dots (W x H) Font A At the 21st dot from the top of the character Font B At the 15th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 512 dots x 1662 dots (W x H) Page Mode Maximum Area 512 dots x 1662 dots (W x H) Raster image Monochrome image Logo Monochrome image Barcode UPC-A, UPC-E, EAN13, JAN13, EAN8, JAN8, CODE39, ITF, CODABAR, CODE93, CODE128 2D-Code PDF417, QR Code Ruled Line Not supported Page Mode Line Not supported Rectangle Paper Cut Cut, Feed cut Drawer Kick-Out Supported Buzzer Not supported Paper Layout Settings Not supported Command Supported 207 TM-T82II-i/ TM-T82II 80 mm Interface Ethernet, Wireless LAN Resolution 203 dpi x 203 dpi (W x H) Print Width (42 Column Mode) 576 dots (546 dots) Characters in a Line Font A (42 Column Mode) Font B (42 Column Mode) Character Size Font A (42 Column Mode) Font B (42 Column Mode) Character Baseline ANK: 48 characters (ANK: 42 characters) ANK: 64 characters (ANK: 60 characters) ANK: 12 dots x 24 dots (W x H) (ANK: 13 dots x 24 dots) ANK: 9 dots x 17 dots (W x H) (ANK: 9 dots x 17 dots) Font A At the 21st dot from the top of the character Font B At the 16th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 576 dots x 831 dots (W x H) Page Mode Maximum Area 576 dots x 1662 dots (W x H) Raster image Monochrome image Logo Monochrome image 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 2D-Code PDF417, QR Code, MaxiCode, GS1 DataBar Stacked,  GS1 DataBar Stacked Omnidirectional, GS1 DataBar Expanded Stacked, Composite Symbology Ruled Line Not supported Page Mode Line Not supported Rectangle 208 Paper Cut Cut, Feed cut Drawer Kick-Out Supported Appendix 80 mm Buzzer Optional Paper Layout Settings Not supported Command Supported 209 TM-T83II-i/ TM-T83II 80 mm Interface Ethernet, Wireless LAN Resolution 180 dpi x 180 dpi (W x H) Print Width 512 dots Characters in a Line Character Size Character Baseline Font A ANK: 42 characters Kanji: 21 characters Font B ANK: 56 characters Kanji: 32 characters Font A ANK: 12 dots x 24 dots (W x H) Kanji: 24 dots x 24 dots (W x H) Font B ANK: 9 dots x 17 dots (W x H) Kanji: 16 dots x 16 dots (W x H) Font A ANK: At the 21st dot from the top of the character Kanji: At the 21st dot from the top of the character Font B ANK: At the 16th dot from the top of the character Kanji: At the 15th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 512 dots x 1662 dots (W x H) Page Mode Maximum Area 512 dots x 1662 dots (W x H) Raster image Monochrome image Logo Monochrome image 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 2D-Code PDF417, QR Code, MaxiCode, GS1 DataBar Stacked,  GS1 DataBar Stacked Omnidirectional, GS1 DataBar Expanded Stacked Ruled Line Not supported Page Mode Line Not supported Rectangle 210 Paper Cut Cut, Feed cut Drawer Kick-Out Supported Buzzer Optional Appendix 80 mm Paper Layout Settings Not supported Command Supported 211 TM-L90 Receipt Interface Ethernet, Wireless LAN Resolution 203 dpi x 203 dpi (W x H) Print Width 256 dots (38 mm) to 576 dots (80 mm) 224 dots (38 mm) to 560 dots (80 mm) Font A ANK: 48 characters, ANK: 46 characters Font B ANK: 570 characters ANK: 56 characters Font A ANK: 12 dots x 24 dots (W x H) Font B ANK: 10 dots x 24 dots (W x H) Font A At the 21st dot from the top of the character Font B At the 21st dot from the top of the character Characters in a Line Character Size Character Baseline Default Line Feed Space 30 dots Color Specification First color Second color, Second color (when two-color printing is set) Page Mode Default Area 576 dots x 738 dots (W x H) 560 dots x 738 dots (W x H) 576 dots x 369 dots (W x H) 560 dots x 369 dots (W x H) 576 dots x 1476 dots (W x H) 560 dots x 1476 dots (W x H) 576 dots x 738 dots (W x H) 560 dots x 738 dots (W x H) when twocolor printing is set Page Mode Maximum Area when twocolor printing is set Raster Image Monochrome image, Two color image Logo Monochrome image, Two color image (To perform two-color printing, change the settings of the printer using the memory switch setting utility.) Barcode UPC-A, UPC-E, EAN13, JAN13, EAN8, JAN8, CODE39, ITF, CODABAR, CODE93, CODE128 2D-Code PDF417, QR Code, MaxiCode Ruled Line Not supported Page Mode Line Not supported Rectangle Paper Cut 212 Die-cut Label Cut, Feed cut Appendix Receipt Die-cut Label Drawer Kick-Out Supported Buzzer Not supported Paper Layout Settings Not supported (With automatic setup mode) Command Supported 213 TM-P20 58 mm Interface Ethernet, Wi-Fi Resolution 203 dpi x 203 dpi (W x H) Print Width 384 dots Characters in a Line Character Size Character Baseline 214 Font A ANK: 32 characters Font B ANK: 42 characters Font C ANK: 42 characters Font D ANK: 38 characters Font E ANK: 48 characters Font A ANK: 12 dots x 24 dots (W x H) Font B ANK: 9 dots x 24 dots (W x H) Font C ANK: 9 dots x 17 dots (W x H) Font D ANK: 10 dots x 24 dots (W x H) Font E ANK: 8 dots x 16 dots (W x H) Font A At the 21st dot from the top of the character Font B At the 16th dot from the top of the character Font C At the 16th dot from the top of the character Font D At the 21st dot from the top of the character Font E At the 15th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 384 dots x 2400 dots (W x H) Page Mode Maximum Area 384 dots x 2400 dots (W x H) Raster Image Monochrome image Logo Monochrome image 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 2D-Code PDF417, QR Code, MaxiCode, GS1 DataBar Stacked,  GS1 DataBar Stacked Omnidirectional, GS1 DataBar Expanded Stacked, Composite Symbology Appendix 58 mm Ruled Line Page Mode Not supported Line Supported (Only solid line) Rectangle Paper Cut Feeds paper to cutting position Drawer Kick-Out Not supported Buzzer Optional Battery Supported Paper Layout Settings Supported Command Supported 215 TM-P60II Receipt 58 mm Interface Wireless LAN Resolution 203 dpi x 203 dpi (W x H) Print Width 420 dots 432 dots Font A ANK: 35 characters, ANK: 36 characters Font B ANK: 42 characters ANK: 43 characters Font C ANK: 52 characters ANK: 54 characters Font A ANK: 12 dots x 24 dots (W x H) Font B ANK: 10 dots x 24 dots (W x H) Font C ANK: 8 dots x 16 dots (W x H) Font A At the 21st dot from the top of the character Font B At the 21st dot from the top of the character Font C At the 15th dot from the top of the character Characters in a Line Character Size Character Baseline Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 420 dots x 1624 dots (W x H) 432 dots x 1624 dots (W x H) Page Mode Maximum Area 420 dots x 1624 dots (W x H) 432 dots x 1624 dots (W x H) Raster Image Monochrome image Logo Monochrome image 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 2D-Code PDF417, QR Code, MaxiCode, GS1 DataBar Stacked, GS1 DataBar Stacked Omnidirectional, GS1 DataBar Expanded Stacked, Aztec Code, DataMatrix (Composite Symbology : Not supported) Ruled Line Not supported Page Mode Line Supported (Only solid line) Rectangle 216 Receipt 60 mm Paper Cut Cut, Feed cut Drawer Kick-Out Not supported Appendix Receipt 58 mm Buzzer Support (Pattern 1 ~ Pattern 10, Stop) Paper Layout Settings Not supported Command Supported Receipt 60 mm 217 TM-P60II with Peeler Receipt 58 mm Receipt 60 mm Interface Wireless LAN Resolution 203 dpi x 203 dpi (W x H) Print Width 420 dots 432 dots 160 dots ~ 400 dots Font A ANK: 35 characters, ANK: 36 characters ANK: 33 characters Font B ANK: 42 characters ANK: 43 characters ANK: 40 characters Font C ANK: 52 characters ANK: 54 characters ANK: 50 characters Font A ANK: 12 dots x 24 dots (W x H) Font B ANK: 10 dots x 24 dots (W x H) Font C ANK: 8 dots x 16 dots (W x H) Font A At the 21st dot from the top of the character Font B At the 21st dot from the top of the character Font C At the 15th dot from the top of the character Characters in a Line Character Size Character Baseline Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 420 dots x 1624 dots (W x H) 432 dots x 1624 dots (W x H) 400 dots x 1624 dots (W x H) Page Mode Maximum Area 420 dots x 1624 dots (W x H) 432 dots x 1624 dots (W x H) 400 dots x 1624 dots (W x H) Raster Image Monochrome image Logo Monochrome image 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 2D-Code PDF417, QR Code, MaxiCode, GS1 DataBar Stacked, GS1 DataBar Stacked Omnidirectional, GS1 DataBar Expanded Stacked, Aztec Code, DataMatrix (Composite Symbology : Not supported) Ruled Line Not supported Page Mode Line Supported (Only solid line) Rectangle 218 Die-cut label Paper Cut Feed cut (Feeds paper to cutting position) Drawer Kick-Out Not supported Appendix Receipt 58 mm Receipt 60 mm Buzzer Support (Pattern 1 ~ Pattern 10, Stop) Paper Layout Settings Supported Command Supported Die-cut label 219 TM-P80 80 mm Interface Wireless LAN Resolution 203 dpi x 203 dpi (W x H) Print Width 576 dots Characters in a Line Character Size Character Baseline Font A ANK: 48 characters Font B ANK: 64 characters Font A ANK: 12 dots x 24 dots (W x H) Font B ANK: 9 dots x 17 dots (W x H) Font A At the 21st dot from the top of the character Font B At the 16th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 576 dots x 1662 dots (W x H) Page Mode Maximum Area 576 dots x 1662 dots (W x H) Raster Image Monochrome image Logo Monochrome image 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 2D-Code PDF417, QR Code, MaxiCode, Data Matrix, Aztec Code, GS1 DataBar Stacked,  GS1 DataBar Stacked Omnidirectional, GS1 DataBar Expanded Stacked, Composite Symbology Ruled Line Not supported Page Mode Line Not supported Rectangle 220 Paper Cut Feed Drawer Kick-Out Not supported Buzzer Optional Paper Layout Settings Supported Command Supported Appendix TM-T20 58 mm 80 mm Interface Ethernet Resolution 203 dpi x 203 dpi (W x H) Print Width 420 dots 576 dots Font A ANK: 35 characters, ANK: 48 characters Font B ANK: 46 characters ANK: 64 characters Font A ANK: 12 dots x 24 dots (W x H) Font B ANK: 9 dots x 17 dots (W x H) Font A At the 21st dot from the top of the character Font B At the 16th dot from the top of the character Characters in a Line Character Size Character Baseline Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 420 dots x 831 dots (W x H) 576 dots x 831 dots (W x H) Page Mode Maximum Area 420 dots x 1662 dots (W x H) 576 dots x 1662 dots (W x H) Raster Image Monochrome image Logo Monochrome image 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 2D-Code PDF417, QR Code, MaxiCode, GS1 DataBar Stacked, GS1 DataBar Stacked Omnidirectional, GS1 DataBar Expanded Stacked (Composite Symbology : Not supported) Ruled Line Not supported Page Mode Line Not supported Rectangle Paper Cut Cut, Feed cut Drawer Kick-Out Supported Buzzer Optional (Pattern A ~ Pattern E, Error, No paper, Stop) Paper Layout Settings Not supported Command Supported 221 TM-T20II 58 mm Interface Ethernet, Wireless LAN Resolution 203 dpi x 203 dpi (W x H) Print Width (42 Column Mode) 420 dots (378 dots) 576 dots (546 dots) ANK: 35 characters ANK: 48 characters (ANK: 42 characters) (ANK: 42 characters) ANK: 46 characters ANK: 64 characters (ANK: 31 characters) (ANK: 60 characters) Characters in a Line Font A (42 Column Mode) Font B (42 Column Mode) Character Size Font A (42 Column Mode) Font B (42 Column Mode) Character Baseline ANK: 12 dots x 24 dots (W x H) (ANK: 9 dots x 17 dots) (ANK: 13 dots x 24 dots) ANK: 9 dots x 17 dots (W x H) (ANK: 12 dots x 24 dots) (ANK: 9 dots x 17 dots) Font A At the 21st dot from the top of the character Font B 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 831 dots (W x H) 576 dots x 831 dots (W x H) Page Mode Maximum Area 420 dots x 1662 dots (W x H) 576 dots x 1662 dots (W x H) Raster Image Monochrome image Logo Monochrome image 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 2D-Code PDF417, QR Code, MaxiCode, GS1 DataBar Stacked,  GS1 DataBar Stacked Omnidirectional, GS1 DataBar Expanded Stacked, Composite Symbology Ruled Line Not supported Page Mode Line Not supported Rectangle 222 80 mm Paper Cut Cut, Feed cut Drawer Kick-Out Supported Appendix 58 mm Buzzer Optional Paper Layout Settings Not supported Command Supported 80 mm 223 TM-T88IV 80 mm Interface Ethernet, Wireless LAN Resolution 180 dpi x 180 dpi (W x H) Print Width 512 dots 360 dots Font A ANK: 42 characters ANK: 30 characters Font B ANK: 56 characters ANK: 40 characters Font A ANK: 12 dots x 24 dots (W x H) Font B ANK: 9 dots x 17 dots (W x H) Font A At the 21st dot from the top of the character Font B At the 16th dot from the top of the character Characters in a Line Character Size Character Baseline Default Line Feed Space 30 dots Color Specification First color First color, Second color (when two-color printing is set) Page Mode Default Area 512 dots x 831 dots (W x H) 360 dots x 831 dots (W x H) 512 dots x 415 dots (W x H) 360 dots x 415 dots (W x H) 512 dots x 1662 dots (W x H) 360 dots x 1662 dots (W x H) 512 dots x 831 dots (W x H) 360 dots x 831 dots (W x H) when twocolor printing is set Page Mode Maximum Area when twocolor printing is set Raster image Monochrome image, two-color image Logo Monochrome image, two-color image (To perform two-color printing, change the settings of the printer using the memory switch setting utility.) Bar Code UPC-A, UPC-E, EAN13, JAN13, EAN8, JAN8, CODE39, ITF, CODABAR, CODE93, CODE128, GS1-128 2D-Code PDF417, QR Code Ruled Line Not supported Page Mode Line Not supported Rectangle 224 58 mm Paper Cut Cut, Feed cut Drawer Kick-Out Supported Buzzer Not supported Paper Layout Settings Not supported Command Supported Appendix TM-T90 58 mm 60 mm 80 mm Interface Ethernet, Wireless LAN Resolution 180 dpi x 180 dpi (W x H) Print Width 360 dots 384 dots 512 dots Font A ANK: 30 characters, ANK: 32 characters ANK: 42 characters Font B ANK: 40 characters ANK: 42 characters ANK: 56 characters Font A ANK: 12 dots x 24 dots (W x H) Font B ANK: 9 dots x 17 dots (W x H) Font A At the 21st dot from the top of the character Font B At the 16th dot from the top of the character Characters in a Line Character Size Character Baseline Default Line Feed Space 30 dots Color Specification First color Second color, Second color (when two-color printing is set) Page Mode Default Area 360 dots x 831 dots (W x H) 384 dots x 831 dots (W x H) 512 dots x 831 dots (W x H) 360 dots x 415 dots (W x H) 384 dots x 415 dots (W x H) 512 dots x 415 dots (W x H) 360 dots x 1662 dots (W x H) 384 dots x 1662 dots (W x H) 512 dots x 1662 dots (W x H) 360 dots x 831 dots (W x H) 384 dots x 831 dots (W x H) 512 dots x 831 dots (W x H) when twocolor printing is set Page Mode Maximum Area when twocolor printing is set Raster Image Monochrome image, Two color image Logo Monochrome image, Two color image (To perform two-color printing, change the settings of the printer using the memory switch setting utility.) Barcode UPC-A, UPC-E, EAN13, JAN13, EAN8, JAN8, CODE39, ITF, CODABAR, CODE93, CODE128 2D-Code PDF417 Ruled Line Not supported Page Mode Line Not supported Rectangle B 225 58 mm 226 60 mm Paper Cut Cut, Feed cut Drawer Kick-Out Supported Buzzer Supported via Drawer Kick-Out Paper Layout Settings Not supported Command Supported 80 mm Appendix TM-U220 76 mm 70 mm 58 mm Interface Ethernet, Wireless LAN Resolution 80 dpi x 72 dpi (W x H) Print Width 200 dots 180 dots 150 dots Font A ANK: 33 characters, ANK: 30 characters ANK: 25 characters Font B ANK: 40 characters ANK: 36 characters ANK: 30 characters Font A ANK: 4.5 dots x 9 dots (W x H) Font B ANK: 3.5 dots x 9 dots (W x H) Font A Bottom of the characters Font B Bottom of the characters Characters in a Line Character Size Character Baseline Default Line Feed Space 12 dots Color Specification First color First color, Second color (When using a two-color ribbon cassette ) Page Mode Default Area Not supported Page Mode Maximum Area Not supported Raster Image Monochrome image Logo Not supported Barcode Not supported 2D-Code Not supported Ruled Line Not supported Page Mode Line Not supported Rectangle Paper Cut Cut, Feed cut Drawer Kick-Out Supported Buzzer Not supported Paper Layout Settings Not supported Command Supported 227 228