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:
<script type="text/javascript" src="epos-print-3.x.x.js"></script>
<script type="text/javascript">
function buildMessage() {
//Create an ePOS-Print Builder object
var builder = new epson.ePOSBuilder();
//Create a print document
//<The page mode starts>
builder.addPageBegin();
//<Specify the page mode print area>
builder.addPageArea(100, 50, 200, 100);
//<Specify the page mode print position>
builder.addPagePosition(0, 42);
//<Specify the print data>
builder.addTextLang('en');
builder.addTextFont(builder.FONT_A);
builder.addTextSize(4, 4);
builder.addTextStyle(false, false, true, undefined);
builder.addText('Hello,\tWorld!\n');
//<The page mode ends>
builder.addPageEnd();
builder.addCut(builder.CUT_FEED);
//Acquire the print document
var request = builder.toString();
}
</script>
Chapter 3 Programming Guide
3
47