Tm-I Epos-Print Um en Revk
Tm-I Epos-Print Um en Revk
User’s Manual
Overview
Describes the features and development environment.
Sample Program
Describes how to use the sample program and how
to build a system.
Programming Guide
Describes how to write programs in Web application
development.
ePOS-Print API
Describes the ePOS-Print API.
ePOS-Print Editor
Describes the ePOS-Print Editor.
Appendix
Describes the specifications for printers used for ePOS-Print,
how to use the rendering of images in HTML5 Canvas.
M00042110
Rev.K
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.
Microsoft, Windows, Internet Explorer and Visual Studio 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.
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.
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
In this manual, "ePOS-Print supported printer" is a generic term for the TM-i series and TM printers that support
the ePOS-Print API.
The TM-i series in this manual is a generic term for the following printers.
TM-T88V-i TM-T70-i TM-L90-i
Manual Content
The manual is made up of the following sections:
Chapter 1 Overview
Chapter 2 Sample Program
Chapter 3 Programming Guide
Chapter 4 ePOS-Print API
Chapter 5 ePOS-Print Canvas API
Chapter 6 ePOS-Print Editor
Appendix Printer specifications
Rendering in HTML5 Canvas
Windows Store Apps
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
■ Overview of ePOS-Print ..................................................................................................... 11
Features................................................................................................................................................. 12
Print Example........................................................................................................................................ 13
Print Flow ............................................................................................................................................... 15
Features................................................................................................................................................. 16
■ Operating Environment ..................................................................................................... 17
Applications environment................................................................................................................... 17
Terminal ................................................................................................................................................. 17
ePOS-Print Supported TM printer........................................................................................................ 17
Printers That Can Be Controlled ......................................................................................................... 18
■ System Construction Example .......................................................................................... 19
Registering a Web Application Into the Web Server ....................................................................... 19
Registering a Web Application Into a TM-i ....................................................................................... 20
Registering a Web application to a cloud ....................................................................................... 21
Specifying the Print Job ID from the Application ............................................................................. 22
Spooler Function .................................................................................................................................. 23
■ Contents in the Package................................................................................................... 26
Download ............................................................................................................................................. 27
■ Restrictions.......................................................................................................................... 28
5
Programming Guide.................................................................... 41
■ ePOS-Print API..................................................................................................................... 41
Print Mode .............................................................................................................................................41
Programming Flow................................................................................................................................41
Embedding of ePOS-Print API .............................................................................................................42
Print Document Creation ....................................................................................................................43
Transmission of Print Document...........................................................................................................46
Reception of Print Result......................................................................................................................47
Reception of Status Event ...................................................................................................................49
■ ePOS-Print Canvas API....................................................................................................... 50
Embedding of ePOS-Print Canvas API ...............................................................................................51
Rendering in HTML5 Canvas................................................................................................................52
Prints an Canvas image.......................................................................................................................53
Reception of Print Result......................................................................................................................54
Reception of Status Event ...................................................................................................................56
■ Using the Spooler Function................................................................................................ 57
6
addPageBegin method.................................................................................................................... 106
addPageEnd method ....................................................................................................................... 107
addPageArea method ..................................................................................................................... 108
addPageDirection method .............................................................................................................. 110
addPagePosition method................................................................................................................. 112
addPageLine method....................................................................................................................... 114
addPageRectangle method ........................................................................................................... 116
addCut method................................................................................................................................. 118
addPulse method .............................................................................................................................. 119
addSound method ............................................................................................................................ 121
addLayout method ........................................................................................................................... 123
addRecovery method ...................................................................................................................... 127
addReset method ............................................................................................................................. 128
addCommand method.................................................................................................................... 129
toString method ................................................................................................................................. 130
halftone property............................................................................................................................... 131
brightness property............................................................................................................................ 132
force property .................................................................................................................................... 133
message property.............................................................................................................................. 134
■ ePOS-Print Object ............................................................................................................ 135
Constructor......................................................................................................................................... 135
send method ...................................................................................................................................... 136
getPrintJobStatus method ................................................................................................................ 138
open method ..................................................................................................................................... 139
close method ..................................................................................................................................... 140
address property................................................................................................................................ 141
enabled property .............................................................................................................................. 142
interval property................................................................................................................................. 142
status property ................................................................................................................................... 143
battery property ................................................................................................................................ 143
timeout property ................................................................................................................................ 144
onreceive event................................................................................................................................. 145
onerror event ...................................................................................................................................... 148
onstatuschange event ...................................................................................................................... 149
onbatterystatuschange event ......................................................................................................... 149
ononline event ................................................................................................................................... 150
onoffline event ................................................................................................................................... 150
onpoweroff event .............................................................................................................................. 151
oncoverok event................................................................................................................................ 151
oncoveropen event........................................................................................................................... 152
onpaperok event............................................................................................................................... 152
onpapernearend event.................................................................................................................... 153
onpaperend event ............................................................................................................................ 153
ondrawerclosed event ...................................................................................................................... 154
ondraweropen event ........................................................................................................................ 154
onbatteryok event............................................................................................................................. 155
onbatterylow event ........................................................................................................................... 155
7
ePOS-Print Canvas API .............................................................. 157
■ List of ePOS-Print Canvas API functions.......................................................................... 157
window.epson.CanvasPrint Components .......................................................................................157
■ ePOS-Print Canvas API Object........................................................................................ 159
Constructor .........................................................................................................................................159
print method .......................................................................................................................................160
getPrintJobStatus method.................................................................................................................162
open method......................................................................................................................................163
close method......................................................................................................................................164
recover method..................................................................................................................................165
reset method.......................................................................................................................................165
address property ................................................................................................................................166
enabled property...............................................................................................................................167
interval property .................................................................................................................................168
status property ....................................................................................................................................169
battery property .................................................................................................................................170
timeout property ................................................................................................................................171
halftone property ...............................................................................................................................172
brightness property ............................................................................................................................173
cut property ........................................................................................................................................174
mode property ...................................................................................................................................175
align property .....................................................................................................................................176
color property .....................................................................................................................................177
feed property......................................................................................................................................178
paper property ...................................................................................................................................179
layout property ...................................................................................................................................180
onreceive event .................................................................................................................................185
onerror event ......................................................................................................................................188
onstatuschange event ......................................................................................................................189
onbatterystatuschange event..........................................................................................................190
onbatteryok event .............................................................................................................................191
onbatterylow event ...........................................................................................................................191
ononline event....................................................................................................................................192
onoffline event ....................................................................................................................................192
onpoweroff event ...............................................................................................................................193
oncoverok event ................................................................................................................................193
oncoveropen event ...........................................................................................................................194
onpaperok event ...............................................................................................................................194
onpapernearend event ....................................................................................................................195
onpaperend event ............................................................................................................................195
ondrawerclosed event ......................................................................................................................196
ondraweropen event.........................................................................................................................196
8
Appendix....................................................................................203
■ Printer specifications........................................................................................................ 203
TM-L90-i/ TM-L90 ................................................................................................................................. 203
TM-T70-i/ TM-T70.................................................................................................................................. 205
TM-T70-i (Multi-language model) ..................................................................................................... 206
TM-T88V-i/ TM-T88V............................................................................................................................. 207
TM-P60II................................................................................................................................................ 209
TM-P60II with Peeler ........................................................................................................................... 211
TM-P80 ................................................................................................................................................. 213
TM-T20.................................................................................................................................................. 215
TM-T70 (Multi-language model) ....................................................................................................... 217
TM-T88IV .............................................................................................................................................. 218
TM-T90.................................................................................................................................................. 220
TM-U220 ............................................................................................................................................... 222
■ Rendering in HTML5 Canvas............................................................................................ 224
Rendering Text (canvas-print-text.html) .......................................................................................... 224
Rendering Images (canvas-print-image.html) ............................................................................... 226
Rendering Graphics (canvas-print-graph.html)............................................................................. 228
Rendering Handwritten Images (canvas-print-hand.html)........................................................... 230
Rendering Barcode (canvas-print-barcode.html)......................................................................... 232
Rendering Label (canvas-print-label.html)..................................................................................... 234
■ Windows Store Apps ........................................................................................................ 236
Sample Program Screen ................................................................................................................... 236
Environment of Sample Program ..................................................................................................... 238
Sample Program Settings .................................................................................................................. 239
Printing................................................................................................................................................. 240
9
10
Chapter 1 Overview
Overview
This chapter describes the features of and the specifications for ePOS-Print API.
Overview of ePOS-Print
ePOS-Print API is a function used to allow printing to ePOS-Print-supported printers under a multi-platform
environment. Printing is available from a Web browser on devices such as computers, smart phones and
tablets.
In addition, print images rendered in HTML5 Canvas can be printed.
1
ePOS-Print API provides the API for print commands.
When a print document (Request) is sent via HTTP from the host to the ePOS-Print Service of a ePOS-Print
supported TM printer, ePOS-Print processes the printing of that document and returns a response document
(Response).
Web Server
Internet
Intranet
TM-i web server
Web Browser
Web Page
HTML
CSS (Request)
JavaScript ePOS-Print supported TM printer
11
Features
❏ As long as it is in a network environment, a terminal with an HTML5-supported Web browser can perform
printing from anywhere.
❏ It supports Windows store apps (JavaScript).
❏ Installation of drivers and plug-ins is not required.
❏ No PCs or servers are required for printing.
❏ Allows printing from public and private clouds.
❏ Allows printing in languages supported in Web browsers.
❏ Automatically checks the status of the TM printer before printing. There is no need for checking the status
of the TM printer in advance.
❏ Does not respond to a printer's function to automatically send its status (AutoStatusBack). Instead, capa-
ble of sending an empty print command and checking the status of the TM printer based on the result of
command transmission.
❏ 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.22).
❏ 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.23).
❏ 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.25).To change the printer settings, utility programs dedicated to each
printer or other utility programs should be used.
❏ In case of TM-i series, it can print to other TM printer via TM-i.
❏ Provides ePOS-Print API and ePOS-Print Canvas API.
<<ePOS-Print API>>
Allows device fonts to be used for printing.
Allows barcode printing.
<<ePOS-Print Canvas API>>
Allows printing of images rendered in HTML5 Canvas.
Allows TrueType fonts to be used for printing.
12
Chapter 1 Overview
Print Example
ePOS-Print API
Printing a Logo
Alignment: Center
Paper Feed
Printing a Barcode
13
ePOS-Print Canvas API
Monochrome or Grayscale
Monochrome
14
Chapter 1 Overview
Print Flow
<Web Server>
1
Application
Wireless LAN /
Router
15
Features
The installed functions vary depending on the model. For details, refer to Printer
specifications(p.203).
ePOS-Print API contains the following printing methods. These may be used successively within a single
document, however, they cannot be used simultaneously.
16
Chapter 1 Overview
Operating Environment
Applications environment
❏ HTML5-supported Web browser
Windows Internet Explorer 9 or later
From Internet Explorer, Web pages (HTTPS) that are securely protected cannot be printed on the TM
printer.
Mozilla Firefox 3.6 or later
Google Chrome 7 or later
Safari in iOS4.0 or later 1
Standard browser in Android 2.2 or later
❏ Windows Store apps
JavaScript project
Terminal
Terminal with an HTML5-supported Web browser
TM-i Series
❏ TM-T88V-i
❏ TM-T70-i
❏ TM-L90-i
TM Printer
When using the following printers, use ePOS-Print SDK for JavaScript:
❏ TM-P60II
❏ TM-P60II with Peeler
❏ TM-P80
17
ePOS-Print Service Versions
The table below shows the relationship between the ePOS-Print Service version and TM-i Firmware version of
the TM-i series.
If API of newly added ePOS-Print Builder is used on unsupported models, schema error is
returned and printing cannot be done. The latest version of ePOS-Print API JavaScript is
recommended regardless of ePOS-Print Service version installed on a printer. ePOS-Print API
JavaScript. is bundled with the sample program.
For details, refer to "Contents in the Package" on page 26.
18
Chapter 1 Overview
<Web Server>
1
<Printers That Can Be Controlled>
Web
Application
Wireless LAN /
Router
<Terminal>
Web Browser
"
Wireless
Device Control
Network
<TM-i>
❏ Web Server
A Web application is placed.
❏ Terminal
Executes the Web application using a browser (HTML5-supported Web browser).
❏ TM-i
Receives/prints print data sent from the Web browser or controls other devices.
❏ Printers That Can Be Controlled
Print the print data received from the TM-i.
19
Registering a Web Application Into a TM-i
Wireless LAN /
Router
<Terminal>
Web Browser
Wireless
Web
Application
Device Control
<TM-i> Network
❏ Terminal
Executes the Web application using a browser.
❏ TM-i
Mounts the Web application. Creates and prints the print data using transmission with the input terminal's
Web browser.
20
Chapter 1 Overview
<Web Server>
1
Web
Application
Wireless LAN /
Router
<Terminal>
Web Browser
<TM Printer>
(Wireless LAN Model)
Wireless
Device Control
Network
❏ Terminal
Executes the Web application using a browser.
❏ TM Printer (Wireless LAN Model)
21
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-Print Service Ver.4.1 or later versions)
Job ID : ABC123
Job ID : ABC123
Print data
Response data
22
Chapter 1 Overview
Spooler Function
The spooler function is a function used to temporarily store printing data received from the application in
the TM-i to carry out background printings sequentially. (TM-i firmware Ver.4.1 or later versions)
TM-i 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-i.
Settings to enable the spooler
Print process retry settings
1
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.25).
Example
<Print Data>
1 Send print data A to a TM-i (ePOS-Print Service I/F) from the input terminal.
2 The TM-i will save the print data A to the spooler and will return response data to
the input terminal.
3 The TM-i will retrieve the print data and issue a print command to another TM-i
printer.
23
4 Print data B will be sent to the TM-i from the input terminal.
5 The TM-i will save the print data B to the spooler and will return response data to
the input terminal.
6 The TM-i will retrieve the print data B and issue a print command to printer A.
8 A query on print data A results will be sent to the TM-i from the input terminal.
9 The TM-i will return response data back to the input terminal signifying that print
data A completed without error.
24
Chapter 1 Overview
Forwarding
EPSON TMNet WebConfig is used to configure forwarding settings. For details, refer to the
Technical Reference Guide for each TM-i.
<TM-i>
1
<Input Terminal>
1 Send print data to ePOS-Print Service I/F from the input terminal.
5 Print data sent from the input terminal will be printed using printer B.
25
Contents in the Package
Manual
❏ ePOS-Print API User’s Manual (This Document)
❏ ePOS-Print XML User’s Manual
❏ TM-T88V-i Technical Reference Guide
❏ TM-T70-i Technical Reference Guide
❏ TM-L90-i Technical Reference Guide
❏ TM-P60II Technical Reference Guide
❏ TM-P80 Technical Reference Guide
Sample Program
ePOS-Print_Sample_API_V4.x.xE.zip
The following are included:
❏ epos-print-4.x.x.js (ePOS-Print JavaScript for embedding)
❏ sample/index.html (Sampleprogram)
❏ editor/index.html (ePOS-Print Editor)
❏ win8/ePOS-Print Demo.zip (Windows Store apps sample program)
❏ Rendering in HTML5 Canvas
canvas/canvas-print-text.html(Rendering text)
canvas/canvas-print-image.html(Rendering images)
canvas/canvas-print-graph.html(Rendering graphics)
canvas/canvas-print-hand.html(Rendering handwritten images)
canvas/canvas-print-barcode.html(Rendering barcode)
canvas/canvas-print-label.html(Rendering label)
❏ README.txt
Utility
❏ TM-i Series
26
Chapter 1 Overview
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
27
Restrictions
❏ The drawer and the buzzer cannot be used together.
❏ The buzzer function cannot be used if the printer is not provided with the buzzer.
❏ Internet Explorer 9 does not allow printing to the printer to be performed from security-protected Web
pages (HTTPS).
❏ When multiple tones are set for raster images, intermitting printing may occur because the amount of
data to print increases and white stripes may appear in the print result.
❏ The scan quality of barcodes/two-dimensional symbols printed as multiple-tone raster images cannot be
guaranteed. Print them as two-tone images.
❏ If printing was cancelled, perform the following settings to clear the data left in the printer.
In the printer DIP switches (memory switches), configure the Busy condition only for the receive buffer
full.
Disable the command execution (offline). (TM-P60II, TM-P80)
28
Chapter 2 Sample Program
Sample Program
This chapter describes how to use the sample program.
• In this chapter, descriptions are made based on a system configuration using a Web server.
• Descriptions are made assuming that the Web server in this chapter is a Web server configured
by using IIS (Microsoft Internet Information Services). If your Web server is used in a different
environment, interpret the descriptions accordingly.
2
The screen compositions for the sample program are as follows:
Item Description
Prints queue ticket numbers.
1 Queue Ticket
This is a sample program using the ePOS-Print API.
Prints coupons.
2 Coupon This is a sample program using the ePOS-Print Canvas
API.
Prints labels.
3 Label
This is a sample program using the ePOS-Print API.
29
Item Description
Displays the "Settings" screen. The screen is used to set
the following:
IP address of the ePOS-Print supported TM printer
(Default :
TM-i: DHCP
(If an address fails to be assigned via DHCP, the
value becomes "192.168.192.168".)
TM Printer:
192.168.192.168
4 Settings
)
Device ID of the target printer
(Default : local_printer)
Print timeout( milliseconds )
(Default : 60000)
Prints coupons in gray scale (Coupon)
(Default : No)
Prints labels with specified layout (Label)
(Default: No)
30
Chapter 2 Sample Program
Print Image
The sample program prints the following:
Your Number:
2
Label *
(ePOS-Print API)
Name
Item A
Color Red
Code
*2012001*
*: Die cut label: mount width 58 mm or above
Label size: width 54 mm x height 25.4 mm or above
31
Program Flow
From its initial display state up to print job completion, the sample program flows as below.
2. Settings
❏ Settings of IP address of ePOS-Print supported TM printer
❏ Device ID of the printer to be controlled
❏ Print timeout time
32
Chapter 2 Sample Program
2. Settings
❏ Settings of IP address of ePOS-Print supported TM printer
❏ Device ID of the printer to be used for printing
❏ Print timeout time
3. Click “Coupon”
2
4. Render in HTML5 Canvas
33
Label issuance (ePOS-Print API)
2. Settings
❏ Settings of IP address of ePOS-Print supported TM printer
❏ Device ID of the printer to be controlled
❏ Print timeout time
❏ Settings of with or without layout specification in label printing of TM-P60II
3. Click "Label"
34
Chapter 2 Sample Program
Operating Environment
TM-i
The system configuration diagram for the sample programs is as below.
• The figure below also describes an example of IP address settings as network settings.
• In the sample program, "Printer to be controlled" is not required. Refer to it if necessary.
Wireless
Web Server
Computer to configure the settings
[192.168.192.10] Network
2
Printer to be controlled
[192.168.192.21]
Terminal
[192.168.192.XXX] *
TM-i
[192.168.192.20]
35
Environment Settings
A flow for configuring the environment settings for the sample program is shown as follows:
1. Router Settings
Configure the settings such as SSID, IP address, DHCP, and allocated IP address. For
details, refer to the manual for the device you are using.
2. Computer Settings
1. Network Settings
Configure the network settings for the computer such as IP address.
4. Terminal settings
Configure the wireless LAN (Wi-Fi) settings of the terminal to match the router settings so as to
enable network connection. For details, refer to the manual for the device you are using.
36
Chapter 2 Sample Program
7. Device ID Settings
Configure the settings for the computer by using EPSON TMNet WebConfig from a Web browser.
For the configuration procedure, refer to Technical Reference Guide for each TM-i.
(these settings are not required in this sample program)
2
9. Sample Program Settings (p.39)
Configuration is done from a Web browser(these settings are not required in this sample program).
37
Registration of Sample Program
Register the sample program into the Web server.
Download ePOS-Print_Sample_API_V4.x.xE.zip.
For details, refer to Contents in the package (p. 26).
38
Chapter 2 Sample Program
In the sample program, "Device ID Settings" are not required. Refer to it if necessary.
2 Connect all the printers to the network and turn their power ON.
39
5 The “Settings” screen appears. Specify the following and click [OK].
Item Description
Specifies the IP address of the ePOS-Print supported TM
printer.
(Default value:
TM-i: DHCP
IP address of the intelligent printer
(If an address fails to be assigned via DHCP, the
value becomes "192.168.192.168".)
TM Printer: 192.168.192.168
)
Specifies the Device ID of the printer to print queue
Device ID of the target printer ticket numbers and coupons. (Default value:
local_printer)
Print timeout (millisecond) Specifies the timeout time. (default : 60000)
Print in grayscale (Coupon) Prints coupons in gray scale. (Default: No)
(Only for supported models)
Set the paper layout (Label) Prints labels with specified layout (Default: No)
(Only for TM-P60II)
40
Chapter 3 Programming Guide
Programming Guide
This chapter describes how to write programs in the application development using ePOS-Print.
ePOS-Print API
Print Mode
There are two types of print modes: standard and page modes.
Standard mode
In standard mode, characters are printed line by line. The line feed space is adjusted based on the font size
and the height of images, barcodes, etc. This mode is suitable for the type of printing such as printing
receipts that requires the paper length to change according to the print space.
Page mode
In page mode, you set a print area, lay out data in it, and print the data in a batch operation. Characters,
images, and barcodes are laid out in the print positions (coordinates).
3
Programming Flow
For the ePOS-Print API, programming is performed based on the following work flow:
• ePOS-Print supported TM printer checks the status of the TM printer to be used for printing and
then starts printing operation.
• A status event helps check the status of the TM printer. For details on the procedure, refer to
Reception of Status Event (p. 49).
41
Embedding of ePOS-Print API
The ePOS-Print API is provided so that ePOS-Print can be used from the JavaScript on the client side.
It is provided as JavaScript, and its file name is “epos-print-4.x.x.js”.
The ePOS-Print API is used by embedding epos-print-4.x.x.js into applications.
Preparation
To use the ePOS-Print API, place epos-print-4.x.x.js on the Web server.
<!DOCTYPE html>
<html>
<head> Embed
<meta charset="utf-8" />
<title>TITLE</title>
<script type="text/javascript" src="epos-print-4.x.x.js"></script>
<script type="text/javascript">
function buildMessage() {
var builder = new epson.ePOSBuilder();
.
.
}
</script>
</head>
<body>
.
.
</body>
</html>
42
Chapter 3 Programming Guide
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>TITLE</title>
<script type="text/javascript" src="epos-print-4.x.x.js"></script>
<script type="text/javascript">
function buildMessage() {
//Create an ePOS-Print Builder object
var builder = new epson.ePOSBuilder();
//Create a print document
builder.addTextLang('en')
builder.addTextSmooth(true);
builder.addTextFont(builder.FONT_A); Create a print document
builder.addTextSize(3, 3);
builder.addText('Hello,\tWorld!\n');
builder.addCut(builder.CUT_FEED);
3
//Acquire the print document
var request = builder.toString();
alert(request);
}
</script>
</head>
<body>
<button onclick=”buildMessage()”>Run</button>
</body>
</html>
43
To create a text print document:
To create a text print document, store the font settings into the command buffer using text methods and
then create a print document. Refer to the following program.
For the string "Hello World!", to create a print document based on the following settings:
❏ Font: FontA
❏ Scale: x 4 (horizontal) and x 4 (vertical)
❏ Style: Bold
This section describes how to print a raster image. In addition, there is also a method of printing
graphics registered in the NV memory of the printer. For details, refer to addLogo method (p.90).
44
Chapter 3 Programming Guide
For the string "Hello World!", to create a print document based on the following settings:
<script type="text/javascript" src="epos-print-4.x.x.js"></script>
<script type="text/javascript">
function buildMessage() {
//Create an ePOS-Print Builder object
var builder = new epson.ePOSBuilder();
//Create a print document
//<The page mode starts>
builder.addPageBegin();
//<Specify the page mode print area>
builder.addPageArea(100, 50, 200, 100);
//<Specify the page mode print position>
builder.addPagePosition(0, 42);
//<Specify the print data>
builder.addTextLang('en');
builder.addTextFont(builder.FONT_A);
builder.addTextSize(4, 4);
3
builder.addTextStyle(false, false, true, undefined);
builder.addText('Hello,\tWorld!\n');
//<The page mode ends>
builder.addPageEnd();
builder.addCut(builder.CUT_FEED);
//Acquire the print document
var request = builder.toString();
}
</script>
45
Transmission of Print Document
A print document is sent using an ePOS-Print object.
Create an ePOS-Print object using the constructor and specify the end point address for the printer to be
used for printing as well as the print document into the send method to send the document.
For the details about the printer end point address, refer to Printer End Point Address (p.46).
Refer to the following program.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>TITLE</title>
<script type="text/javascript" src="epos-print-4.x.x.js"></script>
<script type="text/javascript">
function buildMessage() {
//Create a print document
var builder = new epson.ePOSBuilder();
builder.addTextLang('en');
builder.addTextSmooth(true);
builder.addTextFont(builder.FONT_A);
builder.addTextSize(3, 3);
builder.addText('Hello,\tWorld!\n');
builder.addCut(builder.CUT_FEED); Transmission of print document
var request = builder.toString();
46
Chapter 3 Programming Guide
The printer status can be obtained when communication with the printer is possible.
Refer to the following program. For the details about how to program a callback function in detail, refer to
Error handling (p.48).
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>TITLE</title>
<script type="text/javascript" src="epos-print-4.x.x.js"></script>
<script type="text/javascript">
function buildMessage() {
//Create a print document
var builder = new epson.ePOSBuilder();
builder.addTextLang('en');
3
builder.addTextSmooth(true);
builder.addTextFont(builder.FONT_A);
builder.addTextSize(3, 3);
builder.addText('Hello,\tWorld!\n');
builder.addCut(builder.CUT_FEED);
var request = builder.toString();
47
Error handling
Refer to the following program for the error handling method by a callback function.
48
Chapter 3 Programming Guide
49
ePOS-Print Canvas API
For the ePOS-Print Canvas API, programming is performed based on the following work flow:
• ePOS-Print supported TM printer starts printing after checking the status of TM printer.
• A status event helps check the status of the TM printer. For details on the procedure, refer to
Reception of Status Event (p. 49).
50
Chapter 3 Programming Guide
Preparation
To use the ePOS-Print Canvas API, place epos-print-4.x.x.js on the Web server.
<!DOCTYPE html>
<html>
<head> Embed
<meta charset="utf-8" />
<title>TITLE</title>
<script type="text/javascript" src="epos-print-4.x.x.js"></script>
<script type="text/javascript">
function drawCanvas() {
.
.
}
</script>
</head>
<body>
.
3
.
</body>
</html>
51
Rendering in HTML5 Canvas
Render an image in HTML5 Canvas.
<!DOCTYPE html>
<html>
<head> Rendering in HTML5 Canvas
<meta charset="utf-8" />
<title>TITLE</title>
<script type="text/javascript" src="epos-print-4.x.x.js"></script>
<script type="text/javascript">
function drawCanvas() {
// Rendering in HTML5 Canvas
//<Obtain the context>
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
//<Render an image>
context.clearRect(0, 0, 512, 480);
context.drawImage(document.getElementById('coffee'), 0, 0
, 512, 384);
context.fillStyle = 'rgba(255, 255, 255, 0.5)';
context.fillRect(0, 0, 512, 480);
context.fillStyle = 'rgba(0, 0, 0, 1.0)';
//<Render a water mark for the image>
context.drawImage(document.getElementById('wmark'), 0, 0);
context.drawImage(document.getElementById('wmark'), 256, 324);
//<Render text>
context.textAlign = 'center';
context.textBaseline = 'alphabetic';
context.font = 'bold normal normal 48px "Times New Roman", serif';
context.fillText('FREE Coffee', 256, 224);
}
</script>
</head>
<body>
<button onclick="drawCanvas()">Run</button>
<canvas id="myCanvas" width="512" height="480"></canvas>
<img id="coffee" src="img/coffee.jpg" alt="">
<img id="wmark" src="img/wmark.png" alt="">
</body>
</html>
52
Chapter 3 Programming Guide
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>TITLE</title>
<script type="text/javascript" src="epos-print-4.x.x.js"></script>
<script type="text/javascript">
function drawCanvas() {
// Rendering in HTML5 Canvas
//<Obtain the context>
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
.
. Transmission of print document
.
For the details about the printer end point address, refer to Printer End Point Address (p.46).
53
Reception of Print Result
The print result can be received by setting a callback function using the onreceive property (p. 145) of the
ePOS-Print Canvas API object. The following information is obtained:
❏ Print result
❏ Error code
❏ Printer Status
The printer status can be obtained when communication with the printer is possible.
Refer to the following program. For the details about how to program a callback function in detail, refer to
Error handling (p.48).
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>TITLE</title>
<script type="text/javascript" src="epos-print-4.x.x.js"></script>
<script type="text/javascript">
function drawCanvas() {
// Rendering in HTML5 Canvas
//<Obtain the context>
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
.
.
.
54
Chapter 3 Programming Guide
Error handling
Refer to the following program for the error handling method by a callback function.
}
msg += ' Waiting for online recovery\n'; 3
if (asb & epos.ASB_PANEL_SWITCH) {
msg += ' Panel switch is ON\n';
}
if (asb & epos.ASB_MECHANICAL_ERR) {
msg += ' Mechanical error generated\n';
}
if (asb & epos.ASB_AUTOCUTTER_ERR) {
msg += ' Auto cutter error generated\n';
}
if (asb & epos.ASB_UNRECOVER_ERR) {
msg += ' Unrecoverable error generated\n';
}
if (asb & epos.ASB_AUTORECOVER_ERR) {
msg += ' Auto recovery error generated\n';
}
if (asb & epos.ASB_RECEIPT_NEAR_END) {
msg += ' No paper in the roll paper near end detector\n';
}
if (asb & epos.ASB_RECEIPT_END) {
msg += ' No paper in the roll paper end detector\n';
}
if (asb & epos.ASB_BUZZER) {
msg += ' Sounding the buzzer (limited model)\n';
}
if (asb & epos.ASB_SPOOLER_IS_STOPPED) {
msg += ' Stop the spooler\n';
}
//Display in the dialog box
alert(msg);
}
55
Reception of Status Event
The status event notification function is used to check the printer status without printing. Refer to the
following.
56
Chapter 3 Programming Guide
1 : send()
1.1 : Cmd()
1.1.1 : Print()
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-Print Service I/F from the
application when the spooler function is enabled.
1 : send(printjobid)
1.1 : send() 3
1.2 : Execution result
1.3 : callback(” success” )
2 : Cmd()
2.1 : Print()
Print result
3 : getPrintJobStatus(printjobid)
3.1 : getPrintJobStatus()
57
Even if the output printer cannot complete the printing task, ePOS-Print 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.
1 : send(printjobid)
1.1 : send()
2 : Cmd()
2.1 : Print()
58
Chapter 3 Programming Guide
Programming Example
A response containing the specified print job ID will be returned when the spooler function is enabled.
ePOS-Print 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.
function sendJob() {
var builder = new epson.ePOSBuilder();
builder.addText('Hello, World!\n');
builder.addCut();
var request = builder.toString();
function getJobStatus() {
if (printjobid.length > 0) {
var address = 'http://192.168.192.168/cgi-bin/epos/service.cgi';
var epos = new epson.ePOSPrint(address);
3
epos.onreceive = function (res) { alert(res.success); };
epos.onerror = function (err) { alert(err.status); };
epos.getPrintJobStatus(printjobid);
}
}
59
60
Chapter 4 ePOS-Print API
ePOS-Print API
This chapter describes the ePOS-Print API.
window.epson.ePOSBuilder Components
Stan-
Elem- page Pa-
API Description dard
ent mode ge
mode
Constructor
Initializes an ePOS-Print XML Builder
ePOS Builder ● ● 66
object
Method
Adds a tag for the text alignment
addTextAlign ● - 67
setting.
addText- Adds a tag for the line feed space
LineSpace
addTextRotate
setting.
Adds a tag for the text rotation set-
●
●
●
-
68
69
4
ting.
addText Adds a tag for printing text. ● ● 70
Adds a tag for the target language
addTextLang ● ● 71
setting.
addTextFont Adds a tag for the text font setting. ● ● 74
Text
Adds a tag for the text smoothing
addTextSmooth ● ● 75
setting.
Adds a tag for specifying the dou-
addTextDouble ● ● 76
ble-sized text setting.
addTextSize Adds a tag for the text scale setting. ● ● 78
addTextStyle Adds a tag for the text style setting. ● ● 79
Adds a tag for specifying the print
addTextPosition ● ● 81
position of text.
addTextVPosi- Adds a tag for specifying the print
- ● 82
tion *3 vertical position of text.
61
Stan-
Elem- page Pa-
API Description dard
ent mode ge
mode
Method
Adds a tag for paper feeding (in
addFeedUnit ● ● 83
dots).
Adds a tag for paper feeding (in
addFeedLine ● ● 84
Paper lines).
Feed addFeedPosition Adds control of label paper/black
● - 85
*1 mark paper to command buffer
Adds a line feed to the command
addFeed ● - 87
buffer.
Adds a tag for a raster image to be
addImage ● ● 88
Graphi- printed.
c Adds a tag for an NV logo to be
addLogo ● ● 90
printed.
Adds a tag for a bar code to be
addBarcode ● ● 91
Bar- printed.
code Adds a tag for a two-dimensional
addSymbol ● ● 96
code to be printed.
Adds a tag for a horizontal line to be
addHLine ● - 102
printed.
Ruled
addVLineBegin Adds a tag for starting a vertical line. ● - 104
line
Adds a tag for finishing a vertical
addVLineEnd ● - 105
line.
Adds a tag for switching to page
addPageBegin ● - 106
mode.
addPageEnd Adds a tag for finishing page mode. ● - 107
Adds a tag for specifying the print
addPageArea - ● 108
area in page mode.
addPageDirec- Adds a tag for specifying the print
Page- - ● 110
tion direction in page mode.
mode
Adds a tag for specifying the print
addPagePosition - ● 112
position in page mode.
Adds a tag for drawing a line in
addPageLine - ● 114
page mode.
addPageRect- Adds a tag for drawing a rectangle
- ● 116
angle in page mode.
Cut addCut Adds a tag for paper cut. - ● 118
Drawer
kick- addPulse Adds a tag for the drawer kick-out. ● - 119
out
Buzzer addSound Adds a tag for turning on the buzzer. ● - 121
Adds the paper layout setup to
Layout addLayout *2 ● - 123
command buffer
Recov- Adds a tag for recovering from an
addRecovery *3 ● - 127
ery error.
Reset addReset *3 Adds a tag for resetting the printer. ● - 128
62
Chapter 4 ePOS-Print API
Stan-
Elem- page Pa-
API Description dard
ent mode ge
mode
Method
Send
Adds commands to the command
Com- addCommand ● ● 129
buffer. Sends ESC/POS commands.
mand
Create
Obtains a print document gener-
a Print
toString ated by on ePOS-Print Builder ● - 130
Docu-
object.
ment
63
Numerical values to be set to parameters
In the ePOS-Print Builder object API, numerical values are set to some parameters. Set values with the
following in mind:
❏ Unit
Specify numbers in dots for units that represent length.
(Print position, paper feed space, width and height of images and barcodes, etc.)
❏ Range
Depending on the printer specifications, a specifiable range is predetermined. For details, refer to Printer
specifications (p.203).
❏ Resolution
The resolution varies depending on the printer. It affects the actual print size. The higher the resolution is,
the smaller the print size becomes, and vice versa. For each printer's resolution, refer to Printer specifica-
tions (p.203).
64
Chapter 4 ePOS-Print API
window.epson.ePOSPrint Components
65
ePOS-Print Builder Object
This objects creates a print document for printer control commands that specify strings or graphics to be
printed, paper cut, etc.
Constructor
Constructor for an ePOS-Print Builder object.
Creates a new ePOS-Print Builder object and initializes it.
Syntax
ePOSBuilder();
Example
66
Chapter 4 ePOS-Print API
addTextAlign method
Adds the text alignment setting to the command buffer.
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
Return value
Example
67
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
Exception
Example
68
Chapter 4 ePOS-Print API
addTextRotate method
Adds the text rotation setting to the command buffer.
Syntax
addTextRotate(rotate);
Parameter
rotate : ( Required parameter, Object type : Boolean)
Specifies whether to rotate text.
Setting Description
true or 11 Specifies rotated printing of text.
false or 0 (default) Cancels rotated printing of text.
Return value
Exception
4
Exception Object type
Parameter " ... " is invalid Error
Example
69
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.203).
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
Exception
Example
70
Chapter 4 ePOS-Print API
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)
Japanese
ja
(International character set changes to Japan.)
Japanese
ja-jp
(International character set changes to Japan.)
Korean
ko
(International character set changes to Korean.)
Korean
ko-kr
(International character set changes to Korean.)
zh-hans *
Simplified Chinese
(International character set changes to China.) 4
Simplified Chinese
zh-cn
(International character set changes to China.)
zh-hant * Traditional Chinese
zh-tw Traditional Chinese
Language code besides above English(ANK)
For printable character code, refer to the Technical Reference Guide of your
printer.
71
Depending on language specification, a part of characters is printed as follows.
Return value
Exception
Example
72
Chapter 4 ePOS-Print API
73
addTextFont method
Adds the text font setting to the command buffer.
Syntax
addTextFont(font);
Parameter
font : ( Required parameter, Object type : String)
Specifies the font.
*
ePOS-Print Service Ver.3.2 or later versions supported
Return value
Exception
Example
74
Chapter 4 ePOS-Print API
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 or 1 Specifies smoothing.
false or 0 (default) Cancels smoothing
Return value
Exception
Example
To enable smoothing:
4
<script type="text/javascript" src="epos-print-4.x.x.js"></script>
<script type="text/javascript">
<!--
function buildMessage() {
var builder = new epson.ePOSBuilder();
builder.addTextSmooth(true);
}
//-->
</script>
75
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 Description
true or 1 Specifies the double-sized width.
false or 0 (default) Cancels the double-sized width
undefined
Retains the current setting for double-sized width.
(When not specified)
Setting Description
true or 1 Specifies the double-sized height
false or 0 (default) Cancels the double-sized height
undefined
Retains the current setting for double-sized height
(When not specified)
When true or 1 is set for both the dw and dh parameters, double width and height characters are
printed.
Return value
Exception
76
Chapter 4 ePOS-Print API
Example
77
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 Description
Integer from 1 to 8 Horizontal scale (default : 1)
undefined
Retains the current setting for the horizontal scale.
(When not specified)
Setting Description
Integer from 1 to 8 Vertical scale (default : 1)
undefined
Retains the current setting for the vertical scale.
(When not specified)
Return value
Exception
Example
78
Chapter 4 ePOS-Print API
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 Description
Specifies the inversion of black and white parts
true or 1
of characters.
Cancels the inversion of black and white parts
false or 0 (default)
of characters.
undefined Retains the current setting for inversion of black
(When not specified) and white.
Setting Description
true or 1 Specifies underlining.
false or 0 (default) Cancels underlining.
undefined
Retains the current underlining setting.
em :
(When not specified)
Setting Description
true or 1 Specifies emphasized printing of characters.
false or 0 (default) Cancels emphasized printing of characters.
undefined Retains the current setting for emphasized print-
(When not specified) ing.
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
Retains the current color setting
(When not specified)
79
Return value
Exception
Example
80
Chapter 4 ePOS-Print API
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
Exception
Example
To set the print position at 120 dots from the left end:
81
addTextVPosition method
Adds the vertical print start position of text to the command buffer. (in ePOS-Print Service Ver.3.0 and later)
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
Exception
Example
82
Chapter 4 ePOS-Print API
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
Exception
Example
83
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
Exception
Example
84
Chapter 4 ePOS-Print API
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
Exception 4
Exception Object type
Parameter " ... " is invalid Error
85
Example
86
Chapter 4 ePOS-Print API
addFeed method
Adds a line feed to the command buffer.
Syntax
addFeed();
Return value
Example
87
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.
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.
• To print a raster image at high speed, specify ALIGN_LEFT for the addTextAlign method (p.
67), 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.
• Multiple tone printing is not supported in Page Mode. Multiple tone graphic printing is supported
in Standard Mode only.
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 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
First color
(When not specified)
88
Chapter 4 ePOS-Print API
Setting Description
MODE_MONO Monochrome (two-tone)
MODE_GRAY16 Gray scale (16-tone)
undefined
Monochrome (two-tone)
(When not specified)
Return value
Exception
Example
To print an image 300 dots wide and 300 dots high in page mode:
89
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.
• Multiple tone printing is not supported in Page Mode. Multiple tone graphic printing is supported
in Standard Mode only.
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
Exception
Example
90
Chapter 4 ePOS-Print API
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.
91
Barcode type Description
Start and stop characters are automatically added.
CODE93
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.
CODE128 To encode each of the following characters, specify two
characters starting with the character "{":
< How to specify special characters >*1
< How to specify CODE C >*2
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
GS1-128 characters and are not encoded as data.
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 "{":
< How to specify special characters >*3
< How to specify CODE C >*2
GS1 DataBar Omnidi-
rectional Specify a 13-digit global trade item number (GTIN) not
GS1 DataBar Truncated including an application identifier (AI) or a check digit.
GS1 DataBar Limited
You can enclose an application identifier (AI) in
parentheses. The parentheses are used as HRI print
GS1 Databar characters and are not encoded as data.
Expanded To encode each of the following characters, specify two
characters starting with the character "{":
< How to specify special characters >*4
92
Chapter 4 ePOS-Print API
To specify binary data that cannot be represented by character strings, use the following escape
4
sequences.
String Description
\xnn Control code
\\ Back slash
93
type : ( Required parameter, Object type : String)
Specifies the barcode type.
Return value
94
Chapter 4 ePOS-Print API
Exception
Example
To print barcodes:
}
builder.addBarcode('(01)2012345678903',
builder.BAROCDE_GS1_DATABAR_EXPANDED); 4
//-->
</script>
95
addSymbol method
Adds two-dimensional symbol printing to the command buffer.
In page mode, a two-dimensional symbol 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 two-dimensional symbol data as a character string.
96
Chapter 4 ePOS-Print API
97
To specify binary data that cannot be represented by character strings, use the following escape
sequences.
String Description
\xnn Control code
\\ Back slash
98
Chapter 4 ePOS-Print API
99
height : ( Optional parameter, Object type : Number)
Specifies the module height. Specifies an integer from 0 to 255.
Return value
Exception
100
Chapter 4 ePOS-Print API
Example
101
addHLine method
Adds horizontal line printing to the command buffer.
Draws horizontal lines.
Syntax
addHLine(x1, x2, style);
Parameter
x 1: ( 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.
Return value
Exception
102
Chapter 4 ePOS-Print API
Example
103
addVLineBegin method
Adds the beginning of vertical line to the command buffer. Starts to draw vertical lines.
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.
Return value
Exception
Example
To draw thin vertical lines at 100 dots and 200 dots from the left end:
104
Chapter 4 ePOS-Print API
addVLineEnd method
Adds the end of vertical line to the command buffer. Finishes drawing vertical lines.
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.
Return value 4
Return value Object type
ePOS-Print Builder Object ePOS Builder
Exception
Example
To draw thin vertical lines at 100 dots and 200 dots from the left end:
105
addPageBegin method
Adds the switching to page mode to the command buffer. The page mode process starts.
Vertical lines are processed in page mode until their end is specified by addPageEnd (p. 107). Use
this API function with addPageEnd.
Syntax
addPageBegin();
Return value
Example
106
Chapter 4 ePOS-Print API
addPageEnd method
Adds the end of page mode to the command buffer. The page mode process ends.
Syntax
addPageEnd();
Return value
Example
107
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. 106) and addPageEnd (p. 107).
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
Exception
108
Chapter 4 ePOS-Print API
Example
To specify the print area with the origin (100, 50), a width of 200 dots, and a height of 30 dots and print
the characters "ABCDE":
109
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. 106) and addPageEnd (p. 107).
Syntax
addPageDirection(dir);
Parameter
dir : ( Required parameter, Object type : String)
Specifies the print direction in page mode.
Return value
Exception
110
Chapter 4 ePOS-Print API
Example
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. 106) and addPageEnd (p. 107).
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 two-dimensional symbol:
Specify the top left of the symbol. This can be omitted when printing from the top left.
Return value
Exception
112
Chapter 4 ePOS-Print API
Example
To specify (50,30) for the print start position in the area specified by the addPageArea method and
print the characters "ABCDE":
113
addPageLine method
Adds line drawing in page mode to the command buffer. Draws a line in page mode.
Syntax
addPageLine(x1, y1, x2, y2, style);
Parameter
x 1: ( Required parameter, Object type : Number)
Specifies the horizontal start position of the line (in dots). Specifies an integer from 0 to 65535.
y 1: ( 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)
ècSpecifies 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.
Return value
Exception
114
Chapter 4 ePOS-Print API
Example
To draw a thin solid line between the start position (100, 0) and the end position (500, 0):
115
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. 106) and addPageEnd (p. 107).
Syntax
addPageRectangle(x1, y1, x2, y2, style);
Parameter
x 1: ( Required parameter, Object type : Number)
Specifies the horizontal start position of the line (in dots). Specifies an integer from 0 to 65535.
y 1: ( 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)
ècSpecifies 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.
Return value
Exception
116
Chapter 4 ePOS-Print API
Example
To draw a rectangle with a thin double line, with the start position (100, 0) and the end position (500,
200) as its vertexes:
117
addCut method
Adds paper cut to the command buffer. Sets paper cut.
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.)
Return value
Exception
Example
118
Chapter 4 ePOS-Print API
addPulse method
Adds the drawer kick to the command buffer. Sets the drawer kick.
Syntax
addPulse(drawer, time);
Parameter
drawer : ( Optional parameter, Object type : String)
Specifies the drawer kick connector.
Setting Description
DRAWER_1 Pin 2 of the drawer kick-out connector
DRAWER_2 Pin 5 of the drawer kick-out connector
undefined
Pin 2 of the drawer kick-out connector
(When not specified)
Setting Description
PULSE_100 100 ms
PULSE_200 200 ms
PULSE_300
PULSE_400
300 ms
400 ms
4
PULSE_500 500 ms
undefined
100 ms
(When not specified)
Return value
Exception
119
Example
To send a 100 msec pulse signal to the pin 2 of the drawer kick connector:
120
Chapter 4 ePOS-Print API
addSound method
Adds the turning on of the buzzer to the command buffer. Sets the buzzer.
Syntax
addSound(pattern, repeat, cycle);
Parameter
pattern : ( Optional parameter, Object type : String)
Specifies the buzzer pattern.
Setting Description
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 *
PATERN_3 *
Pattern 2
Pattern 3
4
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
Pattern A
(When not specified)
*
ePOS-Print Service Ver.2.2 or later versions supported
121
repeat : ( 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
One time
(When not specified)
After “0” is specified for repeat, if you want to stop the buzzer, execute this API function and
specify PATTERN_NONE for pattern.
cycle : ( Optional parameter, Object type : String, When not specified : 1000)
(in ePOS-Print Service Ver.2.2 and later)
Specifies the buzzer sounding cycle (in units of milliseconds)
Setting Description
1000 to 25500 1000 to 25500 milliseconds
undefined 1000 milliseconds
Return value
Exception
Example
122
Chapter 4 ePOS-Print API
addLayout method
Adds paper layout information to the command buffer. (in ePOS-Print Service Ver.2.2 and later)
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.
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).
margin_top : ( Optional parameter, Object type : Number, When not specified : 0)
Specifies top margin (in units of 0.1 mm).
123
margin_bottom :( Optional parameter, Object type : Number, When not specified : 0)
Specifies bottom margin (in units of 0.1 mm).
offset_cut : ( 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.
offset_label* : ( Optional parameter, Object type : Number, When not specified : 0)
Specifies label bottom position (sd) per 0.1 mm unit.
*: Valid value of range is depending on the printer model. For detail, refer to Printer specifications (p.203).
124
Chapter 4 ePOS-Print API
Return value
Exception
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
Cut
sc
4
Receipt sa
sc
sf sf
sb Cut sb
sc Bottom edge sc
of label
125
Example
126
Chapter 4 ePOS-Print API
addRecovery method
Adds the recovery from errors to the command buffer. (in ePOS-Print Service Ver.3.0 and later)
Enable forced transmission mode to use this API. The printer recovers from errors that can be
recovered from and clears the buffer.
Syntax
addRecovery();
Return value
Exception
Example
Recovers from errors that can be recovered from and clears the buffer:
127
addReset method
Adds the printer reset to the command buffer. (in ePOS-Print Service Ver.3.0 and later)
Syntax
addReset();
Return value
Exception
Example
128
Chapter 4 ePOS-Print API
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
Exception
Example
129
toString method
Obtains a print document generated by an ePOS-Print Builder object.
Syntax
toString();
Return value
Example
130
Chapter 4 ePOS-Print API
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.
Example
4
var context = canvas.getContext('2d');
builder.halftone = epos.HALFTONE_ERROR_DIFFUSION;
builder.addImage(context, 0, 0, canvas.width, canvas.height);
}
}
//-->
</script>
131
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.
Example
132
Chapter 4 ePOS-Print API
force property
This is the forced transmission mode. (in ePOS-Print Service Ver.3.0 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.119))
Stopping the buzzer (addSound method (p.121))
Recovery from errors that can be recovered from (addRecovery method (p.127))
Reset (addReset method (p.128))
Sending commands in real time (addCommand method (p.129))
Example
}
builder.force = true;
builder.addPulse(); 4
//-->
</script>
133
message property
Command buffer.
Object type
String
Description
Commands, which are usually added by methods of the ePOS-Print Builder object, can be operated
directly from this property for addition or deletion.
Example
134
Chapter 4 ePOS-Print API
ePOS-Print Object
Sends a print document created using an ePOS-Print Builder object to control the printer and monitor the
transmission result or the communication status.
Constructor
Constructor for an ePOS-Print object. Creates a new ePOS-Print object and initializes it.
Syntax
ePOSPrint(address);
Parameter
address : ( Optional parameter, Object type : String)
Specifies the URL of the printer to send a print document to.
The URL is as follows:
Example
135
send method
Sends a print document created using an ePOS-Print Builder object.
A print document is obtained by executing the toString method (p. 130) of the ePOS-Print Builder
object.
Syntax
❏ send(request);
Parameter
request : (Required parameter, Object type : String)
Specifies the print document.
Exception
Example
136
Chapter 4 ePOS-Print API
137
getPrintJobStatus method
Acquires print job status. (ePOS-Print Service Ver.4.1 or later versions)
• The results of executing this API will be returned to an onreceive event (p.145).
• 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.
1 to 30 alphanumeric characters, including underscores, hyphens and periods, may be used.
Exception
Example
138
Chapter 4 ePOS-Print API
open method
Enables status event operation.
Sends the status of the printer specified by the address property using an event.
Updates the status at the interval specified by the interval property.
Syntax
open();
Example
function startMonitor() {
epos.open();
}
function stopMonitor() {
epos.close();
}
//-->
</script>
139
close method
Disables status event operation.
Syntax
close();
Example
function startMonitor() {
epos.open();
}
function stopMonitor() {
epos.close();
}
//-->
</script>
140
Chapter 4 ePOS-Print API
address property
URL of the printer.
Object type
String
Description
The URL of the printer to be used for printing is specified.
The URL is shown as follows:
To acquire print job status, it is not necessary to specify "devid" and "timeout".
(For ePOS-Print Service Ver.4.1 or later and with the spooler enabled)
Example
141
enabled property
Retains the enabled/disabled setting for status event operation.
Object type
Boolean
Description
The enabled/disabled setting for status event operation is retained using a logical value. This is read-only.
The default value is false.
Example
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.
Example
142
Chapter 4 ePOS-Print API
status property
Status of the printer.
Object type
Number
Description
This is the status last obtained from the printer. This is read-only.
Default value: 0
Example
battery property
Battery status of the printer.
4
Object type
Number
Description
Battery status obtained from the last printer status. This is read-only.
Default value: 0
Example
143
timeout property
Specifies connection timeout.
Object type
Number
Description
Specifies connection timeout with ePOS-Print supported printer in milliseconds. When the transmission of
print document by send method times out, onerror even is generated.
Default value: 300000 (5 minutes)
Example
144
Chapter 4 ePOS-Print API
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 145.)
Name: Response message
Object type: Object
Value Description
Printing succeeded
true or 1
Processing succeeded (When the spooler function is enabled)
Printing Failed
4
false or 0
Processing Failed (When the spooler function is enabled)
Value of code
Value Description
'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' * There is not enough space available in the printing queue
'JobNotFound' * The specified job ID does not exist
'Printing' * Print job now printing
* ePOS-Print Service Ver.4.1 or later versions supported
145
Value of status
Remaining battery
146
Chapter 4 ePOS-Print API
Value of printjobid
Value Description
Print job ID
'...'
(An empty string denotes that a print job ID has not been set)
Example
147
onerror event
This property registers the callback function and obtains a communication error event.
Syntax
Function (error)
Parameter of the callback function
Parameters: error (See “Properties of the error object” on page 148.)
Name: Communication error information
Object type: Object
Example
148
Chapter 4 ePOS-Print API
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
Example
onbatterystatuschange event
4
Registers call back function and obtains battery status change event. (in ePOS-Print Service Ver.2.2 and
later)
Object type
Function (battery)
Example
149
ononline event
Registers a callback function to obtain a online event.
Object type
Function ()
Example
onoffline event
Registers a callback function to obtain a offline event.
Object type
Function ()
Example
150
Chapter 4 ePOS-Print API
onpoweroff event
Registers a callback function to obtain a non-response event.
Object type
Function ()
Example
oncoverok event
Registers a callback function to obtain a cover close event.
Object type
Function ()
4
Example
151
oncoveropen event
Registers a callback function to obtain a cover open event.
Object type
Function ()
Example
onpaperok event
Registers a callback function to obtain a paper remaining event.
Object type
Function ()
Example
152
Chapter 4 ePOS-Print API
onpapernearend event
Registers a callback function to obtain a paper near end event.
Object type
Function ()
Example
onpaperend event
Registers a callback function to obtain a paper end event.
Object type
Function ()
4
Example
153
ondrawerclosed event
Registers a callback function to obtain a drawer close event.
Object type
Function ()
Example
ondraweropen event
Registers a callback function to obtain a drawer open event.
Object type
Function ()
Example
154
Chapter 4 ePOS-Print API
onbatteryok event
Registers call back function and obtains remaining battery event. (in ePOS-Print Service Ver.2.2 and later)
Object type
Function ()
Example
onbatterylow event
Registers call back function and obtains no remaining battery event. (in ePOS-Print Service Ver.2.2 and
later)
Object type
Function ()
4
Example
155
156
Chapter 5 ePOS-Print Canvas API
window.epson.CanvasPrint Components
157
Element API Description Page
Event
onreceive Response message receipt event 185
onerror Communication error event 188
onstatuschange Status change event 189
onbatterystatuschange Battery status change event 190
onbatteryok Battery OK event 191
onbatterylow Battery low event 191
ononline Online event 192
onoffline Offline event 192
onpoweroff Non-response event 193
oncoverok Cover close event 193
oncoveropen Cover open event 194
onpaperok Paper remaining event 194
onpapernearend Paper near end event 195
onpaperend Paper end event 195
ondrawerclosed Drawer close event 196
ondraweropen Drawer open event 196
Constant
ASB_* Response document status
HALFTONE_* Halftone type
MODE_* Color mode
ALIGN_* Position alignment
COLOR_* Color specification
FEED_* Paper feed position of label paper/black mark paper
PAPER_* Type of papers
*1
ePOS-Print Service Ver.2.1 or later versions supported
*2
ePOS-Print Service Ver.2.2 or later versions supported
*3
ePOS-Print Service Ver.3.0 or later versions supported
*4
ePOS-Print Service Ver.4.1 or later versions supported
158
Chapter 5 ePOS-Print Canvas API
Constructor
Constructor for an ePOS-Print Canvas API object.
Creates a new ePOS-Print Canvas API object and initializes it.
Syntax
CanvasPrint(address);
Parameter
address : ( Optional parameter, Object type : String)
Specifies the address property (URL of printer to be used for printing).
The URL is as follows:
Example
159
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);
Parameter
canvas : ( Required parameter, Object type : canvas)
Specify the HTML5 Canvas object to be printed.
printjobid : (Optional parameter, Object type : String)
Specify the print job ID. (ePOS-Print Service Ver.4.1 or later versions)
1 to 30 alphanumeric characters, including underscores, hyphens and periods, may be used.
cut : ( Optional parameter, Object type : Boolean)
Sets whether to cut paper.
Setting 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
Setting Description
MODE_MONO Monochrome (two-tone)
MODE_GRAY16 Multiple tones (16-tone)
undefined Monochrome (two-tone)
160
Chapter 5 ePOS-Print Canvas API
Exception
Example
To print Canvas(ID=’myCanvas’):
161
getPrintJobStatus method
Acquires print job status. (ePOS-Print Service Ver.4.1 or later versions)
• The results of executing this API will be returned to an onreceive event (p.185).
• 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.
1 to 30 alphanumeric characters, including underscores, hyphens and periods, may be used.
Exception
Example
162
Chapter 5 ePOS-Print Canvas API
open method
Enables status event operation.
Sends the status of the printer specified by the address property using an event.
Updates the status at the interval specified by the interval property.
Syntax
open();
Example
function startMonitor() {
epos.open();
}
function stopMonitor() {
epos.close();
}
//-->
</script>
163
close method
Disables status event operation.
Syntax
close();
Example
function startMonitor() {
epos.open();
}
function stopMonitor() {
epos.close();
}
//-->
</script>
164
Chapter 5 ePOS-Print Canvas API
recover method
Recovers from an error.(in ePOS-Print Service Ver.3.0 and later)
Recovers from errors that can be recovered from and clears the buffer.
Syntax
recover();
Example
function recover() {
epos.recover();
}
//-->
</script>
reset method
Resets the printer. (in ePOS-Print Service Ver.3.0 and later)
Syntax
reset();
Example
5
<script type="text/javascript" src="epos-print-4.x.x.js"></script>
<script type="text/javascript">
<!--
var address = 'http://192.168.192.168/cgi-bin/epos/service.cgi?devid=local_printer';
var epos = new epson.CanvasPrint(address);
epos.oncoveropen = function () {
alert('coveropen');
};
function reset() {
epos.reset();
}
//-->
</script>
165
address property
URL of the printer.
Object type
String
Description
The URL of the printer to be used for printing is specified.
The URL is shown as follows:
To acquire print job status, it is not necessary to specify "devid" and "timeout".
(For ePOS-Print Service Ver.4.1 or later and with the spooler enabled)
Example
166
Chapter 5 ePOS-Print Canvas API
enabled property
Retains the enabled/disabled setting for status event operation.
Object type
Boolean
Description
The enabled/disabled setting for status event operation is retained using a logical value. This is read-only.
The default value is false.
Example
167
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.
Example
168
Chapter 5 ePOS-Print Canvas API
status property
Status of the printer.
Object type
Number
Description
This is the status last obtained from the printer. This is read-only.
Default value: 0
Example
169
battery property
Battery status of the printer.
Object type
Number
Description
Battery status obtained from the last printer status. This is read-only.
Default value: 0
Example
170
Chapter 5 ePOS-Print Canvas API
timeout property
Specifies connection timeout.
Object type
Number
Description
Specifies connection timeout with ePOS-Print supported printer in milliseconds.
When the transmission of print document by print method times out, onerror even is generated.
Default value: 300000 (5 minutes)
Example
171
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 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.
Example
172
Chapter 5 ePOS-Print Canvas API
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.
Example
173
cut property
It sets with or without paper cut.
Object type
Boolean
Description
It specifies with or without paper cut.
Value Description
true/1 Cut paper after printing
false/0 (Default) Do not cut paper
Example
174
Chapter 5 ePOS-Print Canvas API
mode property
It sets the color mode.
Object type
String
Description
It specifies the color mode.
Value Description
MODE_MONO (Default) Monochrome (2-tone)
MODE_GRAY16 Multiple tones (16-tone)
Example
175
align property
It sets the position alignment.
Object type
String
Description
It specifies the position alignment.
Value Description
ALIGN_LEFT (Default) Alignment to the left
ALIGN_CENTER Alignment to the center
ALIGN_RIGHT Alignment to the right
Example
176
Chapter 5 ePOS-Print Canvas API
color property
It sets printing color.
Object type
String
Description
It specifies printing color.
Value Description
COLOR_NONE No printing
COLOR_1 1st color
COLOR_2 2nd color
COLOR_3 3rd color
COLOR_4 4th color
Example
177
feed property
It sets paper feed of label paper/black mark paper. (in ePOS-Print Service Ver.2.1 and later)
Object type
String
Description
Paper feed position of label paper/black mark paper.
Value Description
FEED_PEELING Feeds to the peeling position.
FEED_CUTTING Feeds to the cutting position.
FEED_CURRENT_TOF (Default) Feeds to the top of the current label.
FEED_NEXT_TOF Feeds to the top of the next label.
Example
178
Chapter 5 ePOS-Print Canvas API
paper property
It sets paper type. (in ePOS-Print Service Ver.2.1 and later)
Object type
String
Description
It specifies paper type.
Value Description
PAPER_RECEIPT (Default) Receipt (without black mark)
PAPER_RECEIPT_BM Receipt (with black mark)
PAPER_LABEL Die-cut label (without black mark)
PAPAER_LABEL_BM Die-cut label (with black mark)
Example
Prints a label.
179
layout property
It sets paper layout. (in ePOS-Print Service Ver.2.2 and later)
Object type
Object
Description
It specifies paper layout.
180
Chapter 5 ePOS-Print Canvas API
Receipt
Paper type
181
Value of offset_label (Object type : Number, When not specified : 0)
Specifies label bottom position (sd) per 0.1 mm unit.
*: Valid value of range is depending on the printer model. For detail, refer to "Appendix - Printer
Specifications".
Layout property positions that can be designated for each type of paper
<without Black Mark> <with Black Mark>
sf sf
sb
Top position
sc
Cut
Receipt sa
sc
sf sf
sb Cut sb
sc Bottom edge sc
of label
Mark Parameter
sf width
sa height
sb margin_top
se margin_bottom
sc offset_cut
sd offset_label
182
Chapter 5 ePOS-Print Canvas API
Example
183
To set 58 mm die-cut label (with black mark):
184
Chapter 5 ePOS-Print Canvas API
onreceive event
This property registers the callback function and obtains a response message receipt event.
Syntax
Function (response)
Parameter of the callback function
Parameter: response (See “Properties of the response object” on page 185.)
Name: Response message
Object type: Object
Value Description
true or 1 Printing succeeded
Processing succeeded (When the spooler function is enabled)
false or 0 Printing Failed
Processing Failed (When the spooler function is enabled)
Value of code
Value
'EPTR_AUTOMATICAL'
Description
An automatically recoverable error occurred
5
'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' * There is not enough space available in the printing queue
'JobNotFound' * The specified job ID does not exist
'Printing' * Print job now printing
*
ePOS-Print Service Ver.4.1 or later versions supported
185
Value of satus
Remaining battery
Value of printjobid
Value Description
Print job ID
'...'
(An empty string denotes that a print job ID has not been set)
186
Chapter 5 ePOS-Print Canvas API
Example
To print Canvas(ID=myCanvas):
To display the print result in a message box.
187
onerror event
This property registers the callback function and obtains a communication error event.
Syntax
Function (error)
Parameter of the callback function
Parameter: error (See “Properties of the error object” on page 188.)
Name: Communication error information
Object type: Object
Example
To print Canvas(ID=myCanvas):
To display the HTTP status code in a message box when a communication error occurs.
188
Chapter 5 ePOS-Print Canvas API
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
Example
189
onbatterystatuschange event
Registers call back function and obtains battery status change event. (in ePOS-Print Service Ver.2.2 and
later)
Syntax
Function (battery)
Parameter of the callback function
Parameters: battery
Name: Battery status
Object type: Number
Example
190
Chapter 5 ePOS-Print Canvas API
onbatteryok event
Registers call back function and obtains remaining battery event. (in ePOS-Print Service Ver.2.2 and later)
Syntax
Function ()
Example
onbatterylow event
Registers call back function and obtains no remaining battery event. (in ePOS-Print Service Ver.2.2 and
later)
Syntax
Function ()
Example
191
ononline event
Registers a callback function to obtain a online event.
Object type
Function ()
Example
onoffline event
Registers a callback function to obtain a offline event.
Object type
Function ()
Example
192
Chapter 5 ePOS-Print Canvas API
onpoweroff event
Registers a callback function to obtain a non-response event.
Object type
Function ()
Example
oncoverok event
Registers a callback function to obtain a cover close event.
Object type
Function ()
Example
193
oncoveropen event
Registers a callback function to obtain a cover open event.
Object type
Function ()
Example
onpaperok event
Registers a callback function to obtain a paper remaining event.
Object type
Function ()
Example
194
Chapter 5 ePOS-Print Canvas API
onpapernearend event
Registers a callback function to obtain a paper near end event.
Object type
Function ()
Example
onpaperend event
Registers a callback function to obtain a paper end event.
Object type
Function ()
Example
195
ondrawerclosed event
Registers a callback function to obtain a drawer close event.
Object type
Function ()
Example
ondraweropen event
Registers a callback function to obtain a drawer open event.
Object type
Function ()
Example
196
Chapter 6 ePOS-Print Editor
ePOS-Print Editor
This section describes how to use ePOS-Print Editor included in the contents in the package.
This tool allows you to create an ePOS-Print API (p. 61) sample code as you like. Use this tool for your Web
application development.
197
Setting
Perform the print setting and the preview setting. Select the [Setting] tab to display the Setting screen.
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 ePOS-Print supported TM Specify the IP address of the printer.
printer Be sure to specify this item.
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.
198
Chapter 6 ePOS-Print Editor
Item 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
Edit area
insert it anywhere in the edit area.
Displays the functions selected in the menu area.
6
Drag an element to change its position. An element can be deleted using
the x button located on its right side.
Import Using ePOS-Print XML, ePOS-Print Editor can import XML data stored in the
past. For details, refer to Import (p.202).
Clear Deletes the edited details.
Forced Transmission Sets forced transmission mode.
199
Create a sample code as follows:
1 Click an icon in the menu area to add an element in the edit area.
The position of the added function can be changed by dragging.
• 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 Setting (p.198)).
4 Select the [API] tab. The ePOS-Print API sample code appears. Use it by copying.
The ePOS-Print XML print document is used for importing. If necessary, select the XML tab and
save the content of the ePOS-Print XML print document by copying.
200
Chapter 6 ePOS-Print Editor
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 Setting (p.198)).
Item Description
Data to be sent The ePOS-Print XML document is displayed.
(ePOS-Print XML)
Send Sends data to the printer and performs printing.
Information Displays the print status.
Clear Deletes the content in the [Information] box.
2 Check the content in the [Data to be sent (ePOS-Print XML)] box and press the
[Send] button.
6
The ePOS-Print XML print document created using the [Edit] tab page is displayed in "Data to be sent
(ePOS-Print XML)".
201
Import
ePOS-Print Editor can import and re-edit the ePOS-Print XML print document once created.
Note that you cannot perform import operation using ePOS-Print API source code.
Perform import operation using ePOS-Print XML print data.
Item Description
Data to be import Paste and check the ePOS-Print XML print document to be imported.
(ePOS-Print XML)
Apply Imports the ePOS-Print XML print document.
Information Displays the import information.
Close Closes the Import screen.
2 The "Import" screen appears. Paste the ePOS-Print XML print document in the
[Data to be import (ePOS-Print XML)] box.
202
Appendix
Appendix
Printer specifications
TM-L90-i/ TM-L90
Print Width 256 dots (38 mm) to 224 dots (38 mm) to
576 dots (80 mm) 560 dots (80 mm)
Character Font A At the 21st dot from the top of the character
Baseline
Bar Code UPC-A, UPC-E, EAN13, JAN13, EAN8, JAN8, CODE39, ITF, CODABAR,
CODE93, CODE128
203
Receipt Die-cut label
Page Mode Default Area 576 dots x 738 dots (W x H) 560 dots x 738 dots (W x H)
when two- 576 dots x 369 dots (W x H) 560 dots x 369 dots (W x H)
color printing
is set
Page Mode Maximum Area 576 dots x 1476 dots (W x H) 560 dots x 1476 dots (W x H)
when two- 576 dots x 738 dots (W x H) 560 dots x 738 dots (W x H)
color printing
is set
Rectangle
Reset Supported
Command Supported
204
Appendix
TM-T70-i/ TM-T70
80 mm
Character Baseline Font A At the 21st dot from the top of the character
Bar Code UPC-A, UPC-E, EAN13, JAN13, EAN8, JAN8, CODE39, ITF,
CODABAR, CODE93, CODE128
Reset Supported
Command Supported
205
TM-T70-i (Multi-language model)
80 mm
Character Baseline Font A At the 21st dot from the top of the character
Bar Code UPC-A, UPC-E, EAN13, JAN13, EAN8, JAN8, CODE39, ITF,
CODABAR, CODE93, CODE128
Reset Supported
Command Supported
206
Appendix
TM-T88V-i/ TM-T88V
80 mm 58 mm
Character Baseline Font A At the 21st dot from the top of the character
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)
Bar Code 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
207
80 mm 58 mm
Reset Supported
Command Supported
208
Appendix
TM-P60II
Receipt 58 mm Receipt 60 mm
Character Font A At the 21st dot from the top of the character
Baseline
Bar Code UPC-A, UPC-E, EAN13, JAN13, EAN8, JAN8, CODE39, ITF, CODABAR,
CODE93, CODE128, GS1-128, GS1 DataBar Omnidirectional, GS1
DataBar Truncated, GS1 DataBar Limited, GS1 DataBar Expanded
Two-Dimensional Code PDF417, QR Code, MaxiCode, GS1 DataBar Stacked, GS1 DataBar
Stacked Omnidirectional, GS1 DataBar Expanded Stacked, Aztec
Code, DataMatrix (Composit Symbology : Not supported)
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)
Rectangle
209
Receipt 58 mm Receipt 60 mm
Reset Supported
Command Supported
210
Appendix
Print Width 420 dots 432 dots 160 dots ~ 400 dots
Character Font A At the 21st dot from the top of the character
Baseline
Bar Code UPC-A, UPC-E, EAN13, JAN13, EAN8, JAN8, CODE39, ITF, CODABAR,
CODE93, CODE128, GS1-128, GS1 DataBar Omnidirectional, GS1
DataBar Truncated, GS1 DataBar Limited, GS1 DataBar Expanded
Two-Dimensional Code PDF417, QR Code, MaxiCode, GS1 DataBar Stacked, GS1 DataBar
Stacked Omnidirectional, GS1 DataBar Expanded Stacked, Aztec
Code, DataMatrix (Composit Symbology : Not supported)
Page Mode Default Area 420 dots x 1624 dots 432 dots x 1624 dots 400 dots x 1624 dots
(W x H) (W x H) (W x H)
Page Mode Maximum Area 420 dots x 1624 dots 432 dots x 1624 dots 400 dots x 1624 dots
(W x H) (W x H) (W x H)
Rectangle
211
Receipt 58 mm Receipt 60 mm Die-cut label
Reset Supported
Command Supported
Paper Layout
Die-cut label Die-cut label
Receipt paper Receipt paper
paper paper
Paper type (without black (with black
(without black (with black
mark) mark)
mark) mark)
width (sf) 290 to 600 290 to 600 290 to 600 290 to 600
offset_label (sd) 0 0 0 0 to 15
212
Appendix
TM-P80
Receipt 80 mm
Characters in a Font A
ANK: 48 characters,
Line
Font A
(42 column ANK: 42 characters
mode)
Font B
(42 column ANK: 60 characters
mode)
Character Font A At the 21st dot from the top of the character
Baseline
Bar Code 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
213
Receipt 80 mm
Two-Dimensional Code PDF417, QR Code, MaxiCode, GS1 DataBar Stacked, GS1 DataBar
Stacked Omnidirectional, GS1 DataBar Expanded Stacked, Aztec
Code, DataMatrix
Page Mode Default Area 576 dots x 1662 dots (W x H), 546 dots x 1662 dots (W x H) (42 column
mode)
Page Mode Maximum Area 576 dots x 1662 dots (W x H), 546 dots x 1662 dots (W x H) (42 column
mode)
Reset Supported
Command Supported
Paper Layout
Receipt paper Receipt paper
Paper type
(without black mark) (with black mark)
margin_bottom (se) 0 0
offset_label (sd) 0 0
214
Appendix
TM-T20
58 mm 80 mm
Interface Ethernet
Character Font A At the 21st dot from the top of the character
Baseline
Bar Code UPC-A, UPC-E, EAN13, JAN13, EAN8, JAN8, CODE39, ITF, CODABAR,
CODE93, CODE128, GS1-128, GS1 DataBar Omnidirectional, GS1
DataBar Truncated, GS1 DataBar Limited, GS1 DataBar Expanded
Two-Dimensional Code PDF417, QR Code, MaxiCode, GS1 DataBar Stacked, GS1 DataBar
Stacked Omnidirectional, GS1 DataBar Expanded Stacked
(Composit Symbology : Not supported)
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)
Rectangle
215
58 mm 80 mm
Reset Supported
Command Supported
216
Appendix
80 mm 58 mm
Character Baseline Font A At the 21st dot from the top of the character
Page Mode Default Area 576 dots x 1662 dots (W x H) 416 dots x 1662 dots (W x H)
Page Mode Maximum Area 576 dots x 1662 dots (W x H) 416 dots x 1662 dots (W x H)
Bar Code UPC-A, UPC-E, EAN13, JAN13, EAN8, JAN8, CODE39, ITF,
CODABAR, CODE93, CODE128
Reset Supported
Command Supported
217
TM-T88IV
80 mm 58 mm
Interface Ethernet, Wireless LAN
Character Baseline Font A At the 21st dot from the top of the character
Page Mode Default Area 512 dots x 831 dots (W x H) 360 dots x 831 dots (W x H)
when two- 512 dots x 415 dots (W x H) 360 dots x 415 dots (W x H)
color
printing is set
Page Mode Maximum Area 512 dots x 1662 dots (W x H) 360 dots x 1662 dots (W x H)
when two- 512 dots x 831 dots (W x H) 360 dots x 831 dots (W x H)
color
printing is set
Bar Code UPC-A, UPC-E, EAN13, JAN13, EAN8, JAN8, CODE39, ITF,
CODABAR, CODE93, CODE128, GS1-128
218
Appendix
80 mm 58 mm
Paper Layout Settings Not supported
Reset Supported
Command Supported
219
TM-T90
58 mm 60 mm 80 mm
Character Font A At the 21st dot from the top of the character
Baseline
Bar Code UPC-A, UPC-E, EAN13, JAN13, EAN8, JAN8, CODE39, ITF, CODABAR,
CODE93, CODE128
Page Mode Default Area 360 dots x 831 dots 384 dots x 831 dots 512 dots x 831 dots
(W x H) (W x H) (W x H)
when two- 360 dots x 415 dots 384 dots x 415 dots 512 dots x 415 dots
color printing (W x H) (W x H) (W x H)
is set
Page Mode Maximum Area 360 dots x 1662 dots 384 dots x 1662 dots 512 dots x 1662 dots
(W x H) (W x H) (W x H)
when two-color printing is set 360 dots x 831 dots 384 dots x 831 dots 512 dots x 831 dots
(W x H) (W x H) (W x H)
220
Appendix
58 mm 60 mm 80 mm
Rectangle
Reset Supported
Command Supported
221
TM-U220
76 mm 70 mm 58 mm
Rectangle
222
Appendix
76 mm 70 mm 58 mm
Reset Supported
Command Supported
223
Rendering in HTML5 Canvas
This section describes how to use Web pages using the ePOS-Print Canvas API in the package.
You can try how to render images in HTML5 Canvas and see what images can be rendered.
The following Web pages are available:
Rendering Text (canvas-print-text.html) (p.224)
Rendering Images (canvas-print-image.html) (p.226)
Rendering Graphics (canvas-print-graph.html) (p.228)
Rendering Handwritten Images (canvas-print-hand.html) (p.230)
Rendering Barcode (canvas-print-barcode.html) (p.232)
Rendering Barcode (canvas-print-barcode.html) (p.232)
The Web pages introduced here are embedded into the sample program. For the details about
how to place them, refer to Environment Settings (p.36).
224
Appendix
225
Rendering Images (canvas-print-image.html)
Draw an image in HTML5 Canvas and perform a test print.
226
Appendix
227
Rendering Graphics (canvas-print-graph.html)
Draw an image in HTML5 Canvas and perform a test print.
228
Appendix
229
Rendering Handwritten Images (canvas-print-hand.html)
Draw a handwritten image and perform a test print.
2 “EPSON ePOS-Print Sample Program” appears. Set the size of the pen on the right
of the page.
3 Draw a freehand line on Canvas on the left of the page. For the mouse, drag it to
draw a line; for the touch screen monitor, draw a line on the touch screen.
230
Appendix
231
Rendering Barcode (canvas-print-barcode.html)
Draw a barcode in HTML5 Canvas and perform a test print.
In the following example, an EAN13, JAN13 or UPC-A is drawn.
232
Appendix
233
Rendering Label (canvas-print-label.html)
Draw a label in HTML5 Canvas and perform a test print.
234
Appendix
235
Windows Store Apps
In this section, how to use the sample program with Windows store apps is described.
[1]
[2]
236
Appendix
Print Image
Your Number:
Label *
(ePOS-Print API)
Name
Item A
Color Red
Code
*2012001*
*: Die cut label: mount width 58 mm or above
Label size: width 54 mm x height 25.4 mm or above
237
Environment of Sample Program
The environment of sample program is shown below.
Item Description
Development environment Microsoft Visual Studio 2012
(example)
Required than Windows 8
Sample program file name win8/ePOS-Print Demo.zip
1 Configure your computer and ePOS-Print supported TM printer so that they can
connect to the network.
4 Start debugging.
238
Appendix
Item Description
Specifies the IP address of the ePOS-Print supported printer.
(Default value:
TM-i: DHCP
IP address of the ePOS-Print
(If an address fails to be assigned via DHCP, the value
supported printer
becomes "192.168.192.168".)
TM Printer: 192.168.192.168
)
Specifies the Device ID of the printer to print queue ticket
Device ID of the target printer
numbers and coupons. (Default value: local_printer)
Print timeout (milliseconds) Specifies the timeout time. (default : 60000)
Print in grayscale (Coupon)
Prints coupons in gray scale. (Default: No)
(Only for supported models)
Set the paper layout (Label)
Prints a label in a specified layout. (Default: No)
(Only for TM-P60II/TM-P80)
239
Printing
It executes printing.
1 Select a type of printing from the left screen. There are following printing types.
Item Description
Prints queue ticket numbers.
Queue Ticket
This is a sample program using the ePOS-Print API.
Prints coupons.
Coupon
This is a sample program using the ePOS-Print Canvas API.
Prints labels.
Label
This is a sample program using the ePOS-Print API.
2 Press [Print].
240