I got stuck recently with Angular route guards. CanActive runs only once when the page is loaded and does not run on route change within the guarded route. I think this was changed because it used to run on each change. From what I read in forums, I should use CanActivateChild. The thing is, our application consists of several modules, that have several route descendants and when I use CanActivateChild in root module, it is called several times when changing …
我目前正在努力使用我们的 Ionic3 应用程序。我似乎无法找到如何使用 BT 打印机和蓝牙串行插件打印图像。打印文本就好了。
我们正在使用此文档(由我的前同事找到)驱动程序命令文档测试 RPP02N-BU 打印机 ,但我无法获得
选择位图模式
上班。
我们首先将上传的图像调整为不超过 300 像素,然后将其转换为黑白。打印时,我们迭代图像并创建二进制字符串,然后将其转换为字节。这些字节跟在 SELECT BIT IMAGE MODE 命令之后。
我们的代码(在 TypeScript 中)如下:
/**
* Image to printer command
* @param image
*/
public static getImagePrintData(image: HTMLImageElement): Buffer {
// Initialize list of commands
let command: number[] = [ 0x1b, 0x2a, 33, 255, 3 ];
// Get image bytes
let bytes = this.getImageBytes(image);
// Add bytes to command
bytes.forEach((byte) => command.push(byte));
// Return command
return new Buffer(command);
}
/** …Run Code Online (Sandbox Code Playgroud)