uni 您所在的位置:网站首页 如何pdf保存部分页面内容图片 uni

uni

2024-06-29 03:01| 来源: 网络整理| 查看: 265

执子左 (作者)

drawCanvas() { uni.showLoading({ title: "loading" }); var _this = this; var context = uni.createCanvasContext('playbillCanvas'); context.drawImage(_this.areaImage, 0, 0, uni.upx2px(550), uni.upx2px(750)); context.draw(true);

base64ToPath(_this.qr).then(path => { context.save(); context.drawImage(path, _this.oldImage.imageX, _this.oldImage.imageY, uni.upx2px(_this.image_size), uni.upx2px( _this.image_size)); context.restore(); context.draw(true); }).catch(error => { console.error(error) }) context.save(); context.setFontSize(uni.upx2px(_this.textFontSize)); context.setFillStyle(_this.textColor); context.fillText(_this.message, _this.oldText.textX, _this.oldText.textY+10); context.restore(); context.draw(true); setTimeout(function() { uni.canvasToTempFilePath({ canvasId: 'playbillCanvas', success: function(res) { uni.hideLoading(); const imageList = []; imageList.push(res.tempFilePath); uni.previewImage({ urls: imageList, indicator: "default", loop: false }); }, fail: function() { uni.hideLoading(); uni.showToast({ title: "生成海报失败!" }); } }) }, 2000); },

2020-02-12 10:56



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有