如何使用通过USB连接的star webPRNT js SDK连接到SK1 sanei热敏打印机? [英] How to connect to a SK1 sanei thermal printer using star webPRNT js SDK connected via USB?

查看:58
本文介绍了如何使用通过USB连接的star webPRNT js SDK连接到SK1 sanei热敏打印机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 star-m webPRNT javascript SDK 将打印数据发送到通过 USB 连接到我的计算机的 Sanei SK1 打印机?

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?

我可以看到这个方法,

var manager = new StarWebPrintExtManager();

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

但是网址应该是什么?如何形成?

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

任何帮助将不胜感激.

推荐答案

我没有使用 ExtManager,但对于 StarWebPrintTrader,我们有

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.

我们生成一个画布并将画布的图像发送到打印机,因为我们的打印模板是 HTML.它对我们很有效.

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.

以防万一您不知道,WebPRNT SDK 用于在 Star WebPRNT 浏览器中使用网络内容,而不是标准浏览器(Chrome、Firefox 等).他们的浏览器提供了通过 localhost:8001 访问打印机的权限(这可能是可配置的 - 所以检查一下 - 我已经有一段时间没有使用这个 SDK 完成任何工作了).

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).

虽然我们不以任何方式支持驱动程序,https://github.com/digitickets/star-web-print 可能对您有用,至少可以让您以更方便的方式包含软件包并获得升级.

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 目前 (2021-02-27) 未完成,但存在 PR.

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

这篇关于如何使用通过USB连接的star webPRNT js SDK连接到SK1 sanei热敏打印机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆