Star webPRNT User's Manual

StarWebPrintDisplayBuilder.js

Creates StarWebPRNT Display Request Element.

Constructor

NameDescription
StarWebPrintDisplayBuilderCreates StarWebPrintDisplayBuilder object.

Method

NameDescription
createBackSpaceElementCreates Back space element.
createHorizontalTabElementCreates Horizontal Tab element.
createReturnElementCreates Return element.
createBitImageElementCreates BitImage element.
createTextElementCreates Text element.
createClearScreenElementCreates Clear Screen element.
createCursorElementCreates Cursor element.
createToneElementCreates Tone element.
createTurnOnElementCreates Turn On element.
createRawDataElement *1Creates Raw data element.

*1 Usage of this method, to send device specific commands, is discouraged in order to maintain compatibility across all supported displays.
Developers are encouraged to use the general Star API wherever possible in order to utilize display functions.
In the case that the Star API does not offer a feature necessary for your software, please let us know so that we can consider inclusion in a future software update.

Star Printer Compatibility Chart

This chart indicates which method is supported by the Star webPRNT function supported by each model.

  • LAN … Star webPRNT function in printer
  • LAN(HE) … Star webPRNT function in IFBD-HE07X/08X
  • LAN(HI) … Star webPRNT function in IFBD-HI01X/02X
  • BR … Star webPRNT Browser

Please refer to the interface compatibility table by printer model here.

POS Printer (mCollection/TSP100IV)
NamemC-Print2mC-Print3mPOPTSP100IVTSP100IV SKmC-Label3
LANBRLANBRBRBRBRBR
createBackSpaceElement✓*1*2✓*1*2
createHorizontalTabElement✓*1*2✓*1*2
createReturnElement✓*1*2✓*1*2
createBitImageElement✓*1*2✓*1*2
createTextElement✓*1*2✓*1*2
createClearScreenElement✓*1*2✓*1*2
createCursorElement✓*1*2✓*1*2
createToneElement✓*1*2✓*1*2
createTurnOnElement✓*1*2✓*1*2
createRawDataElement✓*1*2✓*1*2

*1 Supported with printer firmware version 2.1 or later.

*2 SSL is not supported. You cannot use the display when the web application is published on https.

POS Printer (Legacy Printer)
NameTSP650II/TSP650IISKTSP700IITSP800IIFVP10
LANBRLANBRLANBRLANBR
HEHIHEHIHEHIHE
createBackSpaceElement--------
createHorizontalTabElement--------
createReturnElement--------
createBitImageElement--------
createTextElement--------
createClearScreenElement--------
createCursorElement--------
createToneElement--------
createTurnOnElement--------
createRawDataElement--------
Mobile Printer (ESC/POS)
NameSM-S220i
(Excluding Jp model)
SM-S230iSM-T300iSM-T400i
BRBRBRBR
createBackSpaceElement----
createHorizontalTabElement----
createReturnElement----
createBitImageElement----
createTextElement----
createClearScreenElement----
createCursorElement----
createToneElement----
createTurnOnElement----
createRawDataElement----
Mobile Printer (StarPRNT)
NameSM-S220i
(Excluding Jp model)
SM-S230iSM-T300iSM-T400iSM-L200SM-L300
BRBRBRBRBRBR
createBackSpaceElement------
createHorizontalTabElement------
createReturnElement------
createBitImageElement------
createTextElement------
createClearScreenElement------
createCursorElement------
createToneElement------
createTurnOnElement------
createRawDataElement------

StarWebPrintDisplayBuilder

Creates StarWebPrintDisplayBuilder object.

Syntax

StarWebPrintDisplayBuilder();

Parameter

NameDescriptionObject typeOmission
----

Return value

DescriptionObject type
StarWebPrintDisplayBuilder objectStarWebPrintDisplayBuilder
Example
<script type='text/javascript' src='js/StarWebPrintDisplayBuilder.js'></script>
<script type='text/javascript'>
<!--
function onBuild() {
    var builder = new StarWebPrintDisplayBuilder();
}
// -->
</script>

createBackSpaceElement

Creates Back Space element.

syntax

createBackSpaceElement(args);

Parameter

NameDescriptionObject typeOmission
----

Return value

DescriptionObject type
Created element character stringString
Example
<script type='text/javascript' src='js/StarWebPrintDisplayBuilder.js'></script>
<script type='text/javascript'>
<!--
function onBuild() {
    var builder = new StarWebPrintDisplayBuilder();

    var request = builder.createBackSpaceElement();
}
// -->
</script>

createHorizontalTabElement

Creates Horizontal tab element.

syntax

createHorizontalTabElement();

Parameter

NameDescriptionObject typeOmission
----

Return value

DescriptionObject type
Created element character stringString
Example
<script type='text/javascript' src='js/StarWebPrintDisplayBuilder.js'></script>
<script type='text/javascript'>
<!--
function onBuild() {
    var builder = new StarWebPrintDisplayBuilder();

    var request = builder.createHorizontalTabElement();
}
// -->
</script>

createReturnElement

Creates Return element.

syntax

createReturnElement(args);

Parameter

NameDescriptionObject typeOmission
typeSpecifies return type
  • 'crlf' … CR+LF (Carriage return + Line feed)
  • 'cr' … CR (Carriage return only)
  • 'lf' … LF (Line feed only)
String'crlf'

Return value

DescriptionObject type
Created element character stringString
Example
<script type='text/javascript' src='js/StarWebPrintDisplayBuilder.js'></script>
<script type='text/javascript'>
<!--
function onBuild() {
    var builder = new StarWebPrintDisplayBuilder();

    var request = builder.createReturnElement({type:'crlf'});
}
// -->
</script>

createBitImageElement

Creates Bit image element.

syntax

createBitImageElement(args);

Parameter

NameDescriptionObject typeOmission
contextHTML5 Canvas 2D contextCanvasCan't be omitted
xDrawing area horizontal direction starting point (unit of dot)Number0
yDrawing area vertical direction starting point (unit of dot)Number0
widthDrawing width (unit of dot)NumberCan't be omitted
heightDrawing height (unit of dot)NumberCan't be omitted

Return value

DescriptionObject type
Created element character stringString
Example
<script type='text/javascript' src='js/StarWebPrintDisplayBuilder.js'></script>
<script type='text/javascript'>
<!--
function onBuild() {
    var builder = new StarWebPrintDisplayBuilder();

    var request = builder.createBitImageElement({context:canvas.getContext('2d'),  x:0, y:0, width:160, height:40});
}
// -->
</script>

createTextElement

Creates Text element.

syntax

createTextElement(args);

Parameter

NameDescriptionObject typeOmission
codepageCodePage
  • 'cp437' … CodePage437
  • 'katakana' … Katakana
  • 'cp850' … CodePage850
  • 'cp852' … CodePage852
  • 'cp858' … CodePage858
  • 'cp860' … CodePage860
  • 'cp863' … CodePage863
  • 'cp865' … CodePage865
  • 'cp866' … CadePage866
  • 'cp1252' … CodePage1252
  • 'shift_jis' … Shift_JIS
  • 'gb2312' … GB2312
  • 'big5' … Big5
  • 'korea' … korea
StringUnchanged
internationalSpecifies international characters
  • 'usa' … USA
  • 'france' … France
  • 'germany' … Germany
  • 'uk' … UK
  • 'denmark' … Denmark
  • 'sweden' … Sweden
  • 'italy' … Italy
  • 'spain' … Spain
  • 'japan' … Japan
  • 'norway' … Norway
  • 'denmark2' … DenmarkII
  • 'spain2' … SpainII
  • 'latin_america' … Latin America
  • 'korea' … Korea
StringUnchanged
dataText dataString-
binary Binary data Encoding
(effective range:0x00-0x20,0x26,0x3c,0x3e,0x7f-0xff)
  • true … Keep the value which are
              the specified binary data of "data"
  • false … JavaScript's utf encoding for
              the Specified binary data of "data"
Booleanfalse
dataSpecifies text dataString-

Return value

DescriptionObject type
Created element character stringString
Example
<script type='text/javascript' src='js/StarWebPrintDisplayBuilder.js'></script>
<script type='text/javascript'>
<!--
function onBuild() {
    var builder = new StarWebPrintDisplayBuilder();

    var request = builder.createTextElement({codepage:'cp437', international:'usa', data:'Star Micronics'});
}
// -->
</script>

createClearScreenElement

Creates Clear Screen element.

syntax

createClearScreenElement(args);

Parameter

NameDescriptionObject typeOmission
type Specifies clear type
  • 'all' … All clear
  • 'delete_to_end_of_line' … Clear current row.
String'all'

Return value

DescriptionObject type
Created element character stringString
Example
<script type='text/javascript' src='js/StarWebPrintDisplayBuilder.js'></script>
<script type='text/javascript'>
<!--
function onBuild() {
    var builder = new StarWebPrintDisplayBuilder();

    var request = builder.createClearScreenElement({type:'all'});
}
// -->
</script>

createCursorElement

Creates Cursor element.

syntax

createCursorElement(args);

Parameter

NameDescriptionObject typeOmission
positionSpecify cursor position.
  • 'home' … Move to home position.
  • 'specified' … Move to specified position.
StringUnchanged
xCursor horizontal axis position
* Enabled only when ‘specified’ is selected for the position.
String0
yCursor vertical axis position
* Enabled only when ‘specified’ is selected for the position.
String0
modeSpecify cursor display pattern.
  • 'off' … Cursor is hidden.
  • 'blink' … Cursor blinks.
  • 'on' … Cursor is displayed (solid).
StringUnchanged

Return value

DescriptionObject type
Created element character stringString
Example
<script type='text/javascript' src='js/StarWebPrintDisplayBuilder.js'></script>
<script type='text/javascript'>
<!--
function onBuild() {
    var builder = new StarWebPrintDisplayBuilder();

    var request = builder.createCursorElement({position:'home', mode:'blink'});
}
// -->
</script>

createToneElement

Creates Tone element.

syntax

createToneElement(args);

Parameter

NameDescriptionObject typeOmission
contrast Specifies contrast
  • 'minus3' … contrast -3
  • 'minus2' … contrast -2
  • 'minus1' … contrast -1
  • 'default' … default
  • 'plus1' … contrast +1
  • 'plus2' … contrast +2
  • 'plus3' … contrast +3
String'default'

Return value

DescriptionObject type
Created element character stringString
Example
<script type='text/javascript' src='js/StarWebPrintDisplayBuilder.js'></script>
<script type='text/javascript'>
<!--
function onBuild() {
    var builder = new StarWebPrintDisplayBuilder();

    var request = builder.createToneElement({contrast:'default'});
}
// -->
</script>

createTurnOnElement

Creates Backlight element.

syntax

createTurnOnElement(args);

Parameter

NameDescriptionObject typeOmission
typeSelect backlight ON/OFF.
  • 'true' … Backlight ON
  • 'false' … Backlight OFF
String'true'

Return value

DescriptionObject type
Created element character stringString
Example
<script type='text/javascript' src='js/StarWebPrintDisplayBuilder.js'></script>
<script type='text/javascript'>
<!--
function onBuild() {
    var builder = new StarWebPrintDisplayBuilder();

    var request = builder.createTurnOnElement({type:'true'});
}
// -->
</script>

createRawDataElement

Creates Raw data Element.

syntax

createRawDataElement(args);

Parameter

NameDescriptionObject typeOmission
dataSpecifies raw data
*16Hex '\x00'-'\xff', Horizontal tab '\t', Line feed '\n', Carriage return '\r', Backslash '\\'
StringCan't be omitted

Return value

DescriptionObject type
Created element character stringString
Example
<script type='text/javascript' src='js/StarWebPrintDisplayBuilder.js'></script>
<script type='text/javascript'>
<!--
function onBuild() {
    var builder = new StarWebPrintDisplayBuilder();

    var request = builder.createRawDataElement({data:'\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\n'});
}
// -->
</script>
  • Usage of this method, to send device specific commands, is discouraged in order to maintain compatibility across all supported displays.
  • Developers are encouraged to use the general Star API wherever possible in order to utilize display functions.
  • In the case that the Star API does not offer a feature necessary for your software, please let us know so that we can consider inclusion in a future software update.