ePOS-Device for JavaScript

    ePOS-Device SDK for JavaScript

    The ePOS-Device SDK for JavaScript is a JavaScript library for controlling the TM Intelligent printer from Web application software which supports HTML5. By using the ePOS-Device SDK for JavaScript, you can control the printer, TM printer connected to network, or peripherals such as a customer display or a barcode scanner connected to the printer, with simple code.

    List of ePOS-Device APIs

    ePOS-Device SDK for JavaScript provides the following objects:

    Supported objects depend on the model of the TM intelligent printer.

    ObjectTM-DT seriesTM-i series

    ePOSDevice object(window.epson.ePOSDevice)

    Common to device objects

    -

    CashChanger object

    -

    Display object

    Keyboard object

    MSR object

    -

    Printer object

    HybridPrinter object

    *1

    -

    Scanner object

    SimpleSerial object

    *2

    DeviceHubTerminal object

    -

    CommBoxManager object

    CommBox object

    ePosDeviceConfiguration object *3

    -

    *1 Only available with the TM-DT series hybrid printers.

    *2 The SimpleSerial object cannot be used for a TM-i series model without a serial port.

    *3 Supported by ePOS-Device Service Ver.3.0 or later.

     ePOSDevice object


    APIDescription

    Initialization

    Constructor

    Initializes the ePOSDevice object.

    Communication path

    connect method

    Establishes the communication path.

    disconnect method

    Disconnects the communication path.

    isConnected method

    Acquires connection status of the communication path.

    Device

    createDevice method

    Acquires a device object.

    deleteDevice method

    Deletes a device object.

    Administration information

    getAdmin method

    Acquires the administration information.

    getLocation method

    Acquires the installation location information.

    OFSC

    sendOfscXml method

    Transmits XML data for OFSC-Print.

    Inter-application communication

    getCommBoxManager method

    Acquires the CommBoxManager object.

    Reconnection start

    onreconnecting event

    Reconnection start event

    Reconnection end

    onreconnect event

    Reconnection end event

    Disconnection

    ondisconnect event

    Network disconnection event

     Common to device objects


    APIDescription

    Event call

    callEvent method

    Calls an arbitrary event for a corresponding device control script (the SimpleSerial object is not supported).

     CashChanger object


    APIDescription

    Device configuration

    setConfig method

    Changes device configuration.

    Count

    readCashCount method

    Acquires the amount of cash in the device.

    Deposit

    beginDeposit method

    Starts a deposit process.

    pauseDeposit method

    Suspends a deposit process.

    restartDeposit method

    Resumes a deposit process.

    endDeposit method

    Ends a deposit process.

    Dispense

    dispenseCash method

    Dispenses cash by specifying the money type.

    dispenseChange method

    Dispenses cash by specifying the monetary amount.

    Collection

    collectCash method

    Collects cash from the device.

    Drawer

    openDrawer method

    Opens the cash drawer.

    Command transfer

    sendCommand method

    Transfers a command.

    Device configuration

    onconfigchange event

    Result notification event for device configuration change.

    Count

    oncashcount event

    Result notification event for counting.

    Deposit

    ondeposit event

    Result notification event for depositing.

    Dispense

    ondispense event

    Result notification event for dispensing.

    Collection

    oncollect event

    Result notification event for collection.

    Command result

    oncommandreply event

    Command result notification event

    Status change

    onstatuschange event

    Status change event

     Display object


    APIDescription

    Window

    createWindow method

    Creates the display area.

    destroyWindow method

    Destroys the display area setting.

    setCurrentWindow method

    Switches between display areas.

    clearWindow method

    Clears the current display area.

    Cursor

    setCursorPosition method

    Sets the cursor position.

    moveCursorPosition method

    Moves the cursor within the display area.

    setCursorType method

    Changes the cursor display.

    Text display

    addText method

    Displays text.

    addReverseText method

    Displays reversed text.

    addMarquee method

    Displays a marquee.

    Display attribute

    setBlink method

    Blinks the display.

    setBrightness method

    Changes brightness of the display.

    Clock

    showClock method

    Displays the clock.

    Command transfer

    addCommand method

    Runs a command.

    Transmission

    send method

    Sends a control command.

    Initialization

    reset method

    Reset

    Reception of result

    onreceive event

    A control result reception event.

     Keyboard object


    APIDescription

    String setting

    setPrefix method

    Sets the condition to handle as continuous string.

    Key detection

    onkeypress event

    A key press detection event.

    String detection

    onstring event

    A string detection event.

    Key code setting

    setMSRPrefix method

    Sets the condition to control MSR data, etc.

    Data detection

    ondata event

    Card information reception event

     MSR object


    APIDescription

    Data detection

    ondata event

    Card data detection event

     Printer object


    Two print modes are available; standard and page modes.

    • Standard mode
    • This mode prints text line by line. This mode adjusts the line feed amount depending on the character size, image size, and/or barcode height, and is suitable for printing a sales slip which changes in length depending on data quantity to print.

    • Page mode
    • This mode defines the print area and adjust print data (text, image, and/or barcode) to the size of the area for batch printing.
      To print in the page mode, use addPageBegin method and addPageEnd method to start and end the page mode process, respectively.

    APIDescriptionStandard modePage mode

    Text

    addTextAlign method

    Adds text alignment setting to the command buffer.

    ×

    addTextLineSpace method

    Adds line feed amount setting to the command buffer.

    addTextRotate method

    Adds text rotation setting to the command buffer.

    ×

    addText method

    Adds text to print to the command buffer.

    addTextLang method

    Adds language setting to the command buffer.

    addTextFont method

    Adds character font setting to the command buffer.

    addTextSmooth method

    Adds character smoothing setting to the command buffer.

    addTextDouble method

    Adds double-size character setting to the command buffer.

    addTextSize method

    Adds character scaling factor setting to the command buffer.

    addTextStyle method

    Adds character style setting to the command buffer.

    addTextPosition method

    Adds character print position setting to the command buffer.

    addTextVPosition method *1

    Adds vertical character print start position setting to the command buffer.

    ×

    Paper feed

    addFeedUnit method

    Adds paper-feed setting in dots to the command buffer.

    addFeedLine method

    Adds paper-feed setting in lines to the command buffer.

    addFeedPosition method

    Adds slip and label sheet control setting to the command buffer.

    ×

    addFeed method

    Adds a line feed command to the command buffer.

    Graphics

    addImage method

    Adds a raster image print command to the command buffer.

    addLogo method

    Adds a NV logo print command to the command buffer.

    Barcode

    addBarcode method

    Adds a barcode print command to the command buffer.

    addSymbol method

    Adds a 2D symbol print command to the command buffer.

    Ruled line

    addHLine method

    Adds a horizontal ruled line print command to the command buffer.

    ×

    addVLineBegin method

    Adds a vertical ruled line start command to the command buffer.

    ×

    addVLineEnd method

    Adds a vertical ruled line end command to the command buffer.

    ×

    Page mode

     addPageBegin method

    Adds a page mode start command to the command buffer.

    ×

     addPageEnd method

    Adds a page mode end command to the command buffer.

    ×

    addPageArea method

    Adds page mode print area setting to the command buffer.

    ×

    addPageDirection method

    Adds page mode print direction setting to the command buffer.

    ×

    addPagePosition method

    Adds page mode print position setting to the command buffer.

    ×

    addPageLine method

    Adds a page mode line draw command to the command buffer.

    ×

    addPageRectangle method

    Adds a page mode rectangle draw command to the command buffer.

    ×

    Cut

    addCut method

    Adds a sheet cut command to the command buffer.

    ×

    Drawer

    addPulse method

    Adds a drawer kick command to the command buffer.

    ×

    Buzzer

    addSound method

    Adds a buzzer sound command to the command buffer.

    ×

    Layout

    addLayout method *1

    Adds sheet layout setting to the command buffer.

    ×

    Recovery

    recover method *2

    Recovers from a recoverable error.

    ×

    addRecovery method *1

    Adds a recovery tag from an error.

    ×

    Reset

    reset method *2

    Resets the printer.

    ×

    addReset method *1

    Adds a reset tag of the printer.

    ×

    Command transfer

    addCommand method

    Adds a command to the command buffer.

    Transmission

    send method

    • Transfers a document to print.
    • Transfers a job by specifying its ID. *3

    print method

    • Prints HTML5 Canvas.
    • Prints data by specifying the job ID. *3

    Print job

    getPrintJobStatus method *3

    Acquires print job status.

    Status monitor

    startMonitor method

    Enables status events.

    stopMonitor method

    Disables status events.

    ○: Available

    ×: Not available

    *1 Supported by ePOS-Device Service Ver.2.2 or later.

    *2 Supported by ePOS-Device Service Ver.2.5 or later.

    *3 Supported by ePOS-Device Service Ver.2.6 or later.

    APIDescription

    Image

    halftone property

    The halftone processing method of a raster image.

    brightness property

    The brightness compensation value for raster image.

    Forced transmission

    force property *1

    Forced transmission mode

    Timeout

    timeout property

    Transmission timeout period

    Monitor interval

    interval property

    The update interval of the printer status.

    Drawer open

    drawerOpenLevel property *2

    The signal line status of the drawer

    Reception of result

    onreceive event

    • Response document reception event
    • Reception event for a specified job ID *3

    onstatuschange event

    Status change event

    onbatterystatuschange event *1

    Battery status change event

    ononline event

    Online event

    onoffline event

    Offline event

    onpoweroff event

    No-response event

    oncoverok event

    Cover close event

    oncoveropen event

    Cover open event

    onpaperok event

    Paper presence event

    onpaperend event

    Out of paper event

    onpapernearend event

    Almost out of paper event

    ondrawerclosed event

    Drawer close event

    ondraweropen event

    Drawer open event

    onbatteryok event *1

    Battery remaining event

    onbatterylow event *1

    Battery run-out event

    *1 Supported by ePOS-Device Service Ver.2.2 or later.

    *2 Supported by ePOS-Device Service Ver.3.0 or later.

    *3 Supported by ePOS-Device Service Ver.2.6 or later.

     HybridPrinter object


    APIDescriptionStandard modePage mode

    Device
    lock

    lock method

    Locks the device port.

    ×

    unlock method

    Unlocks the device port.

    ×

    Eject

    eject method

    Ejects the check sheet.

    ×

    Sales slip printing

    ReceiptPrinter.send method

    Transfers a document to print.

    ReceiptPrinter.print method

    Prints HTML5 Canvas.

    Front-side
    slip printing

    SlipPrinter.send method

    Transfers a document to print.

    SlipPrinter.cancel method

    Cancels check sheet insertion wait status.

    Backside
    slip printing

    EndorsePrinter.enable40cplMode method

    Sets the 40cpl mode.

    ×

    EndorsePrinter.send method

    Transfers a document to print.

    ×

    EndorsePrinter.cancel method

    Cancels check sheet insertion wait status.

    ×

    MICR

    MICRReader.read method

    Reads from the MICR.

    ×

    MICRReader.cleaning method

    Cleans the MICR mechanism.

    ×

    MICRReader.cancel method

    Cancels cleaning sheet insertion wait status.

    ×

    Recovery

    recover method

    Recovers from a recoverable error.

    ×

    Reset

    reset method

    Resets the printer.

    ×

    Status monitor

    startMonitor method

    Enables status events.

    stopMonitor method

    Disables status events.

    ○: Available

    ×: Not available

    APIDescription

    Image

    halftone property

    The halftone processing method of a raster image.

    brightness property

    The brightness compensation value for raster image.

    Forced transmission

    force property

    Forced transmission mode

    Timeout

    SlipPrinter.timeout property

    Check sheet insertion wait timeout period.

    EndorsePrinter.timeout property

    Check sheet insertion wait timeout period.

    MICRReader.timeout property

    Check sheet/cleaning sheet insertion wait timeout period.

    Monitor interval

    interval property

    The update interval of the printer status.

    Drawer open

    drawerOpenLevel property *

    Drawer open level

    Reception of result

    onreceive event

    Response document reception event

    onstatuschange event *

    Status change event

    ononline event *

    Online event

    onoffline event *

    Offline event

    onpoweroff event *

    No-response event

    oncoverok event *

    Cover close event

    oncoveropen event *

    Cover open event

    onpaperok event *

    Paper presence event

    onpaperend event *

    Out of paper event

    onpapernearend event *

    Almost out of paper event

    ondrawerclosed event *

    Drawer close event

    ondraweropen event *

    Drawer open event

    * Events which can be shared with Printer object.

    Creating Print Document using HybridPrinter Object

    The HybridPrinter object creates print documents using the same methods as the Printer object.

    The following lists methods and corresponding print methods.

    APIPrint method
    Sales slipSlip
    Front sideBacksideBackside 40cpl

    Text

    addTextAlign method

    ×

    addTextLineSpace method

    ×

    addTextRotate method

    addText method

    addTextLang method

    ×

    ×

    addTextFont method

    ×

    addTextSmooth method

    ×

    ×

    ×

    addTextDouble method

    ×

    addTextSize method

    ×

    addTextStyle method

    ×

    addTextPosition method

    addTextVPosition method

    ×

    ×

    Paper feed

    addFeedUnit method

    addFeedLine method

    ×

    addFeedPosition method

    ×

    ×

    ×

    ×

    addFeed method

    Graphics

    addImage method

    ×

    ×

    ×

    addLogo method

    ×

    ×

    Barcode

    addBarcode method

    ×

    ×

    addSymbol method

    ×

    ×

    ×

    Ruled line

    addHLine method

    ×

    ×

    ×

    ×

    addVLineBegin method

    ×

    ×

    ×

    ×

    addVLineEnd method

    ×

    ×

    ×

    ×

    Page mode

    addPageBegin method

    ×

    ×

    addPageEnd method

    ×

    ×

    addPageArea method

    ×

    ×

    addPageDirection method

    ×

    ×

    addPagePosition method

    ×

    ×

    addPageLine method

    ×

    ×

    ×

    ×

    addPageRectangle method

    ×

    ×

    ×

    ×

    Cut

    addCut method

    ×

    ×

    ×

    Drawer

    addPulse method

    Buzzer

    addSound method

    ×

    ×

    ×

    ×

    Layout

    addLayout method

    ×

    ×

    ×

    ×

    Command transfer

    addCommand method

    ○: Available

    ×: Not available

     Scanner object


    APIDescription

    Data detection

    ondata event

    Barcode data detection event

     SimpleSerial object


    APIDescription

    String setting

    sendCommand

    Transfers a command.

    Response detection

    oncommandreply event

    Command transmission result notification event

     DeviceHubTerminal object


    APIDescription

    Shutdown

    shutdown method

    Shuts down TM-DT.

    Restart

    restart method *

    Restarts TM-DT.

    * Supported by ePOS-Device Service Ver.3.0 or later.

     CommBoxManager object


    APIDescription

    Inter-application communication

    openCommBox method

    Opens the communication box.

    closeCommBox method

    Closes the communication box.

     CommBox object


    APIDescription

    Transmission history

    getCommHistory method

    Acquires the data transmission history.

    Transmission

    send method

    Transmits data to the communication box.

    Reception

    onreceive event

    Notifies of data reception in the communication box.

     ePosDeviceConfiguration object


    APIDescription

    Constructor

    Constructor

    Creates the ePosDeviceConfiguration object.

    Status acquisition

    getRegisterdDevices method

    Acquires availability status of the device.


    ePOS-Device SDK includes patented or patent pending functions. The contents must not be disclosed to third parties.

    Jump to the top