Star webPRNT User's Manual

StarWebPrintBuilder.js

Creates Star webPRNT Request Element.

Constructor

NameDescription
StarWebPrintBuilderCreates StarWebPrintBuilder object.

Method

NameDescription
createAlignmentElementCreates Alignment element.
createBarcodeElementCreates Barcode element.
createBitImageElementCreates Bitimage element.
createCutPaperElementCreates Cut paper element.
createFeedElementCreates Feed element.
createInitializationElementCreates Initialization element.
createLogoElementCreates Logo element.
createPdf417ElementCreates PDF417 element.
createPeripheralElementCreates Peripheral element.
createQrCodeElementCreates QR code element.
createRawDataElement *1Creates Raw data element.
createRuledLineElementCreates Horizontal ruled line element.
createSoundElementCreates Sound element.
createTextElementCreates Text element.

*1 Usage of this method, to send device specific commands, is discouraged in order to maintain compatibility across all supported printers.
Developers are encouraged to use the general Star API wherever possible in order to utilize printer 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

POS Printer
NameFVP10TSP650IITSP700IITSP800IImPOPmC-Print2mC-Print3
createAlignmentElement
createBarcodeElement
createBitImageElement
createCutPaperElement
createFeedElement
createInitializationElement*1
createLogoElement
createPdf417Element
createPeripheralElement
createQrCodeElement
createRawDataElement
createRuledLineElement
createSoundElement-
createTextElement*2

*1 Performs only initialization of a command for Bluetooth printers

*2 The international character is fixed to "Japan" for Japanese models and "Korea" for Korean models.

Mobile Printer (ESC/POS)
NameSM-S220i
(Excluding Jp model)
SM-S230iSM-T300iSM-T400i
createAlignmentElement*1
createBarcodeElement
createBitImageElement
createCutPaperElement*2----
createFeedElement
createInitializationElement*3
createLogoElement*4
createPdf417Element*5
createPeripheralElement*6----
createQrCodeElement*7
createRawDataElement
createRuledLineElement
createSoundElement*6----
createTextElement*8

*1 Text data only

*2 Without paper cut

*3 Performs only initialization of a command

*4 When the logo number 1 - 255 is specified, the No.0 - 254 logo is printed.

*5 The line parameter is ineffective.

*6 Command not created.

*7 The model parameter is ineffective.

*8 The font parameter is ineffective.

Mobile Printer (StarPRNT)
NameSM-S220i
(Excluding Jp model)
SM-S230iSM-T300iSM-T400iSM-L200SM-L300
createAlignmentElement*1
createBarcodeElement
createBitImageElement
createCutPaperElement*2------
createFeedElement
createInitializationElement*3
createLogoElement*4
createPdf417Element*5
createPeripheralElement*6------
createQrCodeElement*7
createRawDataElement
createRuledLineElement
createSoundElement*6------
createTextElement

*1 Text data only

*2 Without paper cut

*3 Performs only initialization of a command

*4 Please see here for the correspondence table of logo numbers

*5 The line parameter is ineffective.

*6 Command not created.

*7 The model parameter is ineffective.

StarWebPrintBuilder

Creates StarWebPrintBuilder object.

Syntax

StarWebPrintBuilder();

Parameter

NameDescriptionObject typeOmission
----

Return value

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

createAlignmentElement

Creates Alignment element.

syntax

createAlignmentElement(args);

Parameter

NameDescriptionObject typeOmission
poistion Specifies position alignment
  • 'left' … Left alignment
  • 'center' … Center alignment
  • 'right' … Right alignment
String 'left'

Return value

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

  var request = builder.createAlignmentElement({position:'center'});
}
// -->
</script>

createBarcodeElement

Creates Barcode element.

syntax

createBarcodeElement(args);

Parameter

NameDescriptionObject typeOmission
symbology symbol
  • 'UPCE' … UPC-E
  • 'UPCA' … UPC-A
  • 'JAN8' … JAN/EAN8
  • 'JAN13' … JAN/EAN13
  • 'Code39' … Code39
  • 'ITF' … ITF
  • 'Code128' … Code128
  • 'Code93' … Code93
  • 'NW7' … NW-7
String 'UPCE'
width Specifies barcode width
  • 'width2' … Minimum module 2dots
  • 'width3' … Minimum module 3dots
  • 'width4' … Minimum module 4dots
  • 'width_mode1' … Mode1
  • 'width_mode2' … Mode2
  • 'width_mode3' … Mode3
  • 'width_mode4' … Mode4
  • 'width_mode5' … Mode5
  • 'width_mode6' … Mode6
  • 'width_mode7' … Mode7
  • 'width_mode8' … Mode8
  • 'width_mode9' … Mode9
Note. Refer to the command specifications.
String 'width3'
heightSpecifies barcode height (Unit of dot)Number162
hriSpecifies HRI characters
  • true … Adds HRI characters
  • false … No added HRI characters
Booleantrue
dataSpecifies barcode data
Note. Refer to the command specifications.
StringCan't be omitted

Return value

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

  var request = builder.createBarcodeElement({symbology:'JAN13', width:'width2', height:40, hri:false, data:'012345678901'});
}
// -->
</script>

createBitImageElement

Creates Bitimage element.

syntax

createBitImageElement(args);

Parameter

NameDescriptionObject typeOmission
contextHTML5 Canvas 2D ContextCanvasCan't be omitted
xHorizontal direction starting point of the image (Unit of dot)Number0
yVertical direction starting point of the image (Unit of dot)Number0
widthSpecifies the image width (Unit of dot)Number0
heightSpecifies the image height (Unit of dot)
Max value: 2400
Number0

Return value

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

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

createCutPaperElement

Creates Cut paper element.

syntax

createCutPaperElement(args);

Parameter

NameDescriptionObject typeOmission
typeSpecifies cut type
  • 'full' … Full cut
  • 'partial' … Partial cut
String'full'
feedSpecifies feed to cut position
  • true … Feed
  • false … No feed (Current position)
Booleantrue

Return value

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

  var request = builder.createCutPaperElement({feed:true, type:'partial'});
}
// -->
</script>

createFeedElement

Creates Feed element.

syntax

createFeedElement(args);

Parameter

NameDescriptionObject typeOmission
lineSpecifies the paper feed space (Unit of line)Number0
unitSpecifies the paper feed space (Unit of dot)Number0

Return value

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

  var request = builder.createFeedElement({line:2, unit:8});
}
// -->
</script>

createInitializationElement

Creates Initialization element.

syntax

createInitializationElement(args);

Parameter

NameDescriptionObject typeOmission
reset Specifies hardware reset
  • true … Execute hardware reset
  • false … Not execute hardware reset (Only command initialization)
Booleanfalse
print Self printing after hardware reset
  • true …Execute self print
  • false … Not execute self print
Booleanfalse

Return value

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

  var request = builder.createInitializationElement({reset:true, print:true});
}
// -->
</script>

createLogoElement

Creates Logo element.

syntax

createLogoElement(args);

Parameter

NameDescriptionObject typeOmission
numberSpecifies the number of logo registrationNumber1
widthSpecifies width
  • 'single' … Single width
  • 'double' … Double width
String'single'
heightSpecifies height
  • 'single' … Single height
  • 'double' … Double height
String'single'

Return value

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

    var request = builder.createLogoElement({number:1, width:'single', height:'single'});
}
// -->
</script>

createPdf417Element

Creates PDF417 element.

syntax

createPdf417Element(args);

Parameter

NameDescriptionObject typeOmission
lineSpecifies number of lines
Note. Refer to the command specifications.
Number0
columnSpecifies number of columns
Note. Refer to the command specifications.
Number0
level Specifies security level
  • 'level0' … Security level0
  • 'level1' … Security level1
  • 'level2' … Security level2
  • 'level3' … Security level3
  • 'level4' … Security level4
  • 'level5' … Security level5
  • 'level6' … Security level6
  • 'level7' … Security level7
  • 'level8' … Security level8
String'level1'
moduleSpecifies module size (Unit of dot)Number2
aspectSpecifies aspect ratioNumber3
dataSpecifies PDF417 data
Note. Refer to the command specifications.
StringCan't be omitted

Return value

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

  var request = builder.createPdf417Element({level:'level1', line:0, column:0, module:2, aspect:3, data:'http://www.starmicronics.com/'});
}
// -->
</script>

createPeripheralElement

Creates Peripheral element.

syntax

createPeripheralElement(args);

Parameter

NameDescriptionObject typeOmission
channelSpecifies the drive terminal of the peripheral
  • 1 … Peripheral drive terminal1
  • 2 … Peripheral drive terminal2 (Energizing time and Delay time ignore)
Number1
onEnergizing time (Unit of 1mSec)Number200
offDelay time (Unit of 1mSec)Number200

Return value

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

    var request = builder.createPeripheralElement({channel:1, on:200, off:200});
}
// -->
</script>

createQrCodeElement

Creates QR code element.

syntax

createQrCodeElement(args);

Parameter

NameDescriptionObject typeOmission
modelSpecifies model
  • 'model1' … Model1
  • 'model2' … Model2
String'model2'
levelSpecifies mistake correction level
  • 'level_l' … Mistake Correction LevelL
  • 'level_m' … Mistake Correction LevelM
  • 'level_q' … Mistake Correction LevelQ
  • 'level_h' … Mistake Correction LevelH
String'level_l'
cellSpecifies cell size (Unit of dot)Number3
dataSpecifies QR code data
Note. Refer to the command specifications.
StringCan't be omitted

Return value

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

  var request = builder.createQrCodeElement({model:'model2', level:'level_l', cell:3, data:'http://www.starmicronics.com/'});
}
// -->
</script>

createRawDataElement

Creates Raw data element.

syntax

createRawDataElement(args);

Parameter

NameDescriptionObject typeOmission
dataRaw 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/StarWebPrintBuilder.js'></script>
<script type='text/javascript'>
<!--
function onBuild() {
    var builder = new StarWebPrintBuilder();

  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 printers.
  • Developers are encouraged to use the general Star API wherever possible in order to utilize printer 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.

createRuledLineElement

Creates Horizontal ruled line element.

syntax

createRuledLineElement(args);

Parameter

NameDescriptionObject typeOmission
thickness Specifies ruled line
  • 'thin' … Thin line
  • 'medium' … Medium line
  • 'thick' … Thick line
  • 'double_thin' … Thin, double line
  • 'double_medium' … Medium, double line
  • 'double_thick' … Thick, double line
String'medium'
widthSpecifies width (Unit of dot)Number832

Return value

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

  var request = builder.createRuledLineElement({thickness:'thin', width:200});
}
// -->
</script>

createSoundElement

Creates Sound element.

syntax

createSoundElement(args);

Parameter

NameDescriptionObject typeOmission
channelSpecifies the drive terminal of the buzzer
  • 1 … Buzzer drive terminal1
  • 2 … Buzzer drive terminal2
Number1
repeatSpecifies the number of repeatsNumber1

Return value

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

  var request = builder.createSoundElement({channel:1, repeat:1});
}
// -->
</script>

createTextElement

Creates Text element.

syntax

createTextElement(args);

Parameter

NameDescriptionObject typeOmission
codepageSpecifies CodePage
  • 'utf8' … UTF-8
  • 'cp437' … CodePage437
  • 'cp737' … CodePage737
  • 'cp772' … CodePage772
  • 'cp774' … CodePage774
  • 'cp851' … CodePage851
  • 'cp852' … CodePage852
  • 'cp855' … CodePage855
  • 'cp857' … CodePage857
  • 'cp858' … CodePage858
  • 'cp860' ~ 'cp866' … CodePage860 - 866
  • 'cp869' … CodePage869
  • 'cp874' … CodePage874
  • 'cp928' … CodePage928
  • 'cp932' … CodePage932(Katakana)
  • 'cp998' … CodePage998(Normal)
  • 'cp999' … CodePage999
  • 'cp1001' … CodePage1001
  • 'cp1250' - 'cp1252' … CodePage1250 - 1252
  • 'cp2001' … CodePage2001
  • 'cp3001' … CodePage3001
  • 'cp3002' … CodePage3002
  • 'cp3011' … CodePage3011
  • 'cp3012' … CodePage3012
  • 'cp3021' … CodePage3021
  • 'cp3041' … CodePage3041
  • 'cp3840' … CodePage3840
  • 'cp3841' … CodePage3841
  • 'cp3843' - 'cp3848' … CodePage3843 - 3848
  • 'blank' … User Setting (Blank CodePage)
  • 'shift_jis' … Shift_JIS
  • 'gb18030' … GB18030
  • 'gb2312' … GB2313
  • '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' … Denmark II
  • 'spain2' … Spain II
  • 'latin_america' … Latin America
  • 'korea' … Korea
  • 'ireland' … Ireland
  • 'legal' … Legal
StringUnchanged
characterspaceSpecifies character space (Unit of dot)NumberUnchanged
emphasisSpecifies emphasized
  • true … Specifies emphasized
  • false … Cancels emphasized
BooleanUnchanged
invertSpecifies inversion
  • true … Specifies inversion
  • false … Cancels inversion
BooleanUnchanged
linespaceSpecifies line space (Unit of dot)
  • 24 … Specifies 3mm line feed amount
  • 32 … Specifies 4mm line feed amount
NumberUnchanged
widthSpecifies expanded width
  • 1 … Cancels expanded width
  • 2 … Specifies 2x width expansion
  • 3 … Specifies 3x width expansion
  • 4 … Specifies 4x width expansion
  • 5 … Specifies 5x width expansion
  • 6 … Specifies 6x width expansion
NumberUnchanged
heightSpecifies expanded height
  • 1 … Cancels expanded height
  • 2 … Specifies 2x height expansion
  • 3 … Specifies 3x height expansion
  • 4 … Specifies 4x height expansion
  • 5 … Specifies 5x height expansion
  • 6 … Specifies 6x height expansion
NumberUnchanged
fontSpecifies font style
  • 'font_a' … Font-A (12 x 24 dots)
  • 'font_b' … Font-B (9 x 24 dots)
*SBCS(Single-byte character set) only
StringUnchanged
undellineSpecifies underline
  • true … Specifies underline
  • false … Cancels underline
BooleanUnchanged
binarybinary 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/StarWebPrintBuilder.js'></script>
<script type='text/javascript'>
<!--
function onBuild() {
    var builder = new StarWebPrintBuilder();

  var request = builder.createTextElement({codepage:'cp998', international:'usa', characterspace:0, emphasis:false, invert:false, linespace:32, width:1, height:1, font:'font_a', underline:false, data:'Star Micronics\n'});
}
// -->
</script>