Epson TM-T70-i ePOS-Print API Users Manual For TM-i firmware 4.1 - Page 44
To create a text print document, builder.addTextStylefalse, false, true, undefined
View all Epson TM-T70-i manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 44 highlights
To create a text print document: To create a text print document, store the font settings into the command buffer using text methods and then create a print document. Refer to the following program. For the string "Hello World!", to create a print document based on the following settings: ❏ Font: FontA ❏ Scale: x 4 (horizontal) and x 4 (vertical) ❏ Style: Bold function buildMessage() { //Create an ePOS-Print Builder object var builder = new epson.ePOSBuilder(); //Create a print document // builder.addTextLang('en'); builder.addTextSmooth(true); builder.addTextFont(builder.FONT_A); builder.addTextSize(4, 4); builder.addTextStyle(false, false, true, undefined); // builder.addText('Hello,\tWorld!\n'); builder.addCut(builder.CUT_FEED); //Acquire the print document var request = builder.toString(); } 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 addImage method. Refer to the following program. To create a print document for the image file "logo.bmp" function buildMessage() { //Create an ePOS-Print Builder object var builder = new epson.ePOSBuilder(); //Render an image in HTML5 Canvas var canvas = document.getElementById('canvas'); var context = canvas.getContext('2d'); context.drawImage(document.getElementById('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(); } This section describes how to print a raster image. In addition, there is also a method of printing graphics registered in the NV memory of the printer. For details, refer to addLogo method (p.90). 44