使用Scan Kit(统一扫码服务),通过文本生成生成码

使用Scan Kit(统一扫码服务),通过文本生成生成码

HarmonyOS
2024-08-07 09:17:11
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
噜啦噜啦嘞噜啦嘞
// 通过文本生成生成码 Promise方式
      Button('生成码').genButton()
        .onClick(() => {
          this.pixelMap = undefined;
          let content = this.mContext;
          let options: generateBarcode.CreateOptions = {
            scanType: this.mScanType,
            width: Number(this.mWidth),
            height: Number(this.mHeight),
            margin: Number(this.mMargin),
            level: this.mLevel,
            backgroundColor: this.mBackgroundColor,
            pixelMapColor: this.mPixelMapColor,
          }
          try {
            generateBarcode.createBarcode(content, options).then((result: image.PixelMap) => {
              this.pixelMap = result;
            }).catch((error: BusinessError) => {
              hilog.error(0x0001, TAG,
                `Failed to get pixelMap by promise with options. Code: ${error.code}, message: ${error.message}`);
            })
          } catch (error) {
            showError(error);
            hilog.error(0x0001, TAG, `Failed to createBarCode. Code: ${error.code}, message: ${error.message}`);
          }
        })
分享
微博
QQ
微信
回复
2024-08-07 11:24:17
相关问题
如何生成时的镂空遮罩?
356浏览 • 1回复 待解决
Scan Kit无法识别多个
1868浏览 • 1回复 待解决
HarmonyOS 服务权限问题
374浏览 • 1回复 待解决
相册识别多失败
2044浏览 • 1回复 待解决
HarmonyOS 二维生成的demo
483浏览 • 2回复 待解决
HarmonyOS 二维生成失败
155浏览 • 1回复 待解决
HarmonyOS 系统一扫问题
162浏览 • 1回复 待解决
AI生成能力中文字符乱码
9851浏览 • 1回复 待解决