printThis是bootstrap PrintThis打印插件,能实现对前端图片进行打印,使用方法如下:
1、引入jquery和printThis
<script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script src="https://cdn.bootcdn.net/ajax/libs/printThis/1.15.0/printThis.js"></script>
2、在html页面中,放入代码图片标签和按钮标签
<img src="" alt="https://www.tpxhm.com/static/tpl/index/foundation/images/bgtx_2.jpg" id="qcodeImg11"> <button type="button">打印</button>
3、jquery代码
<script> $("#qcodeImg11").printThis(); </script>
文章评论(0)