javascriptusbprintersthermal-printer

How to connect to a SK1 sanei thermal printer using star webPRNT js SDK connected via USB?


How can i send print data to a Sanei SK1 printer which is connected to my computer via USB, using star-m webPRNT javascript SDK?

I could see this method,

var manager = new StarWebPrintExtManager();

function onConnect(url) {
    manager.connect({url:url});
}

But what should be the url? how to form it?

Any help would be appreciated.


Solution

  • I've not used the ExtManager, but for the StarWebPrintTrader, we have

        /**
         * @return {StarWebPrintTrader}
         */
        createStarPrintTrader() {
            return new StarWebPrintTrader({ url: '//localhost:8001/StarWebPrnt/SendMessage' });
        },
    

    Our use case is to be able to print from a web app on a mobile device to a locally recognised bluetooth printer.

    We generate a canvas and send an image of the canvas to the printer as we our print template is HTML. It works well for us.

    Just in case you were not aware, the WebPRNT SDK is for use of web content within the Star WebPRNT browser, not a standard browser (Chrome, Firefox, etc.). Their browser presents access to a printer via localhost:8001 (that may be configurable - so check that - it's been a while since I've done any work with this SDK).

    Whilst we don't support the driver in any way, https://github.com/digitickets/star-web-print may be of use to you at least to be able to include the package in a more convenient manner as well as get upgrades.

    V1.7.0 is currently (2021-02-27) outstanding, but a PR exists.