Epson TM-T20II-i ePOS-Print XML Users Manual - Page 47

To create a mode print document

Page 47 highlights

Chapter 3 Programming Guide (XML Print Service) To create a page mode print document: Create a graphic print document using the image element in the epos-print root element. Set the image size using an attribute of the image element. For graphics, specify raster graphic bit-image data using a base 64 encoded character string. Refer to the following program for print document creation. For the string "Hello World!", to create a print document based on the following settings: ❏ Page mode print area (in dots) Origin of horizontal axis: 100, origin of vertical axis: 50, width: 200, height: 100 ❏ Page mode print positions (in dots) Horizontal print position: 0, vertical print position: 42 ❏ Font: FontA ❏ Scale: x 2 (horizontal) and x 2 (vertical) ❏ Style: Bold function createDocument() { //Start print document creation. var request = ''; //Create a print document // request += ''; // 3 request += ''; // request += ''; // request += ''; request += ''; request += ''; request += ''; request += ''; // request += 'Hello,'; request += ''; request += 'World!'; // request += ''; // request += ''; //End print document creation. request += ''; } Print image 47

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146

47
Chapter 3
Programming Guide (XML Print Service)
3
To create a page mode print document:
Create a graphic print document using the image element in the epos-print root element. Set the image
size using an attribute of the image element. For graphics, specify raster graphic bit-image data using a
base 64 encoded character string.
Refer to the following program for print document creation.
Print image
<script type="text/javascript">
function createDocument() {
//Start print document creation.
var request = '<epos-print xmlns="http://www.epson-pos.com/schemas/2011/03/
epos-print">';
//Create a print document
//<The page mode starts>
request += '<page>';
//<Specify the page mode print area>
request += '<area x="100" y="50" width="200" height="100"/>';
//<Specify the page mode print position>
request += '<position x="0" y="42"/>';
//<Set print text>
request += '<text lang="en"/>';
request += '<text smooth="true"/>';
request += '<text font="font_a"/>';
request += '<text width="2" height="2"/>';
request += '<text em="true"/>';
//<Specify the character string to print>
request += '<text>Hello,</text>';
request += '<position x="0" y="96"/>';
request += '<text>World!</text>';
//<The page mode ends>
request += '</page>';
//<Specify the feed cut>
request += '<cut type="feed"/>';
//End print document creation.
request += '</epos-print>';
}
</script>
For the string "Hello World!", to create a print document based on the following settings:
Page mode print area (in dots)
Origin of horizontal axis: 100, origin of vertical axis: 50, width: 200, height: 100
Page mode print positions (in dots)
Horizontal print position: 0, vertical print position: 42
Font:
FontA
Scale:
x 2 (horizontal) and x 2 (vertical)
Style:
Bold