hit counter script
Epson TM-T88V User Manual

Epson TM-T88V User Manual

Epos-print sdk for android
Hide thumbs Also See for TM-T88V:
Table of Contents

Advertisement

ePOS-Print SDK
User's Manual
for Android
Overview
Describes the features and development
environment.
Sample Program
Describes how to use the sample program.
Programming Guide
Describes how to write programs in application 
development.
API Reference
Describes the APIs provided in ePOS-Print SDK
for Android.
Command Transmission/Reception
Describes the APIs for transmitting and
receiving commands.
Appendix
Describes the specifications for printers used for 
the ePOS-Print SDK for Android.
M00048900
Rev.A

Advertisement

Table of Contents
loading

Summary of Contents for Epson TM-T88V

  • Page 1 ePOS-Print SDK for Android User’s Manual Overview Describes the features and development environment. Sample Program Describes how to use the sample program. Programming Guide Describes how to write programs in application  development. API Reference Describes the APIs provided in ePOS-Print SDK for Android.
  • Page 2 • 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...
  • Page 3: For Safety

    For Safety Key to Symbols The symbols in this manual are identified by their level of importance, as defined below. Read the following carefully before handling the product. Provides information that must be observed to avoid damage to your equipment or a mal- function.
  • Page 4: About This Manual

    About this Manual Aim of the Manual This manual aims to provide development engineers with all the information necessary for the construction and design of a printing system that uses ePOS-Print SDK, and for the development and design of printer applications. Manual Content The manual is made up of the following sections: Chapter 1...
  • Page 5: Table Of Contents

    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 ..................9 ■ Overview of ePOS-Print SDK ....................9 Features ..............................9 Function ..............................
  • Page 6 Programming Guide ..............25 ■ How to Incorporate the ePOS-Print SDK for Android............25 ■ ePOS-Print SDK........................27 Print Mode.............................27 Programming Flow ..........................27 Printer search ............................28 Print Document Creation ........................29 Transmission of Print Document ......................32 Printing After Checking the Printer Status..................33 ■...
  • Page 7 Exception handling ........................... 104 ■ Command Transmission/Reception API Reference ............105 open..............................105 close ..............................107 write..............................108 read..............................110 start..............................111 stop..............................112 getResult ............................. 113 Appendix..................115 ■ Printer specifications ......................115 TM-T88V ............................... 115 TM-T70..............................117 TM-P60 ..............................119 TM-U220............................... 121...
  • Page 9: Overview

    Overview of ePOS-Print SDK The ePOS-Print SDK for Android is an SDK aimed at development engineers who are developing Android applications for printing on an EPSON TM printer. Applications are developed using the APIs provided by ePOS-Print SDK. The ePOS-Print SDK also has the "ePOS-Print SDK for iOS" for iOS applications.
  • Page 10: Function

    Function ePOS-Print API ❏ Print setting (alignment/line feed space/text rotation/page mode) ❏ Character data setting (language/font (device font)/double-sizing/scale/smoothing/print position) ❏ Character style setting (inversion of black and white/underline/bold) ❏ Paper feed setting (in dots/in lines) ❏ Image printing (raster image/NV graphics) ❏...
  • Page 11: Operating Environment

    ❏ Android Version 3.1 to 3.2.2 ❏ Android Version 4.0 to 4.0.4 For the latest version, refer to the README file. Android Device Device that supports ARMv5TE Printer TM Printer ❏ TM-T88V ❏ TM-T70 ❏ TM-P60 ❏ TM-U220 Interface ❏...
  • Page 12: Contents In The Package

    For an Android application for TM printers developed using ePOS Print SDK for Android, the following program is available. ❏ ePOS-Print_Sample_Android.zip 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...
  • Page 13: Restrictions

    Chapter 1 Overview Restrictions ❏ A communication API (p.40) and command transmission/reception API (p.101) in the ePOS Print APIs cannot be used for the same device at the same time. ❏ A maximum of 16 device ports can be opened in the same application at the same time. ❏...
  • Page 15: Sample Program

    Chapter 2 Sample Program Sample Program This chapter describes how to use the sample program(ePOS-Print Sample Program for Android). • The sample program is provided as an Android application project for use with Eclipse, including the Java source files. • For an Android application for TM printers developed using ePOS Print SDK, the following program is available.
  • Page 16: Usage Environment

    Usage Environment Development Environment  Android SDK r16  Java Development Kit 6  Eclipse  ADT Plugin for Eclipse For details about ways to construct a development environment, please refer to the "ePOS-Print SDK for Android Application Development - Setup Guide". Printer ...
  • Page 17: Environmental Construction

    Chapter 2 Sample Program Environmental Construction Follow the procedures below to use the sample program. Extract the sample program zip file to a directory of your choosing. In Eclipse, go to [File]-[Import], select [General]-[Existing Project into Workspace], and then click [Next]. The Import Projects window will be displayed.
  • Page 18: How To Use The Program Sample

    How to Use the Program Sample This section describes how to use the program sample for the following operations:  Search for printers and printing (p.18)  Acquisition of Printer Model Name (p.24) Search for printers and printing Use the sample program as follows: Start the sample program.
  • Page 19 Chapter 2 Sample Program The following execution results will be displayed:  Process execution result (error status / printer status) For details, refer to Process execution result (p.22).  Method (API) execution error For details, refer to Method (API) execution error (p.23).
  • Page 20 Barcode printing Execute the barcode printing according to the following procedure: Set the following for barcodes: Setting Description Type Select the barcode type. Data Enter the barcode data. Set the HRI position. Font Set the HRI font. Module Size(Width, Height) Set the barcode module size (width / height).
  • Page 21 Chapter 2 Sample Program Printing in page mode Execute the printing in page mode according to the following procedure: Enter a string to print for [Print Characters]. Set the print area using [Print Area]. Setting Description Set the origin of horizontal axis. Set the origin of vertical axis.
  • Page 22 Execution result Process execution result Any of the following will be displayed:  Result: Any of the following statuses will be displayed: String displayed Description SUCCESS Succeeded ERR_PARAM An invalid parameter was passed. ERR_ILLEGAL Used in an illegal manner. ERR_PROCESSING Failed to execute the process.
  • Page 23 Chapter 2 Sample Program Method (API) execution error Any of the following will be displayed:  Error Code: Any of the following statuses will be displayed: String displayed Description ERR_PARAM An invalid parameter was passed. ERR_OPEN The open process failed. ERR_CONNECT Failed to connect to the device.
  • Page 24: Acquisition Of Printer Model Name

    Acquisition of Printer Model Name A command transmission/reception API is used for acquisition of printer model name. For details, refer to Command Transmission/Reception (p.101). Use the following procedure: Start the sample program. For details, refer to Environmental Construction (p.17). Search for printers. Tap [Printer Discovery] on the main screen.  When [Device Type] is selected, the printers detected by the search are displayed in list form.
  • Page 25: Programming Guide

    Select the project in Eclipse's Package Explorer, right click on it, and press [Refresh]. Write the package import declaration in the *.java source file(s) of the application you would like to use this SDK in as follows: import com.epson.eposprint.*; import com.epson.epsonio.*;...
  • Page 26 Confirm that the target project's "/libs" folder is in the Source tab of the target project's properties. If not, add "libs" to the build path using [Add Folder...]. With the target project selected from Eclipse's Package Explorer, select [Preferences] in the [Window] menu. The [Preferences] screen is displayed.
  • Page 27: Epos-Print Sdk

    Chapter 3 Programming Guide ePOS-Print SDK 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.
  • Page 28: Printer Search

    Printer search Starting the printer search Use the Finder class's start (p.96) to start searching for printers. Please refer to the following code. int errStatus = IoStatus.SUCCESS; //Start search try { Finder.start(getBaseContext(), DevType.TCP, "192.168.192.168"); //Exception handling } catch ( EpsonIoException e ) { errStatus = e.getStatus();...
  • Page 29: Print Document Creation

    Create a Builder class using the constructor for it and create a print document using APIs of the Builder class. Use the programming example below for your reference. try { //Initialize a Builder class instance Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); //Create a print document builder.addTextLang(Builder.LANG_EN); builder.addTextSmooth(Builder.TRUE);...
  • Page 30 Use the programming example below for your reference. import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; try { //Initialize a Builder class instance Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); //Create a print document Bitmap bmp = BitmapFactory.decodeResource(getResources(),R.drawable.background); builder.addImage(bmp, 0, 0, 8, 48, Builder.PARAM_DEFAULT); builder.addCut(Builder.CUT_FEED); } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 31  Scale: x 2 (horizontal) and x 2 (vertical)  Style: Bold try { //Initialize a Builder class instance Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); //Create a print document //<The page mode starts> builder.addPageBegin(); builder.addPageArea(100, 50, 200, 100); builder.addPagePosition(0, 42);...
  • Page 32: Transmission Of Print Document

    //Initialize a Print class instance Print printer = new Print(); int[] status = new int[1]; status[0] = 0; try { //Initialize a Builder class instance Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); //Create a print document //<The page mode starts> builder.addTextLang(Builder.LANG_EN); builder.addTextSmooth(Builder.TRUE); builder.addTextFont(Builder.FONT_A);...
  • Page 33: Printing After Checking The Printer Status

    Print printer = new Print(); int[] status = new int[1]; status[0] = 0; try { //Create a print document Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addText("Hello, World!\n"); builder.addCut(Builder.CUT_FEED); //Initialize a Builder class instance for confirmation Builder conBuilder = new Builder("TM-T88V", Builder.MODEL_ANK);...
  • Page 34: Exception Handling

    //<Send data for confirmation> Print printer = new Print(); int[] status = new int[1]; status[0] = 0; try { //Create a print document Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addText("Hello,\t"); builder.addText("World!\n"); builder.addCut(Builder.CUT_FEED); //<Send print data> printer.openPrinter(Print.DEVTYPE_TCP, "192.168.192.168"); printer.sendData(builder, 10000, status);...
  • Page 35 Chapter 3 Programming Guide Search API of the EpsonIoException class.  Acquire the error status using getStatus (p.99) Use the programming example below for your reference. int errStatus = IoStatus.SUCCESS; String[] mList = null; //Acquire a list of devices try { Finder.start(getBaseContext(), DevType.TCP, "192.168.192.168");...
  • Page 36: Error Status List

    Error Status List Error statuses are defined in each API-executing class. Error status Cause Invalid parameter was passed. <Example> ERR_PARAM  An invalid parameter such as null was passed.  A value outside the supported range was specified. Open processing failed. ERR_OPEN <Example>...
  • Page 37: Printer Status List

    Chapter 3 Programming Guide Printer Status List Printer Status Cause Print.ST_NO_RESPONSE No response from the printer (0x00000001) Print.ST_PRINT_SUCCESS Printing is successfully completed (0x00000002) Print.ST_DRAWER_KICK Status of the 3rd pin of the drawer kick-out connector = "H" (0x00000004) Print.ST_OFF_LINE  Offline 0x00000008) Print.ST_COVER_OPEN...
  • Page 39: Api Reference

    Chapter 4 API Reference API Reference This chapter describes the APIs provided in the ePOS-Print SDK for Android. ePOS-Print API The ePOS-Print APIs are APIs for creating and printing print documents. The following classes are available. ❏ Builder class ❏ Print class ❏...
  • Page 40 Description Page addPageBegin Adds a tag for switching to page mode. addPageEnd Adds a tag for finishing page mode. Adds a tag for specifying the print area in addPageArea page mode. Adds a tag for specifying the print direction in addPageDirection Pagemode page mode.
  • Page 41: Builder Class (Constructor)

    An unsupported model name or unsupported language specifications were specified. ERR_FAILURE An unspecified error occurred. Example If you are initializing the command buffer for the TM-T88V ANK model: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); ///Process/// } catch (EposException e) {...
  • Page 42: Clearcommandbuffer

    Clears command buffers used by APIs of the Builder class. Syntax public void clearCommandBuffer() Example If you are clearing the command buffer: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); ///Process/// builder.clearCommandBuffer(); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 43: Addtextalign

    Invalid parameter was passed. ERR_MEMORY Could not allocate memory. ERR_FAILURE An unspecified error occurred. Example To set alignment to the center: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addTextAlign(Builder.ALIGN_CENTER); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 44: Addtextlinespace

    Invalid parameter was passed. ERR_MEMORY Could not allocate memory. ERR_FAILURE An unspecified error occurred. Example To set the line feed space to 30 dots: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addTextLineSpace(30); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 45: Addtextrotate

    Description ERR_PARAM Invalid parameter was passed. ERR_MEMORY Could not allocate memory. ERR_FAILURE An unspecified error occurred. Example To set text rotation: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addTextRotate(Builder.TRUE); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 46: Addtext

    ERR_PARAM Invalid parameter was passed. ERR_MEMORY Could not allocate memory. ERR_FAILURE An unspecified error occurred. Example To add character strings: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addText("Hello,\t"); builder.addText("World!\n"); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 47: Addtextlang

    Invalid parameter was passed. ERR_MEMORY Could not allocate memory. ERR_FAILURE An unspecified error occurred. Example To set the language as English: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addTextLang(Builder.LANG_EN); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 48: Addtextfont

    ERR_PARAM Invalid parameter was passed. ERR_MEMORY Could not allocate memory. ERR_FAILURE An unspecified error occurred. Example To set the font B: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addTextFont(Builder.FONT_B); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 49: Addtextsmooth

    Error status Description ERR_PARAM Invalid parameter was passed. ERR_MEMORY Could not allocate memory. ERR_FAILURE An unspecified error occurred. Example To enable smoothing: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addTextSmooth(Builder.TRUE); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 50: Addtextdouble

    ERR_MEMORY Could not allocate memory. ERR_FAILURE An unspecified error occurred. Example To set the size as double width and height: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addTextDouble(Builder.TRUE, Builder.TRUE); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 51: Addtextsize

    An unspecified error occurred. Example To set a horizontal scale of x 4 and a vertical scale of x 4: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addTextSize(4, 4); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 52: Addtextstyle

    addTextStyle Adds the text style setting to the command buffer. Syntax public void addTextStyle(int reverse, int ul, int em , int color) throws EposException Parameter  reverse : Specifies inversion of black and white for text. Set value Description Builder.TRUE Specifies the inversion of black and white parts of characters.
  • Page 53 Invalid parameter was passed. ERR_MEMORY Could not allocate memory. ERR_FAILURE An unspecified error occurred. Example To set the underline style: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addTextStyle(Builder.PARAM_UNSPECIFIED, Builder.TRUE, Builder.PARAM_UNSPECIFIED, Builder.PARAM_UNSPECIFIED); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 54: Addtextposition

    Could not allocate memory. ERR_FAILURE An unspecified error occurred. Example To set the print position at 120 dots from the left end: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addTextPosition(120); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 55: Addfeedunit

    Invalid parameter was passed. ERR_MEMORY Could not allocate memory. ERR_FAILURE An unspecified error occurred. Example To feed paper by 30 dots: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addFeedUnit(30); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 56: Addfeedline

    Invalid parameter was passed. ERR_MEMORY Could not allocate memory. ERR_FAILURE An unspecified error occurred. Example To feed paper by 3 lines: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addFeedLine(3); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 57: Addimage

    Chapter 4 API Reference addImage Adds raster image printing to the command buffer. Prints the graphic in the android.graphics.Bitmap class. Of the graphics in the android.graphics.Bitmap class, makes the specified range into binary with the dither processing, and converts it into raster image data. 1 pixel of the image corresponds to 1 dot of the printer. If transparent shading is included, it is regarded as white.
  • Page 58 Could not allocate memory. ERR_FAILURE An unspecified error occurred. Example try { Bitmap imageData = null; Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); ///Process/// builder.addImage(imageData, 0, 0, 256, 256, Builder.PARAM_DEFAULT); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus(); To print an image 256 dots wide and 256 dots high in page mode: try { Bitmap imageData = null;...
  • Page 59: Addlogo

    ERR_FAILURE An unspecified error occurred. Example To print a NV logo with the key code parameters specified as 48, 48: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addLogo(48, 48); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 60: Addbarcode

    addBarcode Adds barcode printing to the command buffer. Syntax  public void addBarcode (String data, int type, int hri, int font, int width , int height) throws EposException Parameter  data : Specifies the barcode data as a string. Specify a string that follows the barcode standard specified by the type parameter. If the specified string does not conform to the standard, a barcode will not be printed.
  • Page 61 Chapter 4 API Reference Barcode type Description Specify a start character (CODE A, CODE B, CODE C). A stop character is automatically added. A check digit is automatically calculated and added. To encode each of the following characters, specify two characters starting with the character "{": FNC1: FNC2:...
  • Page 62 Barcode type Description You can enclose an application identifier (AI) in parentheses. The parentheses are used as HRI print characters and are not encoded as data. To encode each of the following characters, specify two BARCODE_GS1_ characters starting with the character "{": DATABAR_EXPANDED FNC1: To specify binary data that cannot be represented by character strings, use the...
  • Page 63 Chapter 4 API Reference  font : Specifies the HRI font. Set value Description Builder.FONT_A(default) Font A Builder.FONT_B Font B Builder.FONT_C Font C Builder.PARAM_UNSPECIFIED Retains the current setting.  width : Specifies the width of each module in dots. Specifies an integer from 2 to 6. Set value 説明...
  • Page 64 Example To print barcodes: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addBarcode("01234567890", Builder.BARCODE_UPC_A, Builder.HRI_BELOW, Builder.PARAM_UNSPECIFIED, 2, 64); builder.addBarcode("01234500005", Builder.BARCODE_UPC_E, Builder.PARAM_UNSPECIFIED, Builder.PARAM_UNSPECIFIED, Builder.PARAM_UNSPECIFIED, Builder.PARAM_UNSPECIFIED); builder.addBarcode("201234567890", Builder.BARCODE_EAN13, Builder.PARAM_UNSPECIFIED, Builder.PARAM_UNSPECIFIED, Builder.PARAM_UNSPECIFIED, Builder.PARAM_UNSPECIFIED); builder.addBarcode("201234567890", Builder.BARCODE_JAN13, Builder.PARAM_UNSPECIFIED, Builder.PARAM_UNSPECIFIED, Builder.PARAM_UNSPECIFIED, Builder.PARAM_UNSPECIFIED); builder.addBarcode("2012345", Builder.BARCODE_EAN8, Builder.PARAM_UNSPECIFIED, Builder.PARAM_UNSPECIFIED, Builder.PARAM_UNSPECIFIED, Builder.PARAM_UNSPECIFIED);...
  • Page 65: Addsymbol

    Chapter 4 API Reference addSymbol Adds 2D-Code printing to the command buffer. Syntax  public void addSymbol (String data, int type, int level, int width, int height, int size) throws EposException Parameter  data : Specifies 2D-Code data as a character string. 2D-Code type Description Standard PDF417...
  • Page 66 2D-Code type Description MaxiCode Mode 2 Convert the character string to the string in UTF- 8, apply the escape sequence, and then MaxiCode Mode 3 encode the string. MaxiCode Mode 4 In Modes 2 and 3, when the first piece of data is MaxiCode Mode 5 [)>\ x1e01\x1dyy (where yy is a two-digit num- ber), this is processed as the message header,...
  • Page 67 Chapter 4 API Reference To specify binary data that cannot be represented by character strings, use the following escape sequences. String Description \xnn Control code Back slash  type : Specifies the 2D-Code type. Set value 2D-Code type Builder.SYMBOL_PDF417_STANDARD Standard PDF417 Builder.SYMBOL_PDF417_TRUNCATED Truncated PDF417 Builder.SYMBOL_QRCODE_MODEL_1...
  • Page 68  level : Specifies the error correction level. Set value Description Builder.LEVEL_0 PDF417 error correction level 0 Builder.LEVEL_1 PDF417 error correction level 1 Builder.LEVEL_2 PDF417 error correction level 2 Builder.LEVEL_3 PDF417 error correction level 3 Builder.LEVEL_4 PDF417 error correction level 4 Builder.LEVEL_5 PDF417 error correction level 5 Builder.LEVEL_6...
  • Page 69 Invalid parameter was passed. ERR_MEMORY Could not allocate memory. ERR_FAILURE An unspecified error occurred. Example To print 2D-Code: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addSymbol("ABCDE", Builder.SYMBOL_PDF417_STANDARD, Builder.PARAM_UNSPECIFIED, Builder.PARAM_UNSPECIFIED, Builder.PARAM_UNSPECIFIED, Builder.PARAM_UNSPECIFIED); builder.addSymbol("ABCDE", Builder.SYMBOL_QRCODE_MODEL_2, Builder.LEVEL_Q, Builder.PARAM_UNSPECIFIED, Builder.PARAM_UNSPECIFIED, Builder.PARAM_UNSPECIFIED); builder.addSymbol("908063840\\x1d850\\x1d001\\x1d\\x04", Builder.SYMBOL_MAXICODE_MODE_2, Builder.PARAM_UNSPECIFIED, Builder.PARAM_UNSPECIFIED, Builder.PARAM_UNSPECIFIED,...
  • Page 70: Addpagebegin

    ERR_MEMORY Could not allocate memory. ERR_FAILURE An unspecified error occurred. Example To print the characters "ABCDE" in page mode: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addPageBegin(); builder.addText("ABCDE"); builder.addPageEnd(); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 71: Addpageend

    ERR_MEMORY Could not allocate memory. ERR_FAILURE An unspecified error occurred. Example To print the characters "ABCDE" in page mode: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addPageBegin(); builder.addText("ABCDE"); builder.addPageEnd(); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 72: Addpagearea

    addPageArea 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.
  • Page 73 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": try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addPageBegin(); builder.addPageArea(100, 50, 200, 30); builder.addText("ABCDE");...
  • Page 74: Addpagedirection

    addPageDirection 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.70) addPageEnd (p.71).
  • Page 75 Chapter 4 API Reference Example To print the characters "ABCDE" by rotating them 90 degrees clockwise: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addPageBegin(); builder.addPageArea(100, 50, 30, 200); builder.addPageDirection(Builder.DIRECTION_TOP_TO_BOTTOM); builder.addText("ABCDE"); builder.addPageEnd(); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 76: Addpageposition

    addPagePosition 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.70) addPageEnd (p.71). Syntax public void addPagePosition(int x, int y) throws EposException Parameter ...
  • Page 77 Chapter 4 API Reference Example To specify (50,30) for the print start position in the area specified by the addPageArea method and print the characters "ABCDE": try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addPageBegin(); builder.addPageArea(100, 50, 200, 100); builder.addPagePosition(50, 30); builder.addText("ABCDE");...
  • Page 78: Addpageline

    addPageLine Adds line drawing in page mode to the command buffer. Draws a line in page mode. Diagonal lines cannot be drawn. Use this API function by inserting it between addPageBegin (p.70) addPageEnd (p.71). Syntax  public void addPageLine (int x1, int y1, int x2, int y2, int style) throws EposException Parameter ...
  • Page 79 Chapter 4 API Reference Example To draw a thin solid line between the start position (100, 0) and the end position (500, 0): try { Builder builder = new Builder("TM-P60", Builder.MODEL_ANK); builder.addPageBegin(); builder.addPageLine(100, 0, 500, 0, Builder.LINE_THIN); builder.addPageEnd(); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 80: Addpagerectangle

    addPageRectangle 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.70) addPageEnd (p.71). Syntax  public void addPageRectangle (int x1, int y1, int x2, int y2, int style) throws EposException Parameter ...
  • Page 81 Chapter 4 API Reference Example To draw a rectangle with a thin solid line, with the start position (100, 0) and the end position (500, 200) as its vertexes: try { Builder builder = new Builder("TM-P60", Builder.MODEL_ANK); builder.addPageBegin(); builder.addPageRectangle(100, 0, 500, 200, Builder.LINE_THIN); builder.addPageEnd();...
  • Page 82: Addcut

    ERR_PARAM Invalid parameter was passed. ERR_MEMORY Could not allocate memory. ERR_FAILURE An unspecified error occurred. Example To perform feed cut operation: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addCut(Builder.CUT_FEED); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 83: Addpulse

    An unspecified error occurred. Example To send a 100msec pulse signal to the pin 2 of the drawer kick connector: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addPulse(Builder.DRAWER_1, Builder.PULSE_100); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 84: Addsound

    addSound Adds the turning on of the buzzer to the command buffer. Sets the buzzer. • Not available in page mode. • The buzzer function and the drawer cannot be used together. • This API function cannot be used if the printer is not provided with the buzzer. Syntax public void addSound(int pattern, int repeat)...
  • Page 85 Chapter 4 API Reference Example To repeat the sound pattern A three times: try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addSound(Builder.PATTERN_A, 3); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 86: Addcommand

    Description ERR_PARAM Invalid parameter was passed. ERR_MEMORY Could not allocate memory. ERR_FAILURE An unspecified error occurred. Example try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); byte[] data = null; ///Process/// builder.addCommand(data); } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 87: Print Class (Constructor)

    Chapter 4 API Reference Print class (Constructor) Constructor for the Print class. Initializes a Print class instance. Syntax public Print() Example Print printer = new Print(); ///Process///...
  • Page 88: Openprinter

    openPrinter Starts communication with the printer. • if communication with the printer is not required anymore, be sure to call closePrinter (p.90), closePrinter API, to end communication with the printer. • When you are opening the printer with another application via a Bluetooth connection, if you try to begin communication with this API, the process may not return.
  • Page 89 Chapter 4 API Reference Example To start communication via Wi-Fi/Ethernet with the printer whose IP address is "192.168.192.168": Print printer = new Print(); try { printer.openPrinter(Print.DEVTYPE_TCP, "192.168.192.168"); ///Process/// } catch (EposException e) { int errStatus = e.getErrorStatus();...
  • Page 90: Closeprinter

    closePrinter Ends communication with the printer. Syntax public void closePrinter() throws EposException Exceptions When processing fails, EposException is thrown with one of the following error values. Error status Description ERR_ILLEGAL This API was called when communication had not started yet. ERR_PROCESSING Could not execute process.
  • Page 91: Senddata

    Chapter 4 API Reference sendData Sends a print document created using the Builder class. • If you are using a Bluetooth connection, it may not be able to detect the offline status, and timeout errors may occur. • If you are using a Bluetooth connection, it may not be able to detect that the printer's power is off.
  • Page 92 To send a command to the printer by specifying 10 seconds for its timeout parameter: Print printer = new Print(); int[] status = new int[1]; status[0] = 0; try { Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK); builder.addText("ABCDE"); printer.openPrinter(Print.DEVTYPE_TCP, "192.168.192.168"); printer.sendData(builder, 10000, status); printer.closePrinter();...
  • Page 93: Geterrorstatus

    Chapter 4 API Reference getErrorStatus Acquire the error status from an exception. Syntax public int getErrorStatus() Return value Returns the error status set by the API in which an exception occurred. Example To acquire the error status from EposException. try { printer.openPrinter(Print.DEVTYPE_TCP, "192.168.192.168");...
  • Page 94: Getprinterstatus

    getPrinterStatus Acquires the printer status from an exception that occurred in sendData (p.91). Syntax public int getPrinterStatus() Return value Returns the printer status. A combination of printer status settings is set.  For details, refer to Printer Status List (p.37). Example To acquire the printer status from EposException.
  • Page 95: Printer Search Api

    Chapter 4 API Reference Printer Search API API to search for printers. The following classes are available. ❏ Finder class ❏ EpsonIoException class Finder class Class to search for printers. The following APIs are available. Description Page start Starts searching for printers. stop End communication with the printer.
  • Page 96: Start

    start Starts a search for printers of the specified device type. • If you use this API, be sure to use stop (p.97) to stop the search. • You cannot call this API when a printer search is already in progress. Syntax ...
  • Page 97: Stop

    Chapter 4 API Reference stop Stops the printer search. Syntax public static synchronized void stop() throws EpsonIoException Exceptions When processing fails, EpsonIoException is thrown with one of the following error values. Error Value Description IoStatus.ERR_ILLEGAL This API was called when a search was not in progress. IoStatus.ERR_PROCESSING Could not execute process.
  • Page 98: Getresult

    getResult Gets the printer search result until the time when this API was called. This API cannot acquire Bluetooth devices that are already open. Syntax public static synchronized final String[] getResult() throws EpsonIoException Return value The list of devices found during search is returned. Identification information of the found devices is stored as a character string (String type) in the list....
  • Page 99: Getstatus

    Chapter 4 API Reference getStatus Gets the error value of the exception. Syntax public int getStatus(); Return value Returns the error value that is thrown with the exception. Error values are defined in the IoStatus class. Error Value Cause IoStatus.ERR_PARAM Invalid parameter was passed.
  • Page 101: Command Transmission/Reception

    Chapter 5 Command Transmission/Reception Command Transmission/Reception This chapter describes APIs for transmission and reception of commands (ESC/POS commands, etc.). A command transmission/reception API cannot be used with the Print class (p.40) of ePOS-Print API. Programming Programming Flow Perform programming following this flow. Printer search (p.28) ❏...
  • Page 102: Opening A Device Port

    Opening a Device Port Use the EpsonIo class's open (p.105) to open a device port. Please refer to the following code. //Initialize the EpsonIo class EpsonIo mPort = new EpsonIo(); int errStatus = IoStatus.SUCCESS; //Open the device port try { mPort.open(DevType.TCP, "192.168.192.168", null);...
  • Page 103: Receiving Data

    Chapter 5 Command Transmission/Reception Receiving Data Use the EpsonIo class's read (p.110) to receive data from the printer. Please refer to the following code. //Settings for receiving byte[] data = new byte[256]; int offset = 0; int size = 256; int timeout = 5000;...
  • Page 104: Exception Handling

    Exception handling A command transmission/reception API generates a propriety exception with an integer (int) type parameter when an error occurs and notify the calling side of such an error. Steps for Handling Use the EpsonIoException class's getStatus (p.99) to get the error value. Please refer to the following code. String str = "Hello, World!\r\n";...
  • Page 105: Command Transmission/Reception Api Reference

    Chapter 5 Command Transmission/Reception Command Transmission/Reception API Reference The following classes are available for command transmission/reception APIs: EpsonIo class Class to transmit and receive data. The following APIs are available. Description Page open Opens the device port. close Closes the device port. write Send data.
  • Page 106 Exceptions When processing fails, EpsonIoException is thrown with one of the following error values. Error Value Description IoStatus.ERR_OPEN Open processing failed. IoStatus.ERR_ILLEGAL User attempted to open a device that is already open. IoStatus.ERR_PROCESSING Could not execute process. IoStatus.ERR_PARAM Invalid parameter was passed. IoStatus.ERR_MEMORY Could not allocate memory.
  • Page 107: Close

    Chapter 5 Command Transmission/Reception close Closes the specified device port. Syntax public void close() throws EpsonIoException Exceptions When processing fails, EpsonIoException is thrown with one of the following error values. Error Value Description IoStatus.ERR_ILLEGAL This API was called when no device port was open. IoStatus.ERR_PROCESSING Could not execute process.
  • Page 108: Write

    write Sends data to a device port. Syntax  public int write (byte[] data, int offset, int size, int timeout) throws EpsonIoException Parameter  data : The sending data buffer. It stores data to be sent.  offset : Specifies the start position for sending data.  Please specify the offset value from the top of the sending data buffer.
  • Page 109 Chapter 5 Command Transmission/Reception Exceptions When processing fails, EpsonIoException is thrown with one of the following error values. Error Value Description IoStatus.ERR_ILLEGAL This API was called when no device port was open. IoStatus.ERR_PROCESSING Could not execute process. IoStatus.ERR_PARAM Invalid parameter was passed. IoStatus.ERR_CONNECT Connection error occurred IoStatus.ERR_MEMORY...
  • Page 110: Read

    read Receives data from a device port. This API continues receiving until a receiving error occurs. However, if not even a single byte of data is received during the period specified in timeout, the process ends. Syntax  public int read (byte[] data, int offset, int size,...
  • Page 111: Start

    Chapter 5 Command Transmission/Reception start Starts a search for printers of the specified device type. • If you use this API, be sure to use stop (p.112) to stop the search. • You cannot call this API when a printer search is already in progress. Syntax ...
  • Page 112: Stop

    stop Stops the printer search. Syntax public static synchronized void stop() throws EpsonIoException Exceptions When processing fails, EpsonIoException is thrown with one of the following error values. Error Value Description IoStatus.ERR_ILLEGAL This API was called when a search was not in progress. IoStatus.ERR_PROCESSING Could not execute process.
  • Page 113: Getresult

    Chapter 5 Command Transmission/Reception getResult This API acquires a list of devices that were found by search, up until the point this API was called. This API cannot acquire Bluetooth devices that are already open. Syntax public static synchronized final String[] getResult() throws EpsonIoException Return value The list of devices found during search is returned....
  • Page 115: Appendix

    Appendix Appendix Printer specifications TM-T88V 58mm 80mm Interface Ethernet, Wireless LAN Resolution 180 dpi x 180 dpi (W x H) Print Width 360 dots 512 dots Characters in a Line Font A ANK: 30 characters ANK: 42 characters Font B...
  • Page 116 List of Supported ePOS-Print APIs ePOS-Print API Page ePOS-Print API Page Builder Class Constructor clearCommandBuffer addTextAlign addTextLineSpace addTextRotate addText addTextLang addTextFont addTextSmooth addTextDouble addTextSize addTextStyle addTextPosition addFeedUnit addFeedLine addImage addLogo addBarcode addSymbol addPageBegin addPageEnd addPageArea addPageDirection addPagePosition addCut addPulse addSound addCommand Print Class Constructor...
  • Page 117: Tm-T70

    Appendix TM-T70 80mm Interface Ethernet, Wireless LAN Resolution 180 dpi x 180 dpi (W x H) dots Print Width Characters in a Line Font A ANK: 42 characters Font B ANK: 56 characters Character Size Font A ANK: 12 dots x 24 dots (W x H) Font B ANK: 9 dots x 17 dots (W x H) Character Baseline...
  • Page 118 List of Supported ePOS-Print APIs ePOS-Print API Page ePOS-Print API Page Builder Class Constructor clearCommandBuffer addTextAlign addTextLineSpace addTextRotate addText addTextLang addTextFont addTextSmooth addTextDouble addTextSize addTextStyle addTextPosition addFeedUnit addFeedLine addImage addLogo addBarcode addSymbol addPageBegin addPageEnd addPageArea addPageDirection addPagePosition addCut addPulse addCommand Print Class Constructor openPrinter...
  • Page 119: Tm-P60

    Appendix TM-P60 58mm 80mm Interface Bluetooth Resolution 203 dpi x 203 dpi (W x H) Print Width 420 dots 432 dots Characters in a Line Font A ANK: 35 characters ANK: 36 characters Font B ANK: 42 characters ANK: 43 characters Font C ANK: 52 characters ANK: 54 characters...
  • Page 120 List of Supported ePOS-Print APIs ePOS-Print API Page ePOS-Print API Page Builder Class Constructor clearCommandBuffer addTextAlign addTextLineSpace addTextRotate addText addTextLang addTextFont addTextSmooth addTextDouble addTextSize addTextStyle addTextPosition addFeedUnit addFeedLine addImage addLogo addBarcode addPageBegin addPageEnd addPageArea addPageDirection addPagePosition addPageLine addPageRectangle addCut addCommand Print Class Constructor openPrinter...
  • Page 121: Tm-U220

    Appendix TM-U220 76mm 69.5mm 57.5mm Interface Ethernet, Wireless LAN Resolution 160 dpi x 72 dpi (W x H) Print Width 400 or 385 dots 360 dots 300 or 297 dots Characters in a Line Font A ANK: 40 characters ANK: 36 characters ANK: 30 characters Font B ANK: 33 characters...
  • Page 122 List of Supported ePOS-Print APIs ePOS-Print API Page ePOS-Print API Page Builder Class Constructor clearCommandBuffer addTextAlign addTextLineSpace addTextRotate addText addTextLang addTextFont addTextStyle addFeedUnit addFeedLine addImage addCut addPulse addCommand Print Class Constructor openPrinter closePrinter sendData EposException Class getErrorStatus getPrinterStatus All the command transmission/reception APIs are supported.

This manual is also suitable for:

Tm-t70Tm-p60Tm-u220

Table of Contents