Star webPRNT User's Manual

StarWebPrintExtManager.js

Watches the barcode reader and printer status by StarWebPRNTExtManager request element and StarWebPRNTExtManager response element.

Constructor

NameDescription
StarWebPrintExtManagerCreates StarWebPrintExtManager object.

Method

NameDescription
connectManagement start.
disconnectManagement stop.
writeSend data.

Property

NameDescription
onReceiveCommunication success event
onErrorCommunication error event

Property(/SendExtMessage)

NameDescription
onPrinterImpossibleNotified that the printer cannot be used
onPrinterOnlineNotified that the printer is online
onPrinterOfflineNotified that the printer is offline
onPrinterPaperReadyNotified that the printer paper is ready
onPrinterPaperNearEmptyNotified that the printer paper is near empty
onPrinterPaperEmptyNotified that the printer paper is empty
onPrinterCoverOpenNotified that the printer cover is open
onPrinterCoverCloseNotified that the printer cover is closed
onCashDrawerOpenNotified that the cash drawer is open
onCashDrawerCloseNotified that the cash drawer is closed
onBarcodeReaderImpossibleNotified that the barcode reader cannot be used
onBarcodeReaderConnectNotified that the barcode reader is connected
onBarcodeReaderDisconnectNotified that the barcode reader is disconnected
onBarcodeDataReceiveNotified that the barcode reader data received
onAccessoryConnectSuccessNotified that the accessory(Bluetooth) connect is success
onAccessoryConnectFailureNotified that the accessory(Bluetooth) connect is failure
onAccessoryDisconnectNotified that the accessory(Bluetooth) is disconnected
onStatusUpdateNotified that the printer status is updated

* It will be notified when connecting to the path "/StarWebPRNT/SendExtMessage".

Property(/SendDisplayExtMessage)

NameDescription
onDisplayImpossibleNotified that the display cannot be used
onDisplayConnectNotified that the barcode reader is connected
onDisplayDisconnectNotified that the barcode reader is disconnected
onWriteNotified that the data transmission is complete

* It will be notified when connecting to the path "/StarWebPRNT/SendDisplayExtMessage".


Star Printer Compatibility Chart

This chart indicates which method or property is supported by the Star webPRNT function of 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
Star Printer
NamemC-Print2mC-Print3mPOPTSP650IITSP700IITSP800IIFVP10
LANBRLANBRBRLANBRLANBRLANBRLANBR
HEHIHEHIHEHIHE
connect------
disconnect------
write------
onReceive------
onError------
onPrinterImpossible------
onPrinterOnline------
onPrinterOffline------
onPrinterPaperReady------
onPrinterPaperNearEmpty--------
onPrinterPaperEmpty------
onPrinterCoverOpen------
onPrinterCoverClose------
onCashDrawerOpen------
onCashDrawerClose------
onBarcodeReaderImpossible----------
onBarcodeReaderConnect----------
onBarcodeReaderDisconnect----------
onBarcodeDataReceive----------
onAccessoryConnectSuccess------
onAccessoryConnectFailure------
onAccessoryDisconnect------
onStatusUpdate------
onDisplayImpossible----------
onDisplayConnect----------
onDisplayDisconnect----------
onWrite----------
Mobile Printer(ESC/POS)
NameSM-S210iSM-S220i
(Excluding Jp model)
SM-S230iSM-T300iSM-T400i
BRBRBRBRBR
connect
disconnect
write-----
onReceive
onError
onPrinterImpossible
onPrinterOnline
onPrinterOffline
onPrinterPaperReady
onPrinterPaperNearEmpty-----
onPrinterPaperEmpty
onPrinterCoverOpen
onPrinterCoverClose
onCashDrawerOpen-----
onCashDrawerClose✓*1✓*1✓*1✓*1✓*1
onBarcodeReaderImpossible-----
onBarcodeReaderConnect-----
onBarcodeReaderDisconnect-----
onBarcodeDataReceive-----
onAccessoryConnectSuccess
onAccessoryConnectFailure
onAccessoryDisconnect
onStatusUpdate
onDisplayImpossible-----
onDisplayConnect-----
onDisplayDisconnect-----
onWrite-----

*1 It is always called as Drawer Close.


Mobile Printer (StarPRNT)
名称SM-S210iSM-S220i
(Excluding Jp model)
SM-S230iSM-T300iSM-T400iSM-L200SM-L300
BRBRBRBRBRBRBR
connect✓*2✓*2
disconnect✓*2✓*2
write-------
onReceive✓*2✓*2
onError✓*2✓*2
onPrinterImpossible✓*2✓*2
onPrinterOnline✓*2✓*2
onPrinterOffline✓*2✓*2
onPrinterPaperReady✓*2✓*2
onPrinterPaperNearEmpty-------
onPrinterPaperEmpty✓*2✓*2
onPrinterCoverOpen✓*2✓*2
onPrinterCoverClose✓*2✓*2
onCashDrawerOpen-------
onCashDrawerClose✓*1✓*1✓*1✓*1✓*1✓*1 *2✓*1 *2
onBarcodeReaderImpossible-------
onBarcodeReaderConnect-------
onBarcodeReaderDisconnect-------
onBarcodeDataReceive-------
onAccessoryConnectSuccess✓*2✓*2
onAccessoryConnectFailure✓*2✓*2
onAccessoryDisconnect✓*2✓*2
onStatusUpdate✓*2✓*2
onDisplayImpossible-------
onDisplayConnect-------
onDisplayDisconnect-------
onWrite-------

*1 It is always called as Drawer Close.

*2 It is not supported with Star webPRNT Browser for iOS.

StarWebPrintExtManager

Creates StarWebPrintExtManager object.

syntax

StarWebPrintExtManager(args);

Parameter

NameDescriptionObject typeOmission
urlStar webPRNT endpoint URL
Note: When a url is omitted, it should be specified by connect method.
String-
pollingTimeoutThe time out for polling of Claim management (ms unit)Number30000
pollingIntervalThe sending interval time for polling of Claim management (ms unit)Number200

Return value

DescriptionObject type
StarWebPrintExtManager objectStarWebPrintExtManager
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.connect({url:url});
}
// -->
</script>

connect

Management start.

syntax

connect(args);

Parameter

NameDescriptionObject typeOmission
urlSpecifies Star webPRNT endpoint URL
Note: When a url is omitted, it should be specified by StarWebPrintExtManager constructor.
String-
pollingTimeout The time out for polling of Claim management (ms unit)
Note: When a url is omitted, it should be specified by StarWebPrintExtManager constructor.
Number-
pollingIntervalThe sending interval time for polling of Claim management (ms unit)
Note: When a url is omitted, it should be specified by StarWebPrintExtManager constructor.
Number-

Parameter

DescriptionObject type
true … Success
false … Failed
Boolean
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.connect({url:url});
}
// -->
</script>

disconnect

Management stop.

syntax

disconnect();

Parameter

NameDescriptionObject typeOmission
----

Parameter

DescriptionObject type
true … Success
false … Failed
Boolean
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onDisconnect(url) {
    manager.disconnect();
}
// -->
</script>

write

Send data.

syntax

write();

Parameter

NameDescriptionObject typeOmission
urlStar webPRNT end point URL
Note: When a checkedblock is omitted, the value specified by StarWebPrintExtManager constructor should be used. In the connected state, this argument is ignored.
StringCan't be omitted
requestList of StarWebPRNTExtManager Request ElementStringCan't be omitted

Parameter

DescriptionObject type
true … Success
false … Failed
Boolean
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onWrite(url, request) {
    manager.write({url:url, request:request});
}
// -->
</script>

onReceive

Communication success event

syntax

function(response);

Parameter

NameDescriptionObject type
managerSuccessSuccess code of the communication with printer
  • true … Communication succeeded
  • false … Communication failed
String
managerCodeResult code
  • 0 … Success
  • 1010 … Printer unconnected state
  • 2001 … Printer busy(In use with another device: Need to resend data)
  • 3000 … Claim non-acquired state
  • 3001 … Not supported
Number
managerClaimManager claim status
  • true … Claim acquired state
  • false … Claim non-acquired state
Boolean
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onReceive = function(response) {
        var msg;
        if (response.managerSuccess == 'true' && response.managerClaim == 'true') {
            msg = 'Connected\n\n'
        }
        else {
            msg = 'Not connected\n\n'
        }

        msg = '- onReceive -\n\n';
        msg += 'ManagerSuccess : [ ' + response.managerSuccess + ' ]\n';
        msg += 'ManagerCode    : [ ' + response.managerCode + ' ]\n';

        alert(msg);
    }

    manager.connect({url:url});
}
// -->
</script>

onError

Communication error event.

syntax

function(response);

Parameter

NameDescriptionObject type
StatusStatus property of XMLHttpRequest object.
Refer to the XMLHttpRequest specifications.
Number
responseTextresponseText property of XMLHttpRequest object.
Refer to the XMLHttpRequest specifications.
String
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onReceive = function(response) {
        var msg;
        if (response.managerSuccess == 'true' && response.managerClaim == 'true') {
            msg = 'Connected\n\n'
        }
        else {
            msg = 'Not connected\n\n'
        }

        msg = '- onReceive -\n\n';
        msg += 'ManagerSuccess : [ ' + response.managerSuccess + ' ]\n';
        msg += 'ManagerCode    : [ ' + response.managerCode + ' ]\n';

        alert(msg);
    }

    manager.onError = function(response) {
        var msg;

        msg = 'onError!'         + '\n';
        msg += '  Status:'       + args.status + '\n';
        msg += '  ResponseText:' + args.responseText;

        alert(msg);
    }

    manager.connect({url:url});
}
// -->
</script>

onPrinterImpossible

Notifies that the printer cannot be used.

syntax

function();

Parameter

NameDescriptionObject type
---
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onPrinterImpossible = function() {
        alert('onPrinterImpossible');
    }

    manager.connect({url:url});
}
// -->
</script>

onPrinterOnline

Notified that the printer is online.

syntax

function();

Parameter

NameDescriptionObject type
---
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onPrinterOnline = function() {
        alert('onPrinterOnline');
    }

    manager.connect({url:url});
}
// -->
</script>

onPrinterOffline

Notified that the printer is offline.

syntax

function();

Parameter

NameDescriptionObject type
---
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onPrinterOffline = function() {
        alert('onPrinterOffline');
    }

    manager.connect({url:url});
}
// -->
</script>

onPrinterPaperReady

Notified that the printer paper is ready.

syntax

function();

Parameter

NameDescriptionObject type
---
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onPrinterPaperReady = function() {
        alert('onPrinterPaperReady');
    }

    manager.connect({url:url});
}
// -->
</script>

onPrinterPaperNearEmpty

Notified that the printer paper is near empty.

syntax

function();

Parameter

NameDescriptionObject type
---
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onPrinterPaperNearEmpty = function() {
        alert('onPrinterPaperNearEmpty');
    }

    manager.connect({url:url});
}
// -->
</script>

onPrinterPaperEmpty

Notified that the printer paper is empty.

syntax

function();

Parameter

NameDescriptionObject type
---
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onPrinterPaperEmpty = function() {
        alert('onPrinterPaperEmpty');
    }

    manager.connect({url:url});
}
// -->
</script>

onPrinterCoverOpen

Notified that the printer cover is open.

syntax

function();

Parameter

NameDescriptionObject type
---
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onPrinterCoverOpen = function() {
        alert('onPrinterCoverOpen');
    }

    manager.connect({url:url});
}
// -->
</script>

onPrinterCoverClose

Notified that the printer cover is closed.

syntax

function();

Parameter

NameDescriptionObject type
---
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onPrinterCoverClose = function() {
        alert('onPrinterCoverClose');
    }

    manager.connect({url:url});
}
// -->
</script>

onCashDrawerOpen

Notified that the cash drawer is open.

syntax

function();

Parameter

NameDescriptionObject type
---
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onCashDrawerOpen = function() {
        alert('onCashDrawerOpen');
    }

    manager.connect({url:url});
}
// -->
</script>

onCashDrawerClose

Notified that the cash drawer is closed.

syntax

function();

Parameter

NameDescriptionObject type
---
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onCashDrawerClose = function() {
        alert('onCashDrawerClose');
    }

    manager.connect({url:url});
}
// -->
</script>

onBarcodeReaderImpossible

Notified that the barcode reader cannot be used.

syntax

function();

Parameter

NameDescriptionObject type
---
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onBarcodeReaderImpossible = function() {
        alert('onBarcodeReaderImpossible');
    }

    manager.connect({url:url});
}
// -->
</script>

onBarcodeReaderConnect

Notified that the barcode reader is connected.

syntax

function();

Parameter

NameDescriptionObject type
---
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onBarcodeReaderConnect = function() {
        alert('onBarcodeReaderConnect');
    }

    manager.connect({url:url});
}
// -->
</script>

onBarcodeReaderDisconnect

Notified that the barcode reader is disconnected.

syntax

function();

Parameter

NameDescriptionObject type
---
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onBarcodeReaderDisconnect = function() {
        alert('onBarcodeReaderDisconnect');
    }

    manager.connect({url:url});
}
// -->
</script>

onBarcodeDataReceive

Notified that the barcode reader data received.

syntax

function(response);

Parameter

NameDescriptionObject type
dataBarcode Data
*Form of Base64
String
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onBarcodeDataReceive = function() {
        alert('onBarcodeDataReceive');
    }

    manager.connect({url:url});
}
// -->
</script>

onAccessoryConnectSuccess

Notified that the accessory(Bluetooth) connect is success.

syntax

function();

Parameter

NameDescriptionObject type
---
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onAccessoryConnectSuccess = function() {
        alert('onAccessoryConnectSuccess');
    }

    manager.connect({url:url});
}
// -->
</script>

onAccessoryConnectFailure

Notified that the accessory(Bluetooth) connect is failure.

syntax

function();

Parameter

NameDescriptionObject type
---
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onAccessoryConnectFailure = function() {
        alert('onAccessoryConnectFailure');
    }

    manager.connect({url:url});
}
// -->
</script>

onAccessoryDisconnect

Notified that the accessory(Bluetooth) is disconnected.

syntax

function();

Parameter

NameDescriptionObject type
---
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onAccessoryDisconnect = function() {
        alert('onAccessoryDisconnect');
    }

    manager.connect({url:url});
}
// -->
</script>

onStatusUpdate

Notified that the printer status is updated.

syntax

function(response);

Parameter

NameDescriptionObject type
statusHexdecimal digit sequence of 3rd to 6th bytes in Automatic Status (*)
(ex. “28000000”)
Status update timing
  • When the status changes.
  • Even no status change, every 5 min.

* Please refer to STAR Line Mode and StarPRNT command manual for details of Automatic Status.
String
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onStatusUpdate = function() {
        alert('onStatusUpdate');
    }

    manager.connect({url:url});
}
// -->
</script>

onDisplayImpossible

Notified that the display cannot be used.

syntax

function();

Parameter

NameDescriptionObject type
---
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onDisplayImpossible = function() {
        alert('onDisplayImpossible');
    }

    manager.connect({url:url});
}
// -->
</script>

onDisplayConnect

Notified that the barcode reader is connected.

syntax

function();

Parameter

NameDescriptionObject type
---
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onDisplayConnect = function() {
        alert('onDisplayConnect');
    }

    manager.connect({url:url});
}
// -->
</script>

onDisplayDisconnect

Notified that the barcode reader is disconnected.

syntax

function();

Parameter

NameDescriptionObject type
---
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.onDisplayDisconnect = function() {
        alert('onDisplayDisconnect');
    }

    manager.connect({url:url});
}
// -->
</script>

onWrite

Notified that the data transmission is complete.

syntax

function();

Parameter

NameDescriptionObject type
---
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>

<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();

function onWrite(url, request) {
    manager.onWrite = function() {
        alert('onWrite');
    }

    manager.write({url:url, request:request});
}
// -->
</script>