打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
基于iframe实现打印

将完整的html打印成pdf

需要的插件:vue-print-nb

具体使用方法:

 <iframe
  id="frames"
  class="iframe-template"
  :src="htmlSrc"
  frameborder="0"
  style="border:0px;"
></iframe>
<c-button type="primary" v-print="'#frames'">打印</c-button>

printObj: { id: "frames", popTitle:"标题", standdard: "HTML", extraCss: this.htmlSrc, extraHead:'<meta http-equiv="Content-Language"content="zh-cn"/>' } //一定全局定义样式 @media print { //打印的样式 #frames { width: 100%; height: calc(100vh - 220px); } }

  

 

 

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Print.js javascript库 实现页面打印
js刷新iframe并给iframe中的控件赋值
HTML iframe 和 frameset 的区别
iframe 跨域自适应
JavaScript专题(二):深入理解iframe
JS打印指定页面且去样式后的内容,window.print
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服