收藏
回答

小程序webview进行调用打印机时有没有比较好的方法

框架类型 问题类型 操作系统 工具版本
小程序 Bug Windows 3.1.5

https://developers.weixin.qq.com/doc/oplatform/Miniprogram_Frame/faq.html

回答关注问题邀请回答
收藏

2 个回答

  • 一方
    一方
    08-08

        const printContentHtml = (document.getElementById('printInfo') as any).innerHTML

        const iframe: any = document.createElement('iframe')

        iframe.setAttribute('style', 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;')

        document.body.appendChild(iframe)

        iframe.contentDocument.write(printContentHtml)

        iframe.contentDocument.close()

        iframe.contentWindow.print()

        document.body.removeChild(iframe)

    使用的这种打印方式,但是嵌套小程序中好像被屏蔽了

    08-08
    有用
    回复
  • 智能回答 智能回答 本次回答由AI生成
    08-08
    有用
    回复
登录 后发表内容