Home
ePOS-Print API
Contents
1. Add Add Add Hello tWorld n oo Print Characters z Add Horizontal Tab HT t Line Feed LF wn Carriage Retum CR r Back Slash s Language ANK O x Add Font Font A y Add Text Smoothing M Enabled Add Double Tl Double width Double height Add li Size Width Normal Height Normal Add Style T White Black Reverse Underline Fl Emphasized Color Color 1 y Add Position X Position 0 Add 3 llPaper By Unit Units 30 Add Feea By Line Lines 3 Add Drawer Kick out Connector Pin 2 y ON Time 100ms y Add Others Buzzer Pattern Pattern A 7 Repeat 1 Add 12345 Command Hexadecimal x00 xff Horizontal Tab HT t Line Feed LF n Carriage Retum CR Add EN A E 4 5 A URL http 192 168 192 168 cqi bin epos service cgi devid local_printer amp timeout 10000 E Send J Interval 3000 pra 7 Status onstatuschange Y ononline onoffline onpoweroff V oncoverok oncoveropen Stop Y onpaperok onpaperend onpapernearend Y ondrawerclosed ondraweropen Qu 160 QO N 7 8 Open the following URL page using the Web browser http Web server IP address sample epos print api html EPSON ePOS Print Sample Program appears Set ePOS Print API functions and click the Add button Hello tWorld n
2. pa Horizontal Tab HT t Line Feed LF n Carriage Return CR wr Back Slash Language ANK x Font Font A X Text Smoothing Enabled Double EDouble width C Double height Size Width Normal Height Normal Style E White Black Reverse Underline Emphasized Color Color 1 x Appendix The source code for the functions added in procedure 3 is disolayed in ePOS Print API sample code You can also copy it for use r Back Slash Y ePOS Print API Sample Code var canvas document getElementByld canvas var address http 192 168 192 168 cgi bin epos service cgi devid local_printer amp timeout 10000 var builder new epson ePOSBuilder builder addText Hello tWorld n builder addTextLang en builder addTextFont builder FONT_A builder addTextStyle true false false builder COLOR_1 builder brightness 1 0 builder halftone builder HALFTONE_DITHER Pe Enter the following URL into URL and click the Send button http IP address of TM intelligent printer cgi bin epos service cgi devid device ID of printer to be used for printing amp timeout timeout time builder brightness 1 0 builder halftone builder HALFTONE_DITHER Test Print URL ht1p 192 168 192 168 cgi bin epos service cgi devid local_printer timeout 10000 Esena
3. lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addVLineBegin 100 addVLineBegin 200 builder addFeedUnit 100 builder addVLineEnd 100 addVLineEnd 200 gt lt script gt lt script type text javascript src epos print 1 2 x js gt lt script gt Chapter 4 ePOS Print API addVLineEnd method Adds the end of vertical line to the command buffer Finishes drawing vertical lines Not available in page mode Q Use this API function with addVLineBegin p 87 Syntax addVLineEnd x style Parameter e x Required parameter Object type Number Specifies the end position of the vertical line in dots Specifies an integer from 0 to 65535 e style Optional parameter Object type String Specifies the type of the line you want to finish drawing Constant siye LINE_THIN Solid line Thin UNE MEDIUM Solid line Medium gt O LINE_THICK Solid line Thick UNE THIN DOUBLE Doubleline Thin O LINE_MEDIUM_DOUBLE Double line Medium LINETHICK DOUBLE Doubleline Thick undefined When not specified Solid line Thin Return value Return value Object type ePOS Print Builder Object ePOS Builder Exception pect pe Parameter is invalid Error 89 90 Example To draw thin vertical lines at 100 dots and 200 dots from the left e
4. Interval 3000 Caer The print result is displayed e from webpage Print Success A Code Status Print complete Status of the drawer kick number 3 connector pin H Sounding the buzzer limited model Xx d To enable the status event function click the Start button You can select the type for the event to send Test Print URL http 192 168 192 168 cqi bin eposiservice cqi devid local printer amp timeout 10000 Send Interval 3000 Status onstatuschange V ononline onoffline onpoweroff V oncoverok oncoveropen Y onpaperok onpaperend onpapernearend Y ondrawerclosed ondraweropen To disable the status event function click the Stop button 161 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 e Rendering Text canvas print text html p 162 e Rendering Images canvas print image html p 164 e Rendering Graphics canvas print graph html p 166 e Rendering Handwritten Images canvas print hand html p 168 e Rendering Barcode canvas print barcode html p 170 The Web pages introduced here are embedded into the sample program For the details about Q how to place them refer to Environment Settings p 26 Rendering Text canvas print text html Print text in HIM
5. 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 AN Otherwise the print data might not be printed completely Return value Return value Object type ePOS Print Builder Object ePOS Builder Exception Exception Object type Parameter is invalid Error 93 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 lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addPageBegin builder addPageArea 100 50 200 30 builder addText ABCDE builder addPageEnd gt lt script gt Chapter 4 ePOS Print API 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 Q Use this API function by inserting it between addPageBegin p 91 and PageEnd p 92 Syntax addPageDirection dir Parameter e dir Required parameter Object type String Specifies the print direction in page mode Constant c
6. Y epos open gt lt script gt oncoveropen event Registers a callback function to obtain a cover open event in Ver 1 2 and later Object type Function Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt 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 Y epos open gt lt script gt 149 onpaperok event Registers a callback function to obtain a paper remaining event in Ver 1 2 and later Object type Function O Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson CanvasPrint address epos onpaperok function alert paperok y epos open gt lt script gt onpapernearend event Registers a callback function to obtain a paper near end event in Ver 1 2 and later Object type Function O Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson
7. IP address of TM intelligent printer cgi bin epos service cgi devid device ID of printer to be used for printing amp timeout timeout time Mode Set the color mode Monochrome Grayscale Brightness Adjust the brightness Gamma value in the range 0 1 10 0 miae Set the halftone processing method for monochrome printing two tone Cut Paper When this item is selected feed cut is performed after printing The print result is disolayed 163 Rendering Images canvas print image html Draw an image in HTML5 Canvas and perform a test print r e J E C Users sawa Desktop X 2 EPSON ePOS Print Sample i we 83 Canvas Image Editing Sample Shop 2 Matsumoto Nagano a Position ty ix 100 y0 e E K Sf S Op ize gA La w200 h70 Y O E o Angle clockwise rotation with upper left origin 0 degree s Image File in the same server logo1 bmp Draw 3 Clear Reset Test Print http 192 168 192 168 cgi bin epos service cgi devid local_printer amp timeout 10000 4 Mode Monochrome Brightness 1 0 Halftone Monochrome Dither gt V Cut Paper k A Open the following URL page using the Web browser http Web server IP address sample canvas print image html 2 EPSON ePOS Print Sample Program appears Set
8. 1 To change the printer settings utility programs dedicated to each printer or other utility programs should be used T Allows printing by TM printers via TM intelligent printers 1 Provides ePOS Print API and ePOS Print Canvas API lt lt ePOS Print API gt gt e Allows device fonts to be used for printing e Allows barcode printing lt lt ePOS Print Canvas API gt gt e Allows printing of images rendered in HTML5 Canvas e Allows TrueType fonts to be used for printing 10 Chapter 1 Overview Print Example ePOS Print API Sample Shop Printing a Logo VERY VERY STORE GT xxxX XXX XXXX THANK YOU FOR SHOPPING WITH US Pevonment Center Paper Feed 101023 Orange juice 108956 Chocolate 000210 GT Special Subtotal To Stay Total Cash Change Due Paper Feed and Paper Cut Sample Shap Printing a raster image Matsumoto Nagano Your Number Printing text in the double sized width style Scale x 6 horizontal and x 4 vertical Alignment Center Please wait until your ticket number is called Mon Aug 01 2011 16 18 00 001 0 Printing a Barcode 0 11 ePOS Print Canvas API No 012301 Enjoy FREE Coffee Expires Mon Aug 01 2011 16 27 24 Monochrome or Grayscale Monochrome Chapter 1 Overview lt Web Server gt a l lt Printers that can be controlled gt Pere En Wireless LAN R
9. 10000 Print in grayscale Prints coupons in gray scale Default No 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 33 34 Programming Flow For the ePOS Print API programming is performed based on the following work flow 1 Embedding of ePOS Print API p 35 2 Print Document Creation p 36 LY To create a text print document p 37 LY To create a graphic print document p 38 m To create a page mode print document p 39 3 Transmission of Print Document p 40 4 Reception of Print Result 0 42 e The TM intelligent printer checks the status of the TM printer to be used for printing and then starts printing operation in Ver 1 2 and later e A status event helps check the status of the TM printer For
10. Appendix 4 Set the following and click the Print button fe iets A BN A URL Enter the following URL http IP address of TM intelligent printer cgi bin epos service cgi devid device ID of printer to be used for printing amp timeout timeout time Mode Set the color mode Monochrome Grayscale Brightness Adjust the brightness Gamma value in the range 0 1 10 0 seers Set the halftone processing method for monochrome printing two tone Cut Paper When this item is selected feed cut is performed after printing 5 The print result is displayed 169 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 Sel C Users sawa Desktop D X amp epson ePOS Print Sample AAA Canvas Bar Code Editing Position x5 y175 Module Size iw 3 h 162 IEAN13 JAN13 Data 201234567890 3 4 2 http 192 168 192 168 cgi bin epos service cgi devid local_printer amp timeout 10000 Mode Monochrome y Brightness 1 0 Halftone Monochrome Threshold z Y Cut Paper A Open the following URL page using the Web browser http Web server IP address sample canvas print barcode himl 2 EPSON ePOS Print Sample Program appears Set items on the right of the page The follo
11. CODE128 Two Dimensional Code PDF417 QR Code Ruled Line Not supported Paper Cut Cut Feed cut Drawer Kick Out Supported Buzzer Not supported 157 TM T90 58mm 60mm 80mm Interface Ethernet Wireless LAN Resolution 180 dpi x 180 dpi W x H Print Width 360 dots 384 dots 512 dots Font For more information about what character codes can be printed refer to the user s manual that came with the printer Characters in a Font A ANK 30 characters ANK 32 characters ANK 42 characters Line Font B ANK 40 characters ANK 42 characters 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 Font A At the 21st dot from the top of the character Baseline Font B At the 16 th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Second color Second color when two color printing is set Raster Image lt image gt Monochrome image Two color image Logo lt logo gt Monochrome image Two color image To perform two color printing change the settings of the printer using the memory switch setting utility Bar Code lt barcode gt UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODE339 ITF CODABAR CODE93 CODE128 Two Dimensional Code PDF417 lt symbol gt Ruled Line lt hline gt lt vline xxx gt Not supported Page Mode Default Area 360 dot
12. Parameter e x Required parameter Object type Number Specifies the horizontal print start position in dots Specifies an integer from 0 to 65535 Return value Return value Object type ePOS Print Builder Object ePOS Builder Exception Object ype Parameter is invalid Error Example To set the print position at 120 dots from the left end lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addTextPosition 120 gt lt script gt Chapter 4 ePOS Print API addFeedUnit method Adds paper feeding in dots to the command buffer Syntax addFeedUnit unit Parameter e unit Required parameter Object type Number Specifies the paper feed space in dots Specifies an integer from 0 to 255 Return value Return value Object type ePOS Print Builder Object ePOS Builder Exception Exception Object type Parameter is invalid Error Example To feed paper by 30 dots lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addFeedUnit 30 gt lt script gt 71 addFeedLine method Adds paper feeding in lines to th
13. xnn Control code Back slash Required parameter Object type String Specifies the two dimensional symbol type Constant type SYMBOL_PDF417_STANDARD 2D Code type Standard PDF417 SYMBOL_PDF417_TRUNCATED Truncated PDF417 SYMBOL_QRCODE_MODEL_ QR Code Model 1 SYMBOL_QRCODE_MODEL_2 QR Code Model 2 SYMBOL_MAXICODE_MODE_2 MaxiCode Mode 2 SYMBOL_MAXICODE_MODE_3 MaxiCode Mode 3 SYMBOL_MAXICODE_MODE_4 MaxiCode Mode 4 SYMBOL_MAXICODE_MODE_5 MaxiCode Mode 5 SYMBOL_MAXICODE_MODE_6 MaxiCode Mode 6 SYMBOL_GS1_DATABAR_STACKED GS1 DataBar Stacked SYMBOL_GS1_DATABAR_STACKED_ OMNIDIRECTIONAL GS1 DataBar Stacked Omnidirectional SYMBOL_GS1_DATABAR_EXPANDED_STACKED GS1 DataBar Expanded Stacked Chapter 4 ePOS Print API e level Optional parameter Object type String Specifies the error correction level Constant eve LEVEL_O PDF417 error correction level O LEVEL_1 PDF417 error correction level 1 LEVEL_2 PDF417 error correction level 2 LEVEL_3 PDF417 error correction level 3 LEVEL_4 PDF417 error correction level 4 LEVEL_5 PDF417 error correction level 5 LEVEL_6 PDF417 error correction level 6 LEVEL_7 PDF417 error correction level 7 LEVEL_8 PDF417 error correction level 8 LEVEL_L QR Code error correction level L LEVEL_M QR Code error correction level M LEVEL_
14. 192 168 cgi bin epos service cgi devid local_printer amp timeout 10000 Create an ePOS Print Canvas API object var epos new epson CanvasPrint address Print epos print canvas true lt script gt lt head gt lt body gt lt canvas id myCanvas width 512 height 480 gt lt canvas gt lt img id coffee src img coffee jpg alt gt lt img id wmark src img wmark png alt gt lt body gt lt html gt Q For the details about the printer end point address refer to Printer End Point Address p 41 48 Chapter 3 Programming Guide Reception of Print Result The print result can be received by setting a callback function using the onreceive property p 122 of the ePOS Print Canvas API object The following information is obtained e Print result e Error code e Printer Status Q 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 43 lt DOCTYPE html gt lt html gt lt head gt lt meta charset utf 8 gt lt title gt TITLE lt title gt lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt function drawCanvas Rendering in HTML5 Canvas lt Obtain the context gt var canvas document getElementByld myCanvas var c
15. 2 of the drawer kick out connector When not specified e time Optional parameter Object type String Specifies the ON time of the drawer kick signal PULSE_100 100 ms PULSE_200 200 ms PULSE_300 300 ms PULSE_400 400 ms 4 PULSE_500 500 ms undefined e 100 ms When not specified Return value Return value Object type ePOS Print Builder Object ePOS Builder Exception Object type Parameter is invalid Error 105 Example To send a 100msec pulse signal to the pin 2 of the drawer kick connector lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt 7 function buildMessage var builder new epson ePOSBuilder builder addPulse builder DRAWER_1 builder PULSE_100 gt lt script gt 106 Chapter 4 ePOS Print API addSound method Adds the turning on of the buzzer to the command buffer Sets the buzzer e Not available in page mode NA e The buzzer function and the drawer cannot be used together e This API function cannot be used if the printer is not provided with the buzzer Syntax addSound pattern repeat Parameter e pattern Optional parameter Object type String Specifies the buzzer pattern PATTERN_NONE Stop PATTERN_A Pattern A PATTERN_B Pattern B PATTERN_C Pattern C PATTERN_D Pattern D PATTERN_E P
16. 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addPageBegin builder addPageArea 100 50 200 100 builder addPagePosition 50 30 builder addText ABCDE builder addPageEnd gt lt script gt Chapter 4 ePOS Print API addPageLine method Adds line drawing in page mode to the command buffer Draws a line in page mode Diagonal lines cannot be drawn Q Use this API function by inserting it between addPageBegin p 91 and PageEnd p 92 Syntax addPageLline x1 yl x2 y2 style Parameter e xi Required parameter Object type Number Specifies the horizontal start position of the line in dots Specifies an integer from 0 to 65535 e yl Required parameter Object type Number Specifies the vertical start position of the line in dots Specifies an integer from 0 to 65535 e x2 Required parameter Object type Number Specifies the horizontal end position of the line in dots Specifies an integer from 0 to 65535 e y2 Required parameter Object type Number cSpecifies the vertical end position of the line in dots Specifies an integer from 0 to 65535 e style Optional parameter Object type String Specifies the line type Constant siie LINE_THIN Solid line Thin LINE_MEDIUM Solid line Medium LINE_THICK Solid line Thick LINE_T
17. 255 Return value Object ype ePOS Print Builder Object ePOS Builder Exception Exception 0 11 41013 Parameter is invalid Error Example To print barcodes lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addBarcode 01234567890 builder BAROCDE_UPC_A builder HRI_BELOW undefined 2 64 builder addBarcode 01234500005 builder BAROCDE_UPC_E builder addBarcode 201234567890 builder BAROCDE_EAN13 builder addBarcode 201234567890 builder BAROCDE_JAN13 builder addBarcode 2012345 builder BAROCDE_EAN8 builder addBarcode 2012345 builder BAROCDE_JAN8 builder addBarcode ABCDE builder BAROCDE_CODE39 builder addBarcode 012345 builder BAROCDE_ITF builder addBarcode A012345A builder BAROCDE_CODABAR builder addBarcode ABCDE builder BAROCDE_CODE93 builder addBarcode Babcde builder BAROCDE_CODE128 builder addBarcode 01 201234567890 builder BAROCDE_GS1_128 builder addBarcode 0201234567890 builder BAROCDE GS1_DATABAR OMNIDIRECTIONAL builder addBarcode 0201234567890 builder BAROCDE GS1_DATABAR TRUNCATED builder addBarcode 0201234567890 builder BAROCDE GS1_DATABAR LIMITED builder addBarcode 01 2012345678903 builder BAROCDE GS1_DATABAR EXPANDED gt lt sc
18. Canvas API brightness property Brightness correction value in Ver 1 2 and later 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 To set brightness as 2 2 lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var canvas document getElementById myCanvas var epos new epson CanvasPrint address epos brightness 2 2 epos print canvas gt lt script gt 143 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 144 Name Response message Object type Object Properties of the response object P Parameter J Name Object type success p 144 Print result Boolean code p 144 Error code String status p 145 Status Number e Value of success true or 1 Printing succeeded false or O Printing failed e Value of code Value Decription EPTR_AUTOMATICAL An automatically recoverable error occurred EPTR_COVER_OPEN A cover open error occurred EPTR_CUTTER An autocutt
19. Your Number ePOS Print API Sample Shop Matsumoto Nagano Your Number 0001 Please wait until your ticket number is called Mon Aug 01 2011 16 18 00 001 0001 the following e IP address of the intelligent printer Default 192 168 192 168 e Device ID of the target printer Default local_printer e Print timeout milliseconds gt Default 10000 e Prints coupons in gray scale in Ver 1 2 and later Default No Coupon ePOS Print Canvas API No 012301 Expires Mon Aug 01 2011 16 27 24 Chapter 2 Sample Program Program Flow From its initial display state up to print job completion the sample program flows as below Queue ticket number issuance ePOS Print API ee ee ee ee ea EIA 2 Settings IP address of the TM intelligent printer D Device ID of the printer to be controlled _J Print timeout time A ER RR RR AR AA E E E E E E E E E E E E E E E E E E E E E E AR 4 Creates print data ePOS Print Builder Object 5 Prints ePOS Print Object Action on the sample program Action on the customer dieras 23 24 Coupon issuance ePOS Print Canvas API ea oa 1 Open the sample program Web page A EEE E E E E E E EEE EEE EEE EEE E E E E E EEE E E E E E E E E E E E E E E E EEE EEE EEE EEE A A AS 4 2 Settings A D IP address of the TM intelligent printe
20. addImage context 0 0 canvas width canvas height gt lt script gt 111 brightness property Brightness correction value in Ver 1 2 and later 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 To set brightness as 2 2 lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder var canvas document getElementById canvas if canvas getContext var context canvas getContext 2d builder brightness 2 2 builder addImage context 0 0 canvas width canvas height gt lt script gt 112 Chapter 4 ePOS Print API 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 To clear the command and reset it to the initial state lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addText ABCDE builder message gt lt script gt 113 ePOS Print Obj
21. addTextDouble Adds a tag for specifying the double sized 65 text setting addtTextSize Adds a tag for the text scale setting 67 adaTextStyle Adds a tag for the text style setting 68 addTextPosition Da a tag for specifying the print position of 70 addFeedUnit Adds a tag for paper feeding in dots 71 Paper Feed addFeedLine Adds a tag for paper feeding in lines 12 Boe addlImage Adds a tag for a raster image to be printed 73 addLogo Adds a tag for an NV logo to be printed 78 adaBarcode Adds a tag for a bar code to be printed 76 Barcode ADS ped tag for a two dimensional code to 80 be printed 54 femen A Deseripion POSS Method addHLine Adds a tag for a horizontal line to be printed 85 Ruled line addVLineBegin Adds a tag for starting a vertical line 87 addVLineEnd Adds a tag for finishing a vertical line 89 addPageBegin Adds a tag for switching to page mode 91 addPageEnd Adds a tag for finishing page mode 92 addPageArea Adds a tag for specifying the print area in 93 page mode addPageDirec Adds a tag for specifying the print direction 95 Pagemode tion in page mode addPagePosition Adds a tag for specifying the print position in 97 page mode addPageLine Adds a tag for drawing a line in page mode 99 addPageRectan Adds a tag for drawing a rectangle in page 101 gle mode Cut addCut Adds a tag for paper cut
22. details on the procedure refer to Reception of Status Event p 44 in Ver 1 2 and later O Chapter 3 Programming Guide 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 1 2 x js The ePOS Print API is used by embedding epos print 1 2 x js into applications Preparation To use the ePOS Print API place epos print 1 2 x js on the Web server Embedding into Web pages Embed the script into the Web page by using the HTML lt script gt tags lt DOCTYPE html gt lt html gt lt head gt lt meta charset utf 8 gt lt title gt TITLE lt title gt lt script type text javascript src epos print 1 2 x js gt lt script gt Embed lt script type text javascript gt function buildMessage var builder new epson ePOSBuilder lt script gt lt head gt lt body gt lt body gt lt html gt 35 Print Document Creation A print document is created using an ePOS Print Builder object Create an ePOS Print Builder object using the constructor for it create a print document using the object s methods and then acquire that print document using the toString method For details refer to List of API functions 0 53 Refer to the following program for print document creation lt DOCTYPE html gt lt html gt l
23. is eae ir A E EEC a 128 ONPAPEITeNdA Ve RE 129 ondrawerclosed VE Tiiocciinci dra ci Eaa 129 ONCIOAWESODEN VB T E E 130 ePOS Print Canvas API 0 cceceeceecceececcceccecceceeecuceeeeeeseueauseneans 131 E List of ePOS Print Canvas API fUNCHONS ooocccconccccccconononcncccnnnnnnnnncnononannnnnnnnnnnnnnnnnnnnn 131 window epson CanvasPrint COMPONENTS dccccccocnnnccnonnnnnnnononnnoncnnonnnonnrnnonn non rnrnonnn rn rr nro nr rn rn nconnrnnnn ss 131 E ePOS Print Canvas API ODjeCT ccccccesseeeeceeeesseeeeeeeeesseneeeeeeeseseeeeeeeesseeeeeseneeseneeaeeees 133 EAU a e na ae Ed 133 O A TN NN 134 A assccsss cee senevtsaccevapetnatseuatschondeenapuirentsetgasdetmatincseradnavte ne yaghs E A ianaeths 136 elos MEN Od shinai ala iia ai A A adn haart ideo 137 addres DIO DSI co 138 enabled proper usin akan A vis Gil iva i Wa odd eee 139 Merval OIODSIAY saiaiasseates A tnsactabes acess sebalessaeaPaiauideasatindessnincedsadayacs sduadem shes Saca E 140 STATUS POP Vita rat e il niin mista did aiid A atic 14 halftone Property iascisencsccccet cats deca sta scnceihbaal sath ON 142 right ropeya haia A Add CA A A dsd 143 OO COM Un ma AE E Slds don Cae Pdn sala Esc 144 A O 146 ONSTATUSCNANGE EVenf oe rrrrrrrrrrrr 147 ONO INS Vita ad da baat hades ded een A aetna IE ESA 147 OOOO E a e ai ANANA aT ania 148 ONPOWGEIOT EVEM iii ar dad ante ed Pi ra abun a dt nes 148 ONCOVETOK EVEN i corrio 149 ONCOVETOPENNE VEN Titi A gua eh AA
24. is not supported Error Canvas is not supported Error 134 Chapter 5 ePOS Print Canvas API Example To print Canvas ID myCanvas lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function printCanvas var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var canvas document getElementBylId myCanvas var epos new epson CanvasPrint address epos onreceive function res alert res success epos onerror function err alert err status epos print canvas gt lt script gt 135 open method Enables status event operation in Ver 1 2 and later 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 lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt 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 startMonitor epos open function stopMonitor epos close gt lt script gt 136 Chapter 5 ePOS Print Canvas API close method Disables status event opera
25. mode lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addPageBegin builder addText ABCDE builder addPageEnd gt lt script gt Chapter 4 ePOS Print API 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 2 Use this API function by inserting it between addPageBegin p 91 and PageEnd p 92 Syntax addPageArea x y width height Parameter e 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 e 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 e width Required parameter Object type Number Specifies the width of the print area in dots Specifies an integer from 0 to 65535 e height
26. scalability enables users to build versatile POS systems The system is compatible with all types of EPSON POS printers excluding the TM C100 and displays Moreover its flexibility makes it easy to upgrade the future The functionality and the user friendliness is valued around the world Copyright 2011 2012 Seiko Epson Corporation All rights reserved For Safety AO OS The symbols in this manual are identified by their level of importance as defined below Read the following carefully before handling the product Provides information that must be observed to avoid damage to your equipment or a malfunction Restriction of Use Provides important information and useful tips 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 evaluati
27. script gt src epos print 1 2 x js gt lt script gt Chapter 4 ePOS Print API onpaperend event Registers a callback function to obtain a paper end event in Ver 1 2 and later Object type Function O Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson ePOSPrint address epos onpaperend function alert paperend Y epos open gt lt script gt ondrawerclosed event Registers a callback function to obtain a drawer close event in Ver 1 2 and later Object type Function O Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt gie var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson ePOSPrint address epos ondrawerclosed function alert drawerclosed Y epos open gt lt script gt 129 ondraweropen event Registers a callback function to obtain a drawer open event in Ver 1 2 and later Object type Function O Example lt script type text javascript lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new
28. script gt lt script type text javascript gt 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 var request builder toString var address http 192 168 192 168 cgi bin epos service cgi devid local_printer amp timeout 10000 Create an ePOS Print object var epos new epson ePOSPrint address Set a response receipt callback function epos onreceive function res When the printing is not successful display a message if res success alert A print error occurred Send the print document epos send request Print result receipt callback function lt script gt lt head gt lt body gt lt body gt lt html gt Chapter 3 Programming Guide Error handling Refer to the following program for the error handling method by a callback function Create an ePOS Print object var epos new epson ePOSPrint address Set a response receipt callback function epos onreceive function res Obtain the print result and error code var msg Print res success Success Failure nCode res code nStatus n Obtain the printer status var asb res status if asb amp epos ASB_
29. subsequent data is processed as the primary message In other cases from the first piece of data data is processed as the primary message In Mode 2 specify the primary message in the following format MaxiCode Mode 6 Postal code 1 to 9 digit number GS x1d ISO country code 1 to 3 digit number GS x1d Service class code 1 to 3 digit number In Mode 3 specify the primary message in the following format Postal code 1 to 6 pieces of data convertible by Code Set A GS x1d ISO country code 1 to 3 digit number GS x1d Service class code Cl to 3 digit number GS1 DataBar Stacked Convert the character string to the string in UTF 8 apply the escape sequence and then encode the string GS1 DataBar Stacked Omnidirectional Specify a 13 digit global trade item number GTIN not including an application identifier Al or a check digit Convert the character string to the string in UTF 8 apply the escape sequence and then encode the string You can enclose an application identifier Al in parentheses The parentheses are used as HRI print characters and are not encoded as data Co ice ie clr Epenisa iste te To encode each of the following characters specify two characters starting with the character FNC1 q C 0 81 82 e type To specify binary data that cannot be represented by character strings use the following escape sequences ESA eee AO Ol
30. the following procedure A Start the Web server 2 Explode the sample program ePOS Print_API_UM_E_Sample zip and then copy the exploded contents into the following folder Example Web server configured by using IIS System drive Inetoub wwwroot Q Copy the sample program as a user with administrator authority 27 28 Network Settings for the TM Intelligent Printer Use TMNet WebConfig to configure the network settings such as IP address for the printer MA lt gt TCP IP Setting Wired Get IP Address Manual y Set using Automatic Private IP Addressing APIPA Disable IP Address 192 168 11 100 Subnet Mask 255 255 255 0 Default Gateway 192 168 11 1 Acquire DNS Server Address Automatically Configuration DNS Server Address Submit Configure the settings according to the following procedure A Connect the printer to the network and turn the power ON 2 Start the Web browser and type the IP address of the TM intelligent printer interface into the address bar 2 The default value for the IP address of the TM intelligent printer is 192 168 192 168 3 TMNet WebConfig starts Select as Configuration Wired Wireless TCP IP 4 The TCP IP Setting screen appears Configure the network settings for the TM intelligent printer and click Submit 5 Print the status sheet using the TM intelligent p
31. 103 lea adaPulse Adds a tag for the drawer kick out 105 Buzzer addSound Adds a tag for turning on the buzzer 107 ae d addCommand Raster image halftone processing method 109 cl toString Raster image brightness correction value 110 Property Raster image halftone processing method halftone 111 in Ver 1 2 and later f Raster image brightness correction value brightness 112 in Ver 1 2 and later message Message buffer 113 Constant FONT_ font ALIGN_ alignment COLOR_ color specification HALFTONE_ Halftone type in Ver 1 2 and later MODE_ Color mode in Ver 1 2 and later BARCODE_ bar code type HRI_ HRI position SYMBOL_ two dimensional code type EVE error correction level Chapter 4 ePOS Print API E AR escripton Page LINE_ line style DIRECTION_ page mode print direction CUT_ paper cut type DRAWER_ drawer kick out connector PULSE_ drawer kick out pulse length PATTERN_ buzzer sound pattern 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 mina Y Unit Specify numbers in dots for units that represent length Print position paper feed space width and height of images and barcodes etc UU Range Depending on the printer specifications a specifiable range is predetermined For details refer to Printer specifications p 153 11 Resolution The resol
32. 6 324 lt Render text gt context textAlign center context textBaseline alphabetic context font bold normal normal 48px Times New Roman serif context i11Text FREE Coffee 256 224 lt script gt lt head gt lt body gt lt canvas id myCanvas width 512 height 480 gt lt canvas gt lt img id coffee src img coffee jpg alt gt lt img id wmark src img wmark png alt gt lt body gt lt html gt 47 Prints an Canvas image Content drawn in HTML5 Canvas is printed using the ePOS Print Canvas API Create an ePOS Print Canvas API object using the constructor for the Print method specify the end point address for the printer to be used for printing as well as the canvas content and whether to select paper cut and then print a document For the details about the printer end point address refer to Printer End Point Address p 41 Refer to the following program lt DOCTYPE html gt lt html gt lt head gt lt meta charset utf 8 gt lt title gt TITLE lt title gt lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt function drawCanvas Rendering in HTML5 Canvas lt Obtain the context gt var canvas document getElementByld myCanvas var context canvas getContext 2d Transmission of print document Set the end point address var address http 192 168
33. 7890 builder SYMBOL_ GS1_DATABAR STACKED builder addSymbol 0201234567890 builder SYMBOL GS1_DATABAR STACKED OMNIDIRECTIONAL builder addSymbol 01 02012345678903 builder SYMBOL _GS1_ DATABAR EXPANDED STACKED gt lt script gt Chapter 4 ePOS Print API addHLine method Adds horizontal line printing to the command buffer Draws horizontal lines Not available in page mode Syntax addHLine x1 x2 style Parameter e xl Required parameter Object type Number Specifies the start position of the horizontal line in dots Specifies an integer from 0 to 65535 e x2 Required parameter Object type Number Specifies the end position of the horizontal line in dots Specifies an integer from 0 to 65535 e style Optional parameter Object type String Specifies the line type LINE_THIN Solid line Thin LINE_MEDIUM Solid line Medium LINE_THICK Solid line Thick LINE_THIN_DOUBLE Double line Thin LINE_MEDIUM_DOUBLE Double line Medium LINE_THICK_DOUBLE Double line Thick undefined When not specified Solid line Thin Return value Return value Object type ePOS Print Builder Object ePOS Builder Exception Exception Object type Parameter is invalid Error 85 86 Example To draw double horizontal lines in the following positions e Between 100 dots and 200 dots from the left end e Between 400 dots and 500 d
34. A A ae a Pe ib 149 OMPAUPSTOK EVENT is aanas isina aia rinadi ida raa le Edad A dnd Ei 150 ONPAPEMMEarend SVEN TS aireari nin a AKE tices Wea dead nae uae a CAE E ee 150 ONPAPETENC COVENT oi EE EE eee neeenneeeenie 151 ONGIAWEICIOSEC OVEN arica db rd fine deine boi decsndensl Gav bae e a 151 ONAraWwWeropen reinan adonde 152 o A staid toc cc a aa aad ia 153 E Printer specifications enunciare iie ii 153 IMT ON al A AA E E E E Ea 153 IMSS Vinia ed 155 IMA EA dein igen nian a 156 Mitad asada hited 157 TM AA AAA 158 E ePOS Print API code creation tool ccccnnnccccnnononoccccccnononncncnnnnnnnnnnnnnnnnnnnnnn nn nnnnnannnnnnn 160 HOW TO USC ici dde ic dl clado p dida 160 E Rendering in HTML5 CONMVAS cococcccconnccccnonnccnnancccnnnancnnnnnncnnnnnnnnnnnnnnnnn cnn nana rnne rre 162 Rendering Text CANVAS PriINT TEXT ATM innnciconncccnnocnicn nono kinti knti rro rr rra rr rr 162 Rendering Images CANVAS PrINT IMAGE NTMI raro nono rro rr rr rra 164 Rendering Graphics CANVAS PriNT GrAPN ATM sitiena 166 Rendering Handwritten Images CANVAS PriINT NANC NTM oo ee eerie 168 Rendering Barcode Canvas print Dbarcode ATM wr ee eerie 170 Chapter 1 Overview Overview This chapter describes the features of and the specifications for ePOS Print Overview of ePOS Print ePOS Print is functionality to control POS printers in a multi platform environment Using ePOS Print data can be directly printed from Web browsers on personal com
35. CanvasPrint address epos onpapernearend function alert papernearend y epos open as lt script gt 150 Chapter 5 ePOS Print Canvas API onpaperend event Registers a callback function to obtain a paper end event in Ver 1 2 and later Object type Function O Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson CanvasPrint address epos onpaperend function alert paperend Y epos open gt lt script gt ondrawerclosed event Registers a callback function to obtain a drawer close event in Ver 1 2 and later Object type Function O Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson CanvasPrint address epos ondrawerclosed function alert drawerclosed Y epos open gt lt script gt 151 ondraweropen event Registers a callback function to obtain a drawer open event in Ver 1 2 and later Object type Function O Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text
36. EPSON EXCEED YOUR VISION ePOS Print API Ver 1 2 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 Canvas API Describes the ePOS Print CanvasAPI Appendix Describes the specifications for printers used for ePOS Print how to use the ePOS Print API code creation tool and the rendering of images in HTML5 Canvas M00042101 Rev B 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 e The contents of this document are subject to change without notice Please contact us for the latest information e While every precaution has taken in the preparation of this document Seiko Epson Corporation assumes no responsibility for errors or omissions e 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
37. Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt los var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson ePOSPrint address epos onoffline function alert offline Y epos open gt lt script gt onpoweroff event Registers a callback function to obtain a non response event in Ver 1 2 and later Object type Function O Example lt script type text javascript lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson ePOSPrint address epos onpoweroff function alert poweroff Y epos open gt lt script gt src epos print 1 DE j s gt lt script gt 126 Chapter 4 ePOS Print API oncoverok event Registers a callback function to obtain a cover close event in Ver 1 2 and later Object type Function O Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson ePOSPrint address epos oncoverok function alert coverok Y epos open gt lt script gt oncoveropen event Registers a ca
38. HIN_DOUBLE Double line Thin LINE_MEDIUM_DOUBLE Double line Medium LINE_THICK_DOUBLE Double line Thick undefined Solid line Thin When not specified Return value Return value Object type ePOS Print Builder Object ePOS Builder Exception Object type Parameter is invalid Error 99 Example To draw a thin solid line between the start position 100 0 and the end position 500 0 lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt te oa function buildMessage var builder new epson ePOSBuilder builder addPageBegin builder addPageLine 100 0 500 0 builder LINE_THIN builder addPageEnd gt lt script gt 100 Chapter 4 ePOS Print API addPageRectangle method Adds rectangle drawing in page mode to the command buffer Draws a rectangle in page mode Q Use this API function by inserting it between addPageBegin p 91 and PageEnd p 92 Syntax addPageRectangle x1 yl x2 y2 style Parameter e xt Required parameter Object type Number Specifies the horizontal start position of the line in dots Specifies an integer from 0 to 65535 e yl Required parameter Object type Number Specifies the vertical start position of the line in dots Specifies an integer from 0 to 65535 e x2 Required parameter Object type Num
39. HTML5 Canvas image contains images downloaded from different domains you cannot NM print the image In this case a security error occurs due to violation of the same origin policy of JavaScript Syntax addImage context X y width height color mode Parameter e context Required parameter Object type Context Specifies the 2D context of HTML5 Canvas e x Required parameter Object type Number Specifies the horizontal start position in the print area Specifies an integer from 0 to 65535 e y Required parameter Object type Number Specifies the vertical start position in the print area Specifies an integer from 0 to 65535 4 e width Required parameter Object type Number Specifies the width of the print area Specifies an integer from 0 to 65535 e height Required parameter Object type Number Specifies the height of the print area Specifies an integer from 0 to 65535 e color Optional parameter Object type String Specifies the color SA iO COLOR_NONE Characters are not printed COLOR_1 default First color COLOR_2 Second color COLOR_3 Third color COLOR_4 Fourth color undefined i a First color When not specified 73 74 e mode Optional parameter Object type String Specifies the color mode in Ver 1 2 and later MODE_MONO Monochrome two tone MODE_GRAY16 Gray scale 16 tone undefined l Monochrome two tone Whe
40. L5 Canvas and perform a test print r Sa J E C Users sawa Desktop O X EPSON ePOS Print Sample X im r ES Canvas Text Editing Hello World q Hello World xo y24 Hello World et ello World Hello World Style bold italic E small caps font size 24 px line height 30 px font family Arial sans serif text baseline alphabetic v Reset Test Print http 192 168 192 168 cgi bin epos service cgi devid local_printer amp timeout 10000 Mode Monochrome Brightness 1 0 Halftone Monochrome Threshold y EI Cut Paper Open the following URL page using the Web browser http Web server IP address sample canvas print text html 162 Appendix EPSON ePOS Print Sample Program appears Set items on the right of the page The following items can be set Position Specify the rendering coordinates Text Specify the text to be printed Style Specify the text style Clear Clears the image drawn in the Canvas Reset Clears the image drawn in the Canvas In addition the settings are reset to their default values Click the Enter button The text is printed on Canvas on the left of the page according to the settings made on the right of the page Set the following and click the Print button A URL Enter the following URL http
41. NO_RESPONSE msg No printer response n if asb amp epos ASB_PRINT_SUCCESS msg Print complete n if asb epos ASB_DRAWER_KICK msg Status of the drawer kick number 3 connector pin H n if asb amp epos ASB_OFF_LINE msg Offline status n if asb amp epos ASB_COVER_OPEN msg Cover is open n if asb amp epos ASB_PAPER_FEED msg Paper feed switch is feeding paper n if asb epos ASB_WAIT_ON_LINE msg Waiting for online recoveryWn if asb epos ASB_PANEL SWITCH msg Panel switch is ON n if asb epos ASB_MECHANICAL_ERR msg Mechanical error generatedWn 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 amp 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 amp 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 amp epos ASB_SPOOLER_IS_STOPPED msg Stop the spoolerin Display in the dialog box alert msg 43 Reception of Status Event The status event
42. PI place epos print 1 2 x js on the Web server Embedding into Web pages Embed the script into the Web page by using the HTML lt script gt tags lt DOCTYPE html gt lt html gt lt head gt lt meta charset utf 8 gt lt title gt TITLE lt title gt lt script type text javascript src epos print 1 2 x js gt lt script gt Embed lt script type text javascript gt function drawCanvas lt script gt lt head gt lt body gt lt body gt lt html gt Chapter 3 Programming Guide Rendering in HTML5 Canvas Render an image in HTML5 Canvas lt DOCTYPE html gt lt html gt e Rendering in HTML5 Canvas lt meta charset utf 8 gt lt title gt TITLE lt title gt lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt function drawCanvas Rendering in HTML5 Canvas lt Obtain the context gt var canvas document getElementByld myCanvas var context canvas getContext 2d lt Render an image gt context clearRect 0 0 512 480 context drawImage document getElementByld coffee 0 O 512 384 context fillStyle rgba 255 255 255 0 5 context fillRect 0 0 512 480 context fillStyle rgba 0 0 0 1 0 lt Render a water mark for the image gt context drawImage document getElementByld wmark 0 0 context drawImage document getElementByld wmark 25
43. Q QR Code error correction level Q LEVEL_H QR Code error correction level H LEVEL_DEFAULT Default level e Select the level according to the two dimensional symbol type 3 e For MaxiCode and two dimensional GS1 DataBar select LEVEL_DEFAULT e width Optional parameter Object type Number Specifies the module width Specifies an integer from 0 to 255 MaxiCode is ignored gt e height Optional parameter Object type Number Specifies the module height Specifies an integer from 0 to 255 QR Code and MaxiCode are ignored gt e size Optional parameter Object type Number Specifies the two dimensional symbol maximum size Specifies an integer from 0 to 65535 QR Code and MaxiCode are ignored gt 83 84 Return value Object iype ePOS Print Builder Object ePOS Builder Exception Exception Object type Parameter is invalid Error Example To print two dimensional symbols lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addSymbol ABCDE builder SYMBOL_PDF417_STANDARD builder addSymbol ABCDE builder SYMBOL_QRCODE_MODEL_2 builder LEVEL_Q builder addSymbol 908063840 x1d850 x1d001 x1d x04 builder SYMBOL_MAXICODE_MODE_2 builder addSymbol 020123456
44. STATUS EVO Peri OA nit dd RA aS a a A ci 44 E ePOS Print Canvas AP isis cion ill otseosecnceteeeleeceseesseaeenss 45 Embedding of ePOS Print Canvas API Ee ren iieniieeei 46 Rendering in HIMLS Canvass iacin adic wi dt adda dt PA A rebated 47 Prints AN CONVOS IMAGE ron rro rr 48 Reception OF Print Res aiii a Aa ain diel 49 RECEPTION otros tatu EVEN iras ias Talla a diss siasiae iaavdblaatiaadsiisa baie laa TENE NEELIE ET RETS 51 ePOS lt PAOTAP uta nada 53 Ml ListofAPIfUNCRONS 0uiucaioi aia 53 window epson ePOSBuilder COMPONENTS cccccooocnncccnonnnononononanoncnnoononnnnnnonnn nn ro nonn rr nr rronn nr nn rr rnonnnnncnn ns 53 window epson ePOSPrint COMPONENTS ocicocccccoonnnnncnonnnnnnncononannnnonoon nn nro rnnnn nn rro ronn nr rr rrnnnn nr nrrrronnrnncnn ns 55 E ePOS Print Builder Object iomocicioiiaccicitoniidcci daniela caia 57 COPSTIUCTOR iia dnc A A A AA a 57 addaTextAligh metodina ihe a atea 58 addiextlinespace meio ai AAA a tei 59 adaTextRotaie method ei oina ata tyrants hack estate tie aaa Ie as 60 ole lo ESTAN ALOIS nascar cio A E E teltidiins tal E Neaaimenl Weed aden tees 6l CAETEXTLENGIMEM OG rse ao iria a A EE a 62 ad ateo Mmeo Gyorsan ar a eens N nia ian N 63 adadlextSmoothi method in e A os 64 addlextDo ble Meta e al E a a 65 AdaTextSizo Method amv to a a a a deal shee ee ean 67 addilexiStyle Mediana Ao 68 adaTextRositon Med sprint aos 70 addFeedUnt method ne rea A LO ea 71 adarFecaLine methods aa
45. a lidia peta es a 72 GAGIMAGS MENO miii ta A 73 adalodo method ii as 75 adaBarcodes MENON sta a Sa 76 adaSymbal Method tarta e ade 80 GAEHLINE MENA ue Pi lai gi Oa eee lene a ete ada eae 85 GQCAVLNEBEGIN method x viene Awe ine dia nia hs waa owed aia ota ai Aa aes 87 adaWVLineEnd MEMO uu edad Aout drain suis deal nti hana bei 89 adaPagsBEgln MENO dgan as 91 adardgsEndiMe Ova pes tebis a aa 92 GddPageAred MeO ini AECA 93 GAEGPAGEDIrSCHON MT Avira esse 95 adaPagePositioniMeiO dias 97 adaPagelns Metodista oro da aiid 99 QAOPAGERECTANGIS Medina AO tena Aa ESAS 101 co AN 103 adaRuise Metod iaa 105 GAGSOUNG Me Odin rodada 107 GAdICOMMANE MEINOG a A A s 109 TOSTFING MOMO sia o dic 110 DATOS POPE poa isa 111 brightness Properties 112 MESSAGES PIODEMY sui cit are ieee ava Sees bee daa 113 Ml GPOS PrintODjeCh E 0 casos vee Sea ivan ii ino 114 CONTO id Sapos boda 114 SENG MEINOG init E dia EA E AD a 115 OPEN IM MO do e A ela 116 Sloss META iia A A e Aa 117 AA POE a ias 118 enabled POPE Vi A A ATA AN cae 119 interval Property A 120 STOTUS Proper ii A van i Aba obtain lala Ta 121 ONTOCONMS UM atra ds clado 122 US NN 124 ONSTATUSCNANGE SVEN nina rr rr rr 125 Onnline Sven iin wea ae Gi an A A A e A AE dae doo 125 OMOMIMES Ma idas A IES rei 126 NPDOWETO EVEN topon a ii a AA wince 126 ONCOVETSOK OVEN EEE EE eee eee 127 ONCOVEOPEN EVENT ii alah A Gis aaa a aa Glial dae oi ida dd 127 OMPAUPSIOK di a ido 128 ONPGPESMEGIENd SV is
46. addText Hello World builder addCut var request builder toString var address var epos epos onreceive var success var code res code var status res status alert success epos send request gt lt script gt http 192 168 1 new epson ePOSPrint function res res success src epos print 1 Re cee j S gt lt script gt lder n 92 168 cgi bin epos service cgi devid local_printer address 123 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 124 Name Communication error information Object type Object Properties of the error object property TT status HTTP Status Number responseText Response text String Example To create and send a print document To display the HTTP status code in a message box when a communication error occurs lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function printHellowWorld var builder new epson ePOSBuilder builder addText Hello World n builder addCut var request builder toString var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson ePOSPrin
47. amming Guide Printer End Point Address Specify the printer end point address in the following format http domain cgi bin epos service cgi devid device ID amp timeout timeout time Items to specify Domain Description Specify either the IP address or the domain name of the TM intelligent printer Device ID Specifies the printer to be used for printing Specify the Device ID registered using the TM intelligent printer s TMNet WebContfig Timeout period Specifies the time to abort the process in milliseconas The timeout parameter is optional when it is omitted 60 seconds 60000 is set When the timeout period elapses the print job is canceled the data already interpreted by the printer before the start of the print abort process is printed 41 Reception of Print Result The print result can be received by setting a callback function using the onreceive property p 122 of the ePOS Print object The following information is obtained e Print result e Errorcode e Printer status Q 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 43 lt DOCTYPE html gt lt html gt lt head gt lt meta charset utf 8 gt lt title gt TITLE lt title gt lt script type text javascript src epos print 1 2 x js gt lt
48. anvas document getElementById myCanvas var epos new epson CanvasPrint address epos onerror function err var status err status var text err responseText alert status Y epos print canvas gt lt script gt 146 Chapter 5 ePOS Print Canvas API onstatuschange event Registers a callback function to obtain a status change event in Ver 1 2 and later Syntax Function status Parameter of the callback function Parameters status Name Status Object type Number Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt Sis var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson CanvasPrint address epos onstatuschange function status alert status Y epos open gt lt script gt ononline event Registers a callback function to obtain a online event in Ver 1 2 and later Object type Function O Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson CanvasPrint address epos ononline function alert online Y epos open gt lt script gt 147 onoffline event Registers a callback fu
49. aracters 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 Font A At the 21st dot from the top of the chara Font B At the 15th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 512 dots x 1662 dots W x H Page Mode Maximum Area 512 dots x 1662 dots W x H mv Raster image Monochrome image Logo Monochrome image Bar Code UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODE339 ITF CODABAR CODE93 CODE128 Two Dimensional Code PDF417 QR Code Ruled Line Not supported Paper Cut Cut Feed cut Drawer Kick Out Supported Buzzer Not supported 156 Appendix TM T70 80mm Interface Ethernet Wireless LAN Resolution 180 dpi x 180 dpi W x H Print Width 512 dots 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 Font A At the 21st dot from the top of the chara Font B At the 15th dot from the top of the character Default Line Feed Space Color Specification 30 dots First color Page Mode Default Area 512 dots x 1662 dots W x H Page Mode Maximum Area 512 dots x 1662 dots W x H mv Raster image Monochrome image Logo Monochrome image Bar Code UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODESO ITF CODABAR CODE93
50. attern E PATTERN_ERROR Error sound pattern PATTERN_PAPER_END Pattern when there is no paper undefined Pattern A When not specified e repeat Optional parameter Object type String Specifies the number of repeats 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 Q specify PATTERN_NONE for pattern Return value Return value Object type ePOS Print Builder Object ePOS Builder 107 Exception Object iype Parameter is invalid Error Example To repeat the sound pattern A three times lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addSound builder PATTERN_A 3 gt lt script gt 108 Chapter 4 ePOS Print API addCommand method Adds commands to the command buffer Sends ESC POS commands Q ESC POS commands are not made public For details contact the dealer Syntax addCommand data Parameter e data Optional parameter Object type String Specifies ESC POS command as a character string Return value Return value Object type ePOS Print Builder Object ePOS Builder Exception Exception Objec
51. avascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function printHellowWorld var builder new epson ePOSBuilder builder addText Hello World n builder addCut var request builder toString var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson ePOSPrint address epos onreceive function res alert res success epos onerror function err alert err status epos send request gt lt script gt 115 open method Enables status event operation in Ver 1 2 and later 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 lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson ePOSPrint address epos oncoveropen function alert coveropen function startMonitor epos open function stopMonitor epos close gt lt script gt 116 Chapter 4 ePOS Print API close method Disables status event operation in Ver 1 2 and later Syntax close Example lt script type text javascript lt script
52. b Application Into a TM Intelligent Printer ninio nnnnnncinnaconiorcrnnarrrrrn rra 17 E Contents in he POCkKagEe c cicoccnoocccccninnac E T atacada 18 E RestrICISIONS iii id da 19 Sample Prod Misa ai 21 E Sample Program System Overview oooooooocccconocccoccconoonnncccnononnnnnnncnnnnnnnnnnnnnnnnnnnnnnnnnrnnanannnnos 21 Sample Program Se inccicccccionarono coronario nono ron 21 Prine IMAGE ita AA a AB iva a 22 PFO GIGI FIQW sscaaics ANS 23 E Operating Environment cccccceceeeeceeeeeeeeeeceeeeeeeeeeeeeeeeeesesaeseseeeeeessaaeeeseeeeeseeeeeeseeneeeeeee 25 E Environment S ng S an secccrssiee dec cit id ide 26 Registration of Sample Program ePOS Print_APIUM_E_SOmMp le Zip c oonminiocinninnicionicinnnorincnonnnno 27 Network Settings for the TM Intelligent Printer ree rer nner 28 Device D SethiNgS iaraa dadedaeaip in uieds aa aa a tong aaa na aa 29 Sample Program SETTINGS niim was taal A ie A A leone EAT 3 Programming Guide ario iii 33 M SPOS PriNnT AP o aa 33 A naNO ker ninteaa tects inl asset eran ren whale E A 33 oleo OO 34 Embedding of ePOS Print APIs icc acids cr dd AA Ed a E D a i e ia 35 Print Document CreQtiOn a ab dat jaaeusubchigiadaite s0000s Wich AAA ouack tabi de ad Madd otach ads 36 Transmission of Print DOCUMENT iii Ae da ati ad 40 Reception of Print ResUlb o cccoconococcccoonnnonoconnnonononnonnn rro rooonn nr nr rro nr rr rr rra nr r rr rara rr rr r ron rr rr rr r narra rr nr n casan nnnss 42 RECEPTION OF
53. ber Specifies the horizontal end position of the line in dots Specifies an integer from 0 to 65535 e y2 Required parameter Object type Number cSpecifies the vertical end position of the line in dots Specifies an integer from 0 to 65535 e style Optional parameter Object type String Specifies the line type Constant siye LINE_THIN Solid line Thin LINE_MEDIUM Solid line Medium LINE_THICK Solid line Thick LINE_THIN_DOUBLE Double line Thin LINE_MEDIUM_DOUBLE Double line Medium LINE_THICK_DOUBLE Double line Thick undefined When not specified Solid line Thin Return value Return value Object type ePOS Print Builder Object ePOS Builder Exception Object type Parameter is invalid Error 101 102 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 lt script type text javascript lt script type text javascript gt lt function buildMessage var builder builder addPageBegin builder addPageLine 100 builder addPageEnd gt lt script gt 0 5 src epos print 1 2 x js gt lt script gt new epson ePOSBuilder 00 200 builder LINE_THIN DOUBLE Chapter 4 ePOS Print API addCut method Adds paper cut to the command buffer Sets paper cut Not available in page mode Syntax a
54. cified true or 1 Specifies underlining false or O default Cancels underlining undefined Retains the current underlining setting Optional parameter Object type Boolean Specifies the bold style fp Seting Description true or 1 Specifies emphasized printing of characters false or O default Cancels emphasized printing of characters undefined Retains the current setting for emphasized print When not specified ing Chapter 4 ePOS Print API e color Optional parameter Object type String Specifies the color 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 s Retains the current color setting When not specified Return value Return value 0 You 41013 ePOS Print Builder Object ePOS Builder Exception Exception Object type Parameter is invalid Error Example To set the underline style lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addTextStyle undefined true gt lt script gt 69 70 addTextPosition method Adds the horizontal print start position of text to the command buffer Syntax addTextPosition x
55. ddCut type Parameter e type Optional parameter Object type String Specifies the paper cut type DOE EA A Cut without feeding CUT_NO_FEED j The paper is cut without being fed Feed cut CUT_FEED i ES 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 Return value 011941913 q ePOS Print Builder Object ePOS Builder Exception Object type Parameter is invalid Error 103 Example To perform feed cut operation lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt a function buildMessage var builder new epson ePOSBuilder builder addCut builder CUT_FEED gt lt script gt 104 Chapter 4 ePOS Print API addPulse method Adds the drawer kick to the command buffer Sets the drawer kick e Not available in page mode AN e The drawer and the buzzer cannot be used together Syntax addPulse drawer time Parameter e drawer Optional parameter Object type String Specifies the drawer kick connector DRAWER_1 Pin 2 of the drawer kick out connector DRAWER_2 Pin 5 of the drawer kick out connector undefined Pin
56. e command buffer Syntax addFeedLine line Parameter e unit Required parameter Object type Number Specifies the paper feed space in lines Specifies an integer from 0 to 255 Return value Object pe ePOS Print Builder Object ePOS Builder Exception Object ype Parameter is invalid Error Example To feed paper by 3 lines lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addFeedLine 3 gt lt script gt Chapter 4 ePOS Print API addlmage method Adas 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 e To print a raster image at high speed specify ALIGN_LEFT for the addTextAlign method p Q 58 and specify a multiple of 8 not exceeding the printer s paper width for the width parameter of this API In page mode a raster image is laid out in the current print position with the reference point being its bottom left dot The print position will not move If an
57. ect 114 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 for an ePOS Print object Creates a new ePOS Print object and initializes it Syntax ePOSPrint address Parameter e address Optional parameter Object type String Specifies the URL of the printer to send a print document to in Ver 1 2 and later The URL is as follows http IP address of TM intelligent printer cgi bin epos service cgi devid device ID of printer to be used for printing amp timeout timeout time Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function sendMessage var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson ePOSPrint address gt lt script gt Chapter 4 ePOS Print API send method Sends a print document created using an ePOS Print Builder object A print document is obtained by executing the toString method p 110 of the ePOS Print Builder Q S object Syntax send request Parameter e request Required parameter Object type String Specifies the print document Exception Object type Parameter is invalid Error XMLHttpRequest is not supported Error Example lt script type text j
58. ent to the center lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addTextAlign builder ALIGN_CENTER gt lt script gt Chapter 4 ePOS Print API addTextLineSpace method Adds the line feed space setting to the command buffer Syntax addTextLineSpace linespc Parameter e linespc Required parameter Object type Number Specifies the line feed space in dots Specifies an integer from 0 to 255 Return value Return value Object type ePOS Print Builder Object ePOS Builder Exception Exception Object type Parameter is invalid Error Example To set the line feed space to 30 dots lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addTextLineSpace 30 gt lt script gt 59 60 addTextRotate method Adds the text rotation setting to the command buffer 2 This API setting also applies to barcodes two dimensional symbols When the page mode is selected for the print mode to set text rotation use the addPageDirection NM method p 95 instead of this API function Syntax addTextRotate rotate Parameter e ro
59. epson ePOSPrint address epos ondraweropen function alert draweropen Y epos open gt lt script gt src epos print 1 wee A j s gt lt script gt 130 Chapter 5 ePOS Print Canvas API ePOS Print Canvas API This chapter describes the ePOS Print Canvas API List of ePOS Print Canvas API functions The ePOS Print Canvas API provides the following object 1 ePOS Print Canvas API window epson CanvasPrint object p 131 window epson CanvasPrint Components Constructor CanvasPrint Initializes an ePOS Print Canvas API object 188 method print Prints an HTML5 Canvas image 134 Enables status event operation open i 136 in Ver 1 2 and later Disables status event operation close i 137 in Ver 1 2 and later Property address URL of the printer in Ver 1 2 and later 138 Enabling disabling of status event 139 enabled in Ver 1 2 and later a Printer status update interval i 14 eve in Ver 1 2 and later 2 status Status in Ver 1 2 and later 141 Raster image halftone processing method halftone 142 in Ver 1 2 and later Raster image brightness correction value brightness 143 in Ver 1 2 and later Event onreceive Response message receipt event 144 onerror Communication error event 146 onstatuschange Status change event in Ver 1 2 and later 147 ononline Online event in Ver 1 2 and later 147 onoff
60. equired parameter Object type Number Specifies the key code 1 of an NV logo Specifies an integer from 0 to 255 e key2 Required parameter Object type Number Specifies the key code 2 of an NV logo Specifies an integer from 0 to 255 Return value Return value Object type ePOS Print Builder Object ePOS Builder Exception Object type Parameter is invalid Error 4 Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt alee function buildMessage var builder new epson ePOSBuilder builder addLogo 48 48 PFEF lt script gt 75 76 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 NH bottom left dot except for HRI Syntax addBarcode data hri font width height Parameter e data Required parameter Object type String Specifies the barcode data as a string Barcode iype UPC A When an 11 digit number is specified a check digit is automatically added When a 12 digit number is specified the 12th digit is pro cessed as a check digit but the check digit is not vali dated UPC E EAN13 JAN13 Specify 0 as the first digit Specify the manufacturer code in the digits 2 to 6 Specify right align the item code in the digits 7 to 11 T
61. er error occurred EPTR_MECHANICAL A mechanical error occurred EPTR_REC_EMPTY No paper in roll paper end sensor EPTR_UNRECOVERABLE An unrecoverable error occurred SchemoError The request document contains a syntax error DeviceNotFound The printer with the specified device ID does not exist PrintSystemeError An error occurred on the printing system EX_BADPORT An error was detected on the communication port EX_TIMEOUT A print timeout occurred 144 Chapter 5 ePOS Print Canvas API e Value of satus Constant status ASB_NO_RESPONSE ASB_PRINT_SUCCESS ASB_DRAWER_KICK Decription No response from the TM printer Printing is successfully completed Status of the 3rd pin of the drawer kick out connector H Offline The cover is open ASB_OFF_LINE ASB_COVER_OPEN ASB_PAPER_FEED ASB_WAIT_ON_LINE ASB_PANEL_SWITCH Paper is being fed by a paper feed switch operation Waiting to be brought back online The paper feed switch is being pressed ON ASB_MECHANICAL_ERR A mechanical error occurred ASB_AUTOCUTTER_ERR An autocutter error occurred ASB_UNRECOVER_ERR An unrecoverable error occurred ASB_AUTORECOVER_ERR ASB_RECEIPT_NEAR_END An automatically recoverable error occurred No paper in roll paper near end sensor ASB_RECEIPT_END ASB_BUZZER ASB_SPOOLER_IS_STOPPED No paper in roll paper end sensor A buzzer is on only for applicable devices The spo
62. esented by character strings use the following escape sequences CI _ Descniption xnn Control code Back slash e type Required parameter Object type String Specifies the barcode type Constant type Barcode type BARCODE_UPC_A UPC A BARCODE_UPC_E UPC E BARCODE_EAN13 EAN13 BARCODE_JAN13 JAN13 BARCODE_EAN8 EAN8 BARCODE_JAN8 JAN8 BARCODE_CODE39 CODE39 BARCODE_ITF ITF BARCODE_CODABAR CODABAR BARCODE_CODE93 CODE93 BARCODE_CODE128 CODE128 BARCODE_GS1_128 6S1 128 BARCODE_GS1_DATABAR_OMNIDIRECTIONAL 6S1 DataBar Omnidirectional BARCODE_GS1_DATABAR_TRUNCATED GS 1 DataBar Truncated BARCODE_GS1_DATABAR_LIMITED 6S1 DataBar Limited BARCODE_GS1_DATABAR_EXPANDED GS1 Databar Expanded e hri Optional parameter Object type String Specifies the HRI position Constant hr HRI_NONE default HRI not printed HRI_ABOVE Above the bar code HRI_BELOW Below the bar code HRI_BOTH Both above and below the bar code Chapter 4 ePOS Print API e font Optional parameter Object type String Specifies the HRI font Constant on FONT_A default Font A FONT_B Font B FONT_C Font C e width Optional parameter Object type Number Specifies the width of each module in dots Specifies an integer from 2 to 6 e height Optional parameter Object type Number Specifies the barcode height in dots Specifies an integer from 1 to
63. etails 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 2 Web Server Configuration Configure a Web server on the computer 3 Registration of Sample Program ePOS Print_API_UM_E_Sample zip p 27 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 5 Network Settings for the TM Intelligent Printer p 28 Configuration is done from a Web browser 6 Network settings for the printer to be controlled Configure these settings by using the network setting utility For details refer to the detailed instruc tion manual for the printer these settings are not required in this sample program 26 Chapter 2 Sample Program 7 Device ID Settings p 29 Configuration is done from a Web browser these settings are not required in this sample program 8 Sample Program Settings p 31 Configuration is done from a Web browser these settings are not required in this sample program Registration of Sample Program ePOS Print_API_UM_E_Sample zip Register the sample program into the Web server Download ePOS Print_API_UM_E_Sample zip Q For details refer to Contents in the package p 18 Register the program according to
64. he number of item code digits varies depending on the manufacturer code Specify Os in empty digits When an 11 digit number is specified a check digit is automatically added When a 12 digit number is specified the 12th digit is pro cessed as a check digit but the check digit is not vali dated When an 12 digit number is specified a check digit is automatically added When a 13 digit number is specified the 12th digit is pro cessed as a check digit but the check digit is not vali dated EAN8 JAN8 When a 7 digit number is specified a check digit is auto matically added When an 8 digit number is specified the 8th digit is pro cessed as a check digit but the check digit is not vali dated CODE39 When the first character is the character is processed as the start character In other cases a start character is automatically added ITF Start and stop codes are automatically added Check digits are not added or validated Chapter 4 ePOS Print API Barcode type Specify a start character A to D a to d CODABAR Specify a stop character A to D a to d Check digits are not added or validated CODER Start and stop characters are automatically added A check digit is automatically calculated and added Specify a start character CODE A CODE B CODE C A stop character is automatically added A check digit is automatically calculated and added To encode each of the foll
65. ick Out Supported Buzzer Optional 154 Appendix TM T88V 80mm Interface Ethernet Wireless LAN Resolution 180 dpi x 180 dpi W x H Print Width 512 dots 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 Font A At the 21st dot from the top of the character Font B At the 16th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 512 dots x 831 dots W x H Page Mode Maximum Area 512 dots x 1662 dots W x H Raster image Monochrome image two color image Logo Monochrome image two color image Bar Code UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODE339 ITF CODABAR CODE93 CODE128 GS1 128 GS1 DataBar Omnidirectional GS1 DataBar Truncated 6S1 DataBar Limited GS1 Databar Expanded Two Dimensional Code PDF417 AR Code MaxiCode GS1 DataBar Stacked GS1 DataBar Stacked Omnidirectional 6S1 DataBar Expanded Stacked Composite Symbology not supported Ruled Line Not supported Paper Cut Cut Feed cut Drawer Kick Out Supported Buzzer Optional 155 TM T70 i 80mm Interface Ethernet Wireless LAN Resolution 180 dpi x 180 dpi W x H Print Width 512 dots Characters in a Line Font A ANK 42 characters Font B ANK 56 ch
66. ified e height Optional parameter Object type Number Specifies the vertical scale of text Integer from 1 to 8 Vertical scale default 1 undefined When not specified Retains the current setting for the vertical scale Return value Return value ePOS Print Builder Object 0 You 41013 ePOS Builder Exception Object type Parameter is invalid Example To set a horizontal scale of x 4 and a vertical scale of x 4 Error lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addTextSize 4 4 gt lt script gt lt script type text javascript src epos print 1 2 x js gt lt script gt 67 68 addTextStyle method Adds the text style setting to the command buffer Syntax addTextStyle reverse Parameter e reverse uk em color Optional parameter Object type Boolean Specifies inversion of black and white for text Salting E A true or 1 Specifies the inversion of black and white parts of characters false or O default Cancels the inversion of black and white parts of characters undefined When not specified Retains the current setting for inversion of black and white Optional parameter Object type Boolean Specifies the underline style A MS A PP EM When not spe
67. ilder Object ePOS Builder Exception Object pe Parameter is invalid Error Example To set the font B lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addTextFont builder FONT_B gt lt script gt 63 addTextSmooth method Adds the smoothing setting to the command buffer Syntax addTextSmooth smooth Parameter e smooth Required parameter Object type Boolean Specifies whether to enable smoothing true or 1 Specifies smoothing false or O default Cancels smoothing Return value Return value Object type ePOS Print Builder Object ePOS Builder Exception Object type Parameter is invalid Error Example To enable smoothing lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addText Smooth true 1 aie lt script gt Chapter 4 ePOS Print API addTextDouble method Adds the double sized text setting to the command buffer Syntax addTextDouble dw dh Parameter e dw Optional parameter Object type Boolean Specifies the double sized width AA A eee true or 1 Specifies the double sized width false o
68. in Left to right DIRECTION_LEFT_TO_RIGHT default No rotation Data is printed from the top left corner to the right Bottom to top Counterclockwise rotation by 90 degrees Data is printed from the bottom left corner to the top Right to left DIRECTION_RIGHT_TO_LEFT Rotation by 180 degrees Data is printed from the bottom right corner to the left DIRECTION_BOTTOM_TO_TOP Top to bottom Clockwise rotation by 90 degrees Data is printed from the top right corner to the bottom DIRECTION_TOP_TO_BOTTOM Return value Return value Object type ePOS Print Builder Object ePOS Builder Exception Object ye Parameter is invalid Error 95 96 Example To print the characters ABCDE by rotating them 90 degrees clockwise lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt of a function buildMessage var builder new epson ePOSBuilder builder addPageBegin builder addPageArea 100 50 30 200 builder addPageDirection builder DIRECTION_TOP_TO_ BOTTOM builder addText ABCDE builder addPageEnd gt lt script gt Chapter 4 ePOS Print API 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 Q Use this API function by inserti
69. ing a logical value This is read only The default value is false Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson ePOSPrint address epos oncoveropen function alert coveropen epos open alert epos enabled gt lt script gt 119 interval property Specifies the interval of upgrading the status in Ver 1 2 and later 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 lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson ePOSPrint address epos interval 1000 epos oncoveropen function alert coveropen epos open gt lt script gt 120 Chapter 4 ePOS Print API status property Status of the printer in Ver 1 2 and later Object type Number Description This is the status last obtained from the printer This is read only Default value O Example lt
70. items on the right of the page The following items can be set Description Position Specify the rendering coordinates Size Specify the width and height of the image Angle Specify the rotation angle of the image The rotation angle is counted clockwise from the top left corner Image File Specify the path to the image file in the same server In this Web page specify the name of an image file placed under the same directory as this Web page Clear Clears the image drawn in the Canvas Reset Clears the image drawn in the Canvas In addition the settings are reset to their default values 164 Appendix Click the Draw button The image is drawn on Canvas on the left of the page according to the settings made on the right of the page 4 Set the following and click the Print button URL Enter the following URL http IP address of TM intelligent printer cgi bin epos service cgi devid device ID of printer to be used for printing amp timeout timeout time Mode Set the color mode Monochrome Grayscale Brightness Adjust the brightness Gamma value in the range 0 1 10 0 eons Set the halftone processing method for monochrome printing two tone Cut Paper When this item is selected feed cut is performed after printing 5 The print result is disolayed 165 Rendering Graphics canvas print graph html Draw an image in HTML5 Canvas and perform a test
71. javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson CanvasPrint address epos ondraweropen function alert draweropen Y epos open gt lt script gt 152 Appendix Appendix Printer specifications 80mm Interface Ethernet Wireless LAN Resolution 180 dpi x 180 dpi W x H Print Width 512 dots 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 Font A At the 21st dot from the top of the character Font B At the 16th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 512 dots x 831 dots W x H Page Mode Maximum Area 512 dots x 1662 dots W x H Raster image Monochrome image two color image Logo Monochrome image two color image Bar Code UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODE89 ITF CODABAR CODE93 CODE128 GS1 128 GS1 DataBar Omnidirectional GS1 DataBar Truncated 6S1 DataBar Limited GS1 Databar Expanded Two Dimensional Code PDF417 QR Code MaxiCode 6S1 DataBar Stacked GS1 DataBar Stacked Omnidirectional 6S1 DataBar Expanded Stacked Composite Symbology not supported 153 80mm Ruled Line Not supported Paper Cut Cut Feed cut Drawer K
72. ject 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 lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt 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 epos open alert epos enabled gt lt script gt 139 interval property Specifies the interval of upgrading the status in Ver 1 2 and later 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 lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson CanvasPrint address epos interval 1000 epos oncoveropen function alert coveropen epos open gt lt script gt 140 Chapter 5 ePOS Print Canvas API status property Status of the printer in Ver 1 2 and later Object type Number Descrip
73. l Network SS lt TM Intelligent Printer gt I Terminal Executes the Web application using a browser D TM Intelligent Printer Receives and prints print data sent from the Web browser 17 Contents in the Package 18 Manual a a a a 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 SampleProgram ePOS Print_API_UM_E_Sample zip a a a a The following are included epos print 1 2 x js ePOS Print JavaScript for embedding index html Sampleprogram epos print api html ePOS Print API code creation tool Rendering in HTML5 Canvas e canvas print text html Rendering text e canvas print image html Rendering images e canvas print graph html Rendering graphics e canvas print hand html Rendering handwritten images e canvas print barcode html Rendering barcode Utility Ll TM T88V Utility 1 TM Flash Logo Setup Utility I TMNet WinConfig Chapter 1 Overview Restrictsions 3 The drawer and the buzzer cannot be used together 3 The buzzer function cannot be used if the printer is not provided with the buzzer _1 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 in Ver 1 2 and later 11 The scan quality of barcodes two dimensional symbols printed as multiple t
74. line Offline event in Ver 1 2 and later 148 onpoweroff Non response event in Ver 1 2 and later 148 oncoverok Cover close event in Ver 1 2 and later 149 131 IEC IE E Deerton E oncoveropen Cover open event in Ver 1 2 and later 149 Paper remaining event enpaperok ig 1 2 and ae bi onpapernearend Paper near end event in Ver 1 2 and later 150 onpaperend Paper end event in Ver 1 2 and later 15 ondrawerclosed Drawer close event in Ver 1 2 and later 151 ondraweropen Drawer open event in Ver 1 2 and later 152 Constant ASB_ Response document status HALFTONE_ Halftone type MODE _ Color mode 132 Chapter 5 ePOS Print Canvas API ePOS Print Canvas API Object Prints a print image rendered in HTML5 Canvas and monitors the print result or the communication status Constructor for an ePOS Print Canvas API object Creates a new ePOS Print Canvas API object and initializes it Syntax CanvasPrint address Parameter e address Optional parameter Object type String Specifies the address property URL of printer to be used for printing The URL is as follows http IP address of TM intelligent printer cgi bin epos service cgi devid device ID of printer to be used for printing amp timeout timeout time Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt astie f
75. llback function to obtain a cover open event in Ver 1 2 and later Object type Function O Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt gie var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson ePOSPrint address epos oncoveropen function alert coveropen Y epos open gt lt script gt 127 128 onpaperok event Registers a callback function to obtain a paper remaining event in Ver 1 2 and later Object type Function Example lt script type text javascript lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson ePOSPrint address epos onpaperok function alert paperok Y epos open gt lt script gt src epos print 1 2 x js gt lt script gt onpapernearend event Registers a callback function to obtain a paper near end event in Ver 1 2 and later Object type Function O Example lt script type text javascript lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson ePOSPrint address epos onpapernearend function alert papernearend Y epos open gt lt
76. memory of the printer For details refer to addLogo method p 75 Chapter 3 Programming Guide To create a page mode print document When the addPageBegin method is stored in the command buffer the page mode starts Store the print area addPageArea method and the print start position addPagePosition method into the command buffer Specify the print start position according to the print data After that store the methods into the command buffer to create print data For the end of page mode store the PageEnd method into the command buffer For the string Hello World to create a print document based on the following settings lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt function buildMessage Create an ePOS Print Builder object var builder new epson ePOSBuilder Create a print document lt The page mode starts gt builder addPageBegin lt Specify the page mode print area gt builder addPageArea 100 50 200 100 lt Specify the page mode print position gt builder addPagePosition 0 42 lt Specify the print data gt builder addTextLang en builder addTextFont builder FONT_A builder addTextSize 4 4 builder addTextStyle false false true undefined builder addText Hello tWorld n lt The page mode ends gt builder addPageEnd builder addCut builder CUT_FEED Acquire the print document
77. n not specified Return value Return value ePOS Print Builder Object Object type ePOS Builder Exception Object iype Parameter is invalid Error Example lt script type text javascript lt script type text javascript gt lt function buildMessage var builder new epson ePOSB if canvas getContext var context canvas getCon builder addImage context 0 gt lt script gt var canvas document getElementById canvas src epos print 1 2 x js gt lt script gt uilder text 2d 0 canvas width canvas height To print an image 300 dots wide and 300 dots high in page mode var canvas document getElementById myCanvas var context canvas getContext 2d var builder new epson ePOSBuilder builder addPageBegin builder addPageArea 0 0 300 300 builder addPagePosition 0 299 builder addImage context 0 0 300 300 builder addPageEnd Chapter 4 ePOS Print API addLogo method Adds NV logo printing to the command buffer Prints a logo registered in the NV memory of the printer e Using TM T88V Utility or logo registration utility TMFLogo register a logo in the printer in Q S advance e In page mode a logo is laid out in the current print position with the reference point being its bottom left dot Syntax addLogo keyl key2 Parameter e keyl R
78. nction to obtain a offline event in Ver 1 2 and later Object type Function O Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson CanvasPrint address epos onoffline function alert offline Y epos open gt lt script gt onpoweroff event Registers a callback function to obtain a non response event in Ver 1 2 and later Object type Function O Example epos onpoweroff function alert poweroff Y epos open gt lt script gt lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson CanvasPrint address 148 Chapter 5 ePOS Print Canvas API oncoverok event Registers a callback function to obtain a cover close event in Ver 1 2 and later Object type Function O Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson CanvasPrint address epos oncoverok function alert coverok
79. nd lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addVLineBegin 100 addVLineBegin 200 builder addFeedUnit 100 builder addVLineEnd 100 addVLineEnd 200 gt lt script gt Chapter 4 ePOS Print API 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 PageEnd p 92 Use this Q API function with PageEnd Syntax addPageBegin Return value Return value Object type ePOS Print Builder Object ePOS Builder Example To print the characters ABCDE in page mode lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addPageBegin builder addText ABCDE builder addPageEnd gt lt script gt 91 92 addPageEnd method Adds the end of page mode to the command buffer The page mode process ends Use this API function with addPageBegin p 91 Syntax addPageEnd Return value Object ype ePOS Print Builder Object ePOS Builder Example To print the characters ABCDE in page
80. ng it between addPageBegin p 91 and PageEnd p 92 Syntax addPagePosition x y Parameter e x Required parameter Object type Number Specifies the horizontal print position in dots Specifies an integer from 0 to 65535 e 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 Q 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 Object ype ePOS Print Builder Object ePOS Builder Exception Object type Parameter is invalid Error 97 Example To specify 50 30 for the print start position in the area specified by the addPageArea method and print the characters ABCDE lt script type text javascript src epos print 1
81. notification function is used to check the printer status without printing in Ver 1 2 and later Refer to the following Set the end point address var address http 192 168 192 168 cgi bin epos service cgi devid local_printer amp timeout 10000 Create an ePOS Print Builder object var builder new epson ePOSBuilder address Set an event callback function cover open epos oncoveropen function alert coveropen F Set an event callback function paper near end epos onpapernearend function alert papernearend y Enable status event operation epos open Chapter 3 Programming Guide ePOS Print Canvas API For the ePOS Print Canvas API programming is performed based on the following work flow 1 Embedding of ePOS Print Canvas API p 46 2 Rendering in HTML5 Canvas p 47 3 Prints an Canvas image p 48 4 Reception of Print Result p 49 g e The TM intelligent printer checks the status of the TM printer to be used for printing and then starts printing operation e A status event helps check the status of the TM printer For details on the procedure refer to Reception of Status Event p 44 45 46 Embedding of ePOS Print Canvas API The ePOS Print Canvas API is provided as Javascript And its file name is epos print 1 2 x js It is used by embedding epos print 1 2 x js into applications Preparation To use the ePOS Print Canvas A
82. ode res code nStatus n Obtain the printer status var asb res status if asb amp epos ASB_NO_RESPONSE No printer response n amp epos ASB_PRINT_SUCCESS Print complete n amp epos ASB_DRAWER_KICK Status of the drawer kick number 3 connector pin amp epos ASB_OFF_LINE Offline status n amp epos ASB COVER_OPEN Cover is open n amp epos ASB_PAPER_FEED Paper feed switch is feeding paper n amp epos ASB_WAIT_ON_LINE Waiting for online recovery n amp epos ASB_ PANEL SWITCH Panel switch is ON n amp epos ASB MECHANICAL ERR Mechanical error generated n y amp epos ASB_AUTOCUTTER_ERR Auto cutter error generated n amp epos ASB_UNRECOVER_ERR Unrecoverable error generated n amp epos ASB_AUTORECOVER_ERR Auto recovery error generated n amp epos ASB_RECEIPT_NEAR_END No paper in the roll paper near end detector n amp epos ASB_RECEIPT_END No paper in the roll paper end detector n amp epos ASB_ BUZZER Sounding the buzzer limited model n amp epos ASB_SPOOLER_IS_STOPPED Stop the spooler n Display in the dialog box H n Chapter 3 Programming Guide Reception of Status Event The status event notification function is used to check the prin
83. 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 e 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 and ESC POS are registered trademarks of Seiko Epson Corporation in the U S and other countries Windows and Internet Explorer are either registered trademarks or trademarks of Microsoft Corpora tion in the United States and other countries Safari and TrueType are either registered trademarks or trademarks of Apple Inc in the United States and other countries Android and Google Chrome United States and other countries are either registered trademarks or trademarks of Google Inc in the Mozilla and Firefox are either registered trademarks or trademarks of Mozilla Foundation in the United States and other countries OS is registered trademarks or trademarks of Cisco in the United States and other countries ESC POS Command System EPSON has been taking industry s initiatives with its own POS printer command system ESC POS ESC POS has a large number of commands including patented ones Its high
84. oler has stopped Example To print Canvas ID myCanvas To display the print result in a message box lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function printCanvas var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var canvas document getElementById myCanvas new epson CanvasPrint address epos onreceive function res var success res success var code res code var status res status alert success y epos print canvas gt lt script gt var epos 145 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 146 Name Communication error information Object type Object Properties of the error object propery Nome Object vpe status HTTP status Number responseText Responce text String Example To print Canvas ID myCanvas To display the HTTP status code in a message box when a communication error occurs lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function printCanvas var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var c
85. on About this Manual Aim of the Manual This manual is intended to provide development engineers with all the information necessary for building designing an ePOS Print API system or developing designing an ePOS Print printer application by using TM intelligent printers Manual Content The manual is made up of the following sections Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Appendix Overview Sample Program Programming Guide ePOS Print API ePOS Print Canvas API Printer specifications ePOS Print API code creation tool Rendering in HITML5 Canvas Contents AN 3 key to Symbolen A ida 3 E RestrictiON Of USE aid 3 BE ADOUt hS MON UA r rr a PE Ei EnEn 4 Aim or the Manli a EEE e E Aa es 4 MUISE KEENE EE e A E TE T 4 A O E ATE 5 COVOIVIOW aara aaae df eE a Ra ROA Aaa SEE 9 M Overview Of CPOS PIilt innisin dcir ci ar 9 ESTU Sit ai aA DA aa eaaa aaus 10 PINES a E E E o E A ds dd 11 A a a a GR a a i eee AAA TAA 13 FOCUS wr se5 ic te O teak cansend 14 E Operating Environ Met ccoocnccccnnncccnnnnnccnncnccnnnancncnannccnnnn nen AE a epee an recrear rca nana 15 WED BIOWSEN asar dl dia a ati 15 TM 15 TMinteligent Picasa dadas 15 TM Printers TharCan Bes Controls ica a A E beat 15 E System Construction Example 0 cccccccccesseeeeeeeeeeseeeeeeeeensseaeeeeesssseaeeeeeeesseeaeeeeeeeseeeaaeees 16 Registering a Web Application Into the Web Server ici oro ron ono ron rr rra narra rara 16 Registering a We
86. one raster images cannot be guaranteed Print them as two tone images in Ver 1 2 and later 19 20 Chapter 2 Sample Program sample Program This chapter describes how to use the sample program e In this chapter descriptions are made based on a system configuration using a Web server Q 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 sample Program System Overview Sample Program Screen The screen compositions for the sample program are as follows j ela Go E http 192 168 O BS X G epos print fy vo ES ePOS Print Demo Queue Ticket 2 Coupon 3 Settings ja d AA es A 1 Queue Ticket Prints queue ticket numbers This is a sample program using the ePOS Print API 2 Coupon Prints coupons This is a sample program using the ePOS Print Canvas API 21 22 A E MAA ee Displays the Settings screen The screen is used to set Settings x IP address of the intelligent printer 192 168 192 168 Device ID of the target printer local_printer 3 Settings Print timeout milliseconds 10000 Print in grayscale OK Cancel Print Image The sample program prints the following
87. ontext canvas getContext 2d Set the end point address var address http 192 168 192 168 cgi bin epos service cgi devid local_printer amp timeout 10000 Create an ePOS Print Canvas API object var epos new epson CanvasPrint address Set a response receipt callback function epos onreceive function res When the printing is not successful display a message if res success alert A print error occurred Print epos print canvas true Print result receipt lt script gt callback function lt head gt lt body gt lt canvas id myCanvas width 512 height 480 gt lt canvas gt lt img id coffee src img coffee jpg alt gt lt img id wmark src img wmark png alt gt lt body gt lt html gt 49 50 Error handling Refer to the following program for the error handling method by a callback function msg if asb msg if asb msg if asb msg if asb msg if asb msg if asb msg if asb msg if asb msg if asb msg if asb msg if asb msg if asb msg if asb msg if asb msg if asb msg alert msg var epos new epson CanvasPrint address Set a response receipt callback function epos onreceive function res Obtain the print result and error code var msg Print res success Success Failure nC
88. ontrolled in milliseconds Information on the registered devices is displayed in Device List Click Test Print for each registered printer to check that it operates correctly Chapter 2 Sample Program Sample Program Settings Configure the settings for the sample program according to the procedure below Q In the sample program Device ID Settings are not required Refer to it if necessary Start the Web server Connect all the printers to the network and turn their power ON Open the following URL page using the Web browser htip Web server IP address index html The sample program page opens Click Settings h WON j A 7 ar o 8 hntpi 192168 P BS X E epos print am im oo ES ePOS Print Demo Queue Ticket Coupon Settings 31 32 The Settings screen appears Specify the following and click OK IP address of the intelligent printer 192 168 192 168 Device ID of the target printer local_printer Print timeout milliseconds 10000 Print in grayscale OK Cancel Description IP address of the intelligent printer Specifies the IP address of the TM intelligent printer Default value 192 168 192 168 Device ID of the target printer Specifies the Device ID of the printer to print queue ticket numbers and coupons Default value local_printer Print timeout millisecond Specifies the timeout time default
89. ots from the left end lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt bos function buildMessage var builder new epson ePOSBuilder builder addHLine 100 200 builder LINE_THIN DOUBLE builder addHLine 400 500 builder LINE_THIN DOUBLE gt lt script gt Chapter 4 ePOS Print API addVLineBegin method Adds the beginning of vertical line to the command buffer Starts to draw vertical lines Not available in page mode 2 Vertical lines are drawn until their end is specified by addVLineEnd p 89 Use this API function with addVLineEnd Syntax addVLineBegin x style Parameter e x Required parameter Object type Number Specifies the start position of the vertical line in dots Specifies an integer from 0 to 65535 e style Optional parameter Object type String Specifies the line type LINE_THIN Solid line Thin LINE_MEDIUM Solid line Medium LINE_THICK Solid line Thick LINE_THIN_DOUBLE Double line Thin LINE_MEDIUM_DOUBLE Double line Medium LINE_THICK_DOUBLE Double line Thick undefined When not specified Solid line Thin Return value Return value Object type ePOS Print Builder Object ePOS Builder Exception pect pe Parameter is invalid Error 87 88 Example To draw thin vertical lines at 100 dots and 200 dots from the left end
90. outer GaGa 4 Web B lt WED browsel gt pa O Wireless gt TIIT O T Device Control Lal a Network lt TM Intelligent Printer gt a A Web application is placed A Web browser displays the Web application The Web browser sends print data A TM intelligent printer sends the print data to printers that can be controlled The data is printed from printers that can be controlled oa Ah WN The TM intelligent printer returns a response document to the terminal 13 Printing functions of ePOS Print API a CO oO Eg O O O Eg Q 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 Barcode printing For barcodes that can be printed by each model refer to Printer specifications on page 153 Two dimensional symbol printing For two dimensional symbols that can be printed by each model refer to Printer specifications on page 153 Ruled line setting Drawer kick function Buzzer function ESC POS command transmission Response document acquisition print result printer status system error status Printing functions of ePOS Print Canvas API a a a 14 Printing of images raster images rendered in HTML5 Canvas Feed c
91. owing characters specify two characters starting with the character FNC1 1 FNC2 2 CODE128 ENC3 3 FNC4 4 CODE A A CODE B B CODE C C SHIFT S A start character FNC1 a check digit and a stop character are automatically added To automatically calculate and add a check digit for an application identifier Al and the subsequent data specify the character in the position of the check digit You can enclose an application identifier Al in parentheses The parentheses are used as HRI print characters and are not encoded as data You can insert soaces between an application identifier GS1 128 Al 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 FNC1 q FNC3 3 JE D t GS1 DataBar Omnidi rectional GS1 DataBar Truncated GS1 DataBar Limited Specify a 13 digit global trade item number GTIN not including an application identifier Al or a check digit 77 Barcode type You can enclose an application identifier Al in parentheses The parentheses are used as HRI print characters and are not encoded as data BARCODE_GS1_ To encode each of the following characters specify two DATABAR_EXPANDED characters starting with the character FNC1 1 C D To specify binary data that cannot be repr
92. print 1 aa E CAusers sawa Desktop O Y X le EPSON ePOS Print Sample ii es 9 Canvas Graphics Editing Fill Settings 2 Style Linear Gradient Color 1 gray Swap Color Color 2 white Rectangle Position x 32 y 64 Size w 192 h192 3 Circle Center x 224 y 256 Test Print 4 http 192 168 192 168 cgi bin epos service cgi devid local_printer timeout 10000 Mode Monochrome Brightness 1 0 Halftone Monochrome Error Diffusion Y Cut Paper E A Open the following URL page using the Web browser http Web server IP address sample canvas print graph html 2 EPSON ePOS Print Sample Program appears Set items on the right of the page The following items can be set Desctiption Fill Settings Specify the fill type and color Rectangle Specify the start coordinates width and height Circle Specify the central coordinates and radius Clear Clears the image drawn in the Canvas Reset Clears the image drawn in the Canvas In addition the settings are reset to their default values Click the Draw button The image is drawn on Canvas on the left of the page according to the settings made on the right of the page 166 Appendix 4 Set the following and click the Print button PAN A _ PB URL Enter the following URL http 1P address of TM intelligen
93. puters smart phones or tablet computers to TM intelligent printers In addition print images rendered in HTML5 Canvas can be printed ePOS Print provides the API for print commanas When a print document Request is sent via HTTP from the host to the ePOS Print Service of a TM intelligent printer ePOS Print processes the printing of that document and returns a response document Response Web Server e Internet e Intranet e TM Intelligent Printer Web Browser Web Page e HTML e CSS Request f E TM Intelligent Printer a a A o AE POS Print API ePOS Print Service A A A ta 7 Response aS a a ee 1 As long as it is in a network environment a terminal with an HTML5 supported Web browser can perform printing from anywhere 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 Oo oO oO E Q Automatically checks the status of the TM printer before printing There is no need for checking the status of the TM printer in advance Supported in Ver 1 2 and later 1 Does not respond to a printer s function to automatically send its status AutoStatusBack Instead capable of sending an empty print command and checking the status of the TM printer based on the result of command transmission Supported in Ver 1 2 and later
94. r 1 Device ID of the printer to be used for printing A he ql LJ Print timeout time AAA A 4 Render in HTML5S Canvas 5 Prints ePOS Print Canvas API Object Action on the sample program F pee Action on the customer Chapter 2 Sample Program Operating Environment The system configuration diagram for the sample programs is as below e The figure below also describes an example of IP address settings as network settings Q e Inthe sample program Printer to be controlled is not required Refer to it if necessary Web Server Computer to configure the settings Wireless 192 168 192 10 HEHEHE H Network AAA Printer to be controlled 192 168 192 21 Terminal g 192 168 192 XXX z EEEE UY Wireless LAN Router 192 168 192 1 When DHCP is used for the terminal TM Intelligent Printer 192 168 192 20 D Web server computer to configure the settings Descriptions here are made assuming that the Web server is the same as the computer to configure the settings Ll Wireless LAN Router _1 TM Intelligent Printer 1 set TM T88V i TM T70 i 1 Terminal Terminal with an HTML5 supported Web browser 25 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 d
95. r O default Cancels the double sized width undefined l Retains the current setting for double sized width When not specified e dh Optional parameter Object type Boolean Specifies the double sized height Description true or 1 Specifies the double sized height false or O default Cancels the double sized height undefined we 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 g S printed Return value Return value Object type ePOS Print Builder Object ePOS Builder Exception Object ye Parameter is invalid Error 65 66 Example To set the size as double width and height lt script type text javascript lt script type text javascript lt l function buildMessage builder addTextDouble true gt lt script gt src epos print 1 2 x js gt lt script gt gt var builder new epson ePOSBuilder true Adds the text scale setting to the command buffer Syntax addTextSize width height Chapter 4 ePOS Print API addTextSize method Parameter e width Optional parameter Object type Number Specifies the horizontal scale of text Integer from 1 to 8 Horizontal scale default 1 undefined J ae Retains the current setting for the horizontal scale When not spec
96. r close event in Ver 1 2 and later 129 ondraweropen Drawer open event in Ver 1 2 and later 130 Constant ASB_ Status Chapter 4 ePOS Print API 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 for an ePOS Print Builder object Creates a new ePOS Print Builder object and initializes it Syntax ePOSBuilder Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder gt lt script gt 57 58 addTextAlign method Adas the text alignment setting to the command buffer This API setting also applies to barcodes two dimensional symbols When the page mode is selected for the print mode to set text rotation use the addPageDirection NM method p 95 instead of this API function Syntax addTextAlign align Parameter e align Required parameter Object type String Specifies the text alignment Constant aign ALIGN_LEFT default Alignment to the left ALIGN_CENTER Alignment to the center ALIGN_RIGHT Alignment to the right Return value Return value Object type ePOS Print Builder Object ePOS Builder Exception Object type Parameter is invalid Error Example To set alignm
97. rinter to check that the IP address has been updated Chapter 2 Sample Program i Device ID Settings Set the Device ID of the printer to be controlled by ePOS Print into the TM intelligent printer Use TMNet WebConfig to set the Device ID Q In the sample program Device ID Settings are not required Refer to it if necessary Configuration Device List Check Device ID Model IP Address Retry Interval ms Test Print 5 local_printer TM T70 Local printer 100 Test Print 1001 TM T88V 192 168 11 51 100 Test Print Configure the settings according to the following procedure Register Device Device ID Model TM T88v IP Address Retry Interval ms 100 A Connect all the printers to the network and turn their power ON 2 Start the Web browser and enter the IP address set in Network Settings for the TM Intelligent Printer p 28 3 TMNet WebConfig starts Select as Configuration Device 29 30 The Device Settings screen appears Set the following and click Register Description Device ID Specifies the ID to identify the printer to be controlled by ePOS Print Model Specifies the model of the printer to be controlled IP Address Specifies the IP address of the printer to be controlled Retry Interval ms Specifies the interval of retry toward the printer to be c
98. ript gt 79 80 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 Q reference point being its bottom left dot Syntax addSymbol data type Parameter width height size e data Required parameter Object type String Specifies two dimensional symbol data as a character string 2D Code type Standard PDF417 Truncated PDF417 Convert the character string to the string in UTF 8 apply the escape sequence and then encode the string The data area can contain up to 928 code words in a maximum of 90 rows each of which can contain up to 30 code words QR Code Model 1 QR Code Model 2 Convert the character string to the string in Shift JIS apply the escape sequence and then encode the string based on the data type as shown below Number Oto9 Alphanumeric character Oto9 AtoZ space 4 Kanji character Shift JIS value 8 bit byte data 0x00 to Oxff Chapter 4 ePOS Print API 2D Code iype MaxiCode Mode 2 Convert the character string to the string in UTF MaxiCode Mode 3 8 apply the escape sequence and then MaxiCode Mode 4 encode the string MaxiCode Mode 5 In Modes 2 and 3 when the first piece of data is 0 gt 1x1e011x1dyy where yy is a two digit num ber this is processed as the message header and the
99. s 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 WxH is set 158 Appendix Page Mode Maximum Area when two color printing is set 58mm 360 dots x 1662 dots WxH 60mm 384 dots x 1662 dots WxH 80mm 512 dots x 1662 dots WxH 360 dots x 831 dots WxH 384 dots x 831 dots WxH 512 dots x 831 dots WxH Page Mode Line lt line gt Rectangle lt rectangle gt Not supported Paper Cut lt cut gt Cut Feed cut Drawer Kick Out lt pulse gt Supported Buzzer lt sound gt Supported via Drawer Kick Out Command lt command gt Supported 159 ePOS Print API code creation tool This section describes how to use the ePOS Print API code creation tool in the package This tool helps to arbitrarily create an ePOS Print API p 53 sample code Use this tool for your Web application development This tool is embedded into the sample program For the details about how to place this tool refer Q to Environment Settings p 26
100. script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson ePOSPrint address epos onoffline function alert epos status Jee epos open gt lt script gt 121 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 122 Name Response message Object type Object Properties of the response object Pope Name Object ype success p 122 Print result Boolean code p 122 Error code String status p 123 Status Number e Value of success true or 1 Printing succeeded false or O Printing failed e Value of code Value EPTR_AUTOMATICAL Description An automatically recoverable error occurred EPTR_COVER_OPEN A cover open error occurred EPTR_CUTTER An autocutter error occurred EPTR_MECHANICAL A mechanical error occurred EPTR_REC_EMPTY No paper in roll paper end sensor EPTR_UNRECOVERABLE An unrecoverable error occurred SchemcError The request document contains a syntax error oo Me with the specified device ID does not Prin
101. t address epos onerror function err var status err status var text err responseText alert status epos send request gt lt script gt 124 Chapter 4 ePOS Print API onstatuschange event Registers a callback function to obtain a status change event in Ver 1 2 and later Syntax Function status Parameter of the callback function Parameters status Name Status Object type Number Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson ePOSPrint address epos onstatuschange function status alert status Y epos open gt lt script gt ononline event 4 Registers a callback function to obtain a online event in Ver 1 2 and later Object type Function O Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson ePOSPrint address epos ononline function alert online Y epos open gt lt script gt 125 onoffline event Registers a callback function to obtain a offline event in Ver 1 2 and later Object type Function
102. t head gt lt meta charset utf 8 gt lt title gt TITLE lt title gt lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt function buildMessage Create an ePOS Print Builder object var builder new epson ePOSBuilder Create a print document builder addTextLang en builder addText Smooth true builder addTextFont builder FONT_ A Create a print document builder addTextSize 3 3 builder addText Hello tWorld n builder addCut builder CUT_FEED Acquire the print document var request builder toString lt script gt lt head gt lt body gt lt body gt lt html gt Chapter 3 Programming Guide 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 e Font FontA e Scale x 4 horizontal and x 4 vertical e Style Bold lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt function buildMessage Create an ePOS Print Builder object var builder new epson ePOSBuilder Create a print document lt Configure the print character settings gt builder addTextLang en builder addTextSmooth tr
103. t printer cgi bin epos service cgi devid device ID of printer to be used for printing amp timeout timeout time Mode Set the color mode Monochrome Grayscale Brightness Adjust the brightness Gamma value in the range 0 1 10 0 seers Set the halftone processing method for monochrome printing two tone Cut Paper When this item is selected feed cut is performed after printing 5 The print result is displayed 167 Rendering Handwritten Images canvas print hand html Draw a handwritten image and perform a test print E C Users sawa Desktop O X G EPSON ePOS Print Sample x tnt Ve 9 Canvas Handwriting Pen 2 O Thin Medium Thick Test Print 4 http 192 168 192 168 cgi bin epos service cgi devid local_printer amp timeout 10000 z rin Mode Monochrome Brightness 1 0 Halftone Monochrome Threshold Y Cut Paper L E d A Open the following URL page using the Web browser http Web server IP address sample canvas print hand html 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 2 To erase the drawn image click the Clear button 168
104. t type Parameter is invalid Error 109 toString method Obtains a print document generated by an ePOS Print Builder object Syntax toString Return value Object iype Document to be printed String Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder var doc builder toString gt lt script gt 110 Chapter 4 ePOS Print API halftone property Halftone processing method in Ver 1 2 and later Object type String Description The halftone processing method to be applied to monochrome two tone printing is specified The default value is HALFTONE_DITHER 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 To set the halftone type as error diffusion lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder var canvas document getElementById canvas if canvas getContext var context canvas getContext 2d builder halftone epos HALFTONE_ERROR_DIFFUSION builder
105. tSystemeError An error occurred on the printing system EX_BADPORT An error was detected on the communication port EX_TIMEOUT A print timeout occurred e Value of status Constant status ASB_NO_RESPONSE Chapter 4 ePOS Print API Description No response from the TM printer ASB_PRINT_SUCCESS Printing is successfully completed ASB_DRAWER_KICK Status of the 3rd pin of the drawer kick out connector H ASB_OFF_LINE Offline ASB_COVER_OPEN The cover is open ASB_PAPER_FEED Paper is being fed by a paper feed switch operation ASB_WAIT_ON_LINE Waiting to be brought back online ASB_PANEL_SWITCH The paper feed switch is being pressed ON ASB_MECHANICAL_ERR A mechanical error occurred ASB_AUTOCUTTER_ERR An autocutter error occurred ASB_UNRECOVER_ERR An unrecoverable error occurred ASB_AUTORECOVER_ERR An automatically recoverable error occurred ASB_RECEIPT_NEAR_END No paper in roll paper near end sensor ASB_RECEIPT_END No paper in roll paper end sensor ASB_BUZZER A buzzer is on only for applicable devices ASB_SPOOLER_IS_STOPPED The spooler has stopped Example To create and send a print document To display the print result in a message box lt script type text javascript lt script type text javascript gt las function printHellowWorld var builder new epson ePOSBui builder
106. tate Required parameter Object type Boolean Specifies whether to rotate text PA true or 11 Specifies rotated printing of text false or O default Cancels rotated printing of text Return value Return value Object type ePOS Print Builder Object ePOS Builder Exception Exception Object type Parameter is invalid Error Example To set text rotation lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addTextRotate true gt lt script gt Chapter 4 ePOS Print API addText method Adas the printing of text to the command buffer 2 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 NM the character baseline dot Printer specifications p 153 Syntax addText data Parameter e data Required parameter Object type String Specify a character string to be printed For the horizontal tab line feed use the following escape sequences A AE E e t Horizontal tab HT n Line feed LF Carriage return Return valueReturn value Object VPs ePOS Print Builder Object ePOS Builder 4 Exception Object type Parame
107. ter is invalid Error Example To add character strings lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addText Hello t addText World n gt lt script gt 61 addTextLang method Adds the language setting to the command buffer Syntax addTextLang lang Parameter e lang Required parameter Object type String Specifies the target language en default English ANK ja Japanese Return value Return value Object type ePOS Print Builder Object ePOS Builder Exception Exception Object type Parameter is invalid Error Example To set the language as English lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt function buildMessage var builder new epson ePOSBuilder builder addTextLang en gt lt script gt Chapter 4 ePOS Print API addTextFont method Adds the text font setting to the command buffer Syntax addTextFont font Parameter e font Required parameter Object type String Specifies the font Constant on FONT_A default Font A FONT_B Font B FONT_C Font C Return value Return value Object type ePOS Print Bu
108. ter status without printing in Ver 1 2 and later Refer to the following Set the end point address var address http 192 168 192 168 cgi bin epos service cgi devid local_printer amp timeout 10000 Create an ePOS Print Canvas API object var epos new epson CanvasPrint address Set an event callback function cover open epos oncoveropen function alert coveropen y Set an event callback function paper near end epos onpapernearend function alert papernearend y Enable status event operation epos open 51 52 ePOS Print API This chapter describes the ePOS Print API List of API functions ePOS Print provides the following objects Chapter 4 ePOS Print API LI ePOS Print Builder window epson ePOSBuilder Object p 53 3 ePOS Print window epson ePOSPrint Object p 55 window epson ePOSBuilder Components EI E CI A Constructor ePOS Builder Initializes an ePOS Print XML Builder object 57 Method adaTextAlign Adds a tag for the text alignment setting 58 en Adds a tag for the line feed space setting 59 addTextRotate Adds a tag for the text rotation setting 60 adalText Adds a tag for printing text 61 addTextLang Adds a tag for the target language setting 62 Text addtTextFont Adds a tag for the text font setting 63 addTextSmooth Adds a tag for the text smoothing setting 64
109. tion This is the status last obtained from the printer This is read only Default value O Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson CanvasPrint address epos onoffline function alert epos status Jee epos open gt lt script gt 141 halftone property Halftone processing method in Ver 1 2 and later Object type String Description The halftone processing method to be applied to monochrome two tone printing is specified The default value is HALFTONE_DITHER 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 To set the halftone type as error diffusion lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var canvas document getElementBylId myCanvas var epos new epson CanvasPrint address epos halftone epos HALFTONE_ERROR_DIFFUSION epos print canvas gt lt script gt 142 Chapter 5 ePOS Print
110. tion in Ver 1 2 and later Syntax close Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt 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 startMonitor epos open function stopMonitor epos close gt lt script gt 137 address property URL of the printer in Ver 1 2 and later Object type String Description The URL of the printer to be used for printing is specified The URL is shown as follows http IP address of TM intelligent printer cgi bin epos service cgi devid device ID of printer to be used for printing amp timeout timeout time The default value is the address specified by the constructor Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var epos new epson CanvasPrint epos address http 192 168 192 168 cgi bin epos service cgi devid local_printer epos oncoveropen function alert coveropen epos open gt lt script gt 138 Chapter 5 ePOS Print Canvas API enabled property Retains the enabled disabled setting for status event operation in Ver 1 2 and later Ob
111. type text javascript gt lt var address var epos epos oncoveropen function alert coveropen di http 192 168 function startMonitor epos open function stopMonitor epos close gt lt script gt 192 168 cgi bin epos service cgi devid local_printer new epson ePOSPrint address src epos print 1 EDS j Ss gt lt script gt yA 117 118 address property URL of the printer in Ver 1 2 and later Object type String Description The URL of the printer to be used for printing is specified The URL is shown as follows http IP address of TM intelligent printer cgi bin epos service cgi devid device ID of printer to be used for printing amp timeout timeout time The default value is the address specified by the constructor Example lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt lt var epos new epson ePOSPrint epos address http 192 168 192 168 cgi bin epos service cgi devid local_printer epos oncoveropen function alert coveropen epos open gt lt script gt Chapter 4 ePOS Print API enabled property Retains the enabled disabled setting for status event operation in Ver 1 2 and later Object type Boolean Description The enabled disabled setting for status event operation is retained us
112. ue builder addTextFont builder FONT_A builder addTextSize 4 4 builder addTextStyle false false true undefined lt Specify the print data gt builder addText Hello tWorld n builder addCut builder CUT_FEED Acquire the print document var request builder toString lt script gt 3 37 38 To create a graphic print document To create a graphic print document store a raster image obtained by rendering an image in HTML5 Canvas into the command buffer using the addlmage method Refer to the following program To create a print document for the image file logo bmp lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt function buildMessage Create an ePOS Print Builder object var builder new epson ePOSBuilder Render an image in HTML5 Canvas var canvas document getElementByld canvas var context canvas getContext 2d context drawImage document getElementByld logo 0 0 200 70 Create a print document builder addTextAlign builder ALIGN_ CENTER builder addImage context 0 0 canvas width canvas height builder COLOR_1 builder addCut builder CUT_FEED Acquire the print document var request builder toString lt script gt This section describes how to print a raster image In addition there is also a method of printing Q graphics registered in the NV
113. unction printCanvas var address http 192 168 192 168 cgi bin epos service cgi devid local_printer var epos new epson CanvasPrint address gt lt script gt 133 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 NM print the image In this case a security error occurs due to violation of the same origin policy of JavaScript Syntax print canvas cut mode Parameter e Canvas Required parameter Object type canvas Specify the HTML5 Canvas object to be printed e cut Optional parameter Object type Boolean Sets whether to cut paper true or 1 Cuts the paper after printing false or O Does not cut the paper after printing undefined Does not cut the paper after printing e mode Optional parameter Object type String Specifies the color mode in Ver 1 2 and later Decription MODE_MONO Monochrome two tone MODE_GRAY16 Multiple tones 16 tone undefined Monochrome two tone Exception Object type Parameter is invalid Error XMLHttpRequest
114. ut Response document acquisition print result printer status system error status Chapter 1 Overview Operating Environment Web Browser HTML5 supported Web browser 31 Windows Internet Explorer 9 or later Mozilla Firefox 3 6 or later Google Chrome 7 or later Safari in 10S4 0 or later 3 3 3 3 Standard browser in Android 2 2 or later Terminal Terminal with an HTML5 supported Web browser TM Intelligent Printer 3 TM T88V i 3 TM T70 i TM Printers That Can Be Controlled 3 TM T88V 3 TM T70 3 TM T90 15 system Construction Example Registering a Web Application Into the Web Server lt Web Server gt lt Printers That Can Be Controlled gt Web Application Wireless LAN Router eee fF lt Terminal gt Web Browser Wireless lt MUDO O Device Control f A lt TM Intelligent Printer gt Network AA JJ Web Server A Web application is placed 3 Terminal Executes the Web application using a browser HTML5 supported Web browser 1 TM Intelligent Printer Receives prints print data sent from the Web browser or controls other devices L Printers That Can Be Controlled Print the print data received from the TM intelligent printer 16 Chapter 1 Overview a Registering a Web Application Into a TM Intelligent Printer Wireless LAN Router lt Terminal gt Web Browser Web Wireless Application DUDO Device Contro
115. ution 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 specifications p 153 window epson ePOSPrint Components IE IN CS II E Constructor ePOS Print Initializes an ePOS Print object 114 Method send Sends a message WS Enables status event operation open i 116 in Ver 1 2 and later Disables status event operation close WZ in Ver 1 2 and later Property address URL of the printer in Ver 1 2 and later 118 Enabling disabling of status event 119 RARE in Ver 1 2 and later mena Printer status update interval 120 in Ver 1 2 and later status Status 121 55 56 A CS E E Event onreceive Response message receipt event 122 onerror Communication error event 124 onstatuschange Status change event in Ver 1 2 and later 125 ononline Online event in Ver 1 2 and later 125 onoffline Offline event in Ver 1 2 and later 126 onpoweroff Non response event in Ver 1 2 and later 126 oncoverok Cover close event in Ver 1 2 and later 127 oncoveropen Cover open event in Ver 1 2 and later 127 Paper remaining event onpapelok ae 1 2 and onpapernearend Paper near end event in Ver 1 2 and later 128 onpaperend Paper end event in Ver 1 2 and later 129 ondrawerclosed Drawe
116. var request builder toString lt script gt 39 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 41 Refer to the following program lt DOCTYPE html gt lt html gt lt head gt lt meta charset utf 8 gt lt title gt TITLE lt title gt lt script type text javascript src epos print 1 2 x js gt lt script gt lt script type text javascript gt 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 TA builder addCut builder CUT_FEED Transmission of print document var request builder toString Pa Set the end point address var address http 192 168 192 168 cgi bin epos service cgi devid local_printer amp timeout 10000 Create an ePOS Print object var epos new epson ePOSPrint address Send the print document epos send request lt script gt lt head gt lt body gt lt body gt lt html gt Chapter 3 Progr
117. wing items can be set Position Specify the rendering coordinates Module Size Specify the width and height of the bars Data Specify EAN13 JAN13 data For 12 digit numerical data calculate and add the check digit For 13 digit numerical data verify the check digit For UPC A data add 0 at the start of the string to make it 12 or 13 digit data Clear Clears the image drawn in the Canvas Reset Clears the image drawn in the Canvas In addition the settings are reset to their default values 170 Appendix Click the Draw button The image is drawn on Canvas on the left of the page according to the settings made on the right of the page 4 Set the following and click the Print button URL Enter the following URL http IP address of TM intelligent printer cgi bin epos service cgi devid device ID of printer to be used for printing amp timeout timeout time Mode Set the color mode Monochrome Grayscale Brightness Adjust the brightness Gamma value in the range 0 1 10 0 eons Set the halftone processing method for monochrome printing two tone Cut Paper When this item is selected feed cut is performed after printing 5 The print result is disolayed 171 172
Download Pdf Manuals
Related Search
Related Contents
放送用ケーブル・カタログVol.4.2 全ページ 印刷用 MB200XR2 取扱説明書 User Manual Samsung E1150 Manuel de l'utilisateur Gene Expression Variation in Cocoa Inoculated with Endophyte V2117 Series Multi-purpose system keyboard - AV-iQ Bedienungsanleitung Pumpe M 3068 RAXY RAXY User Guide Copyright © All rights reserved.
Failed to retrieve file