js prints the specified element of html to solve the problem that the dynamically obtained picture cannot be printed

It is easy to use js to call the browser's printing interface, and it can be done with one or two lines of code, but some data are generated dynamically, such as some dynamically generated QR codes, and sometimes the picture cannot be displayed when calling the printing interface.
In order to solve this problem problem, it is recommended to use the following library to
download: https://github.com/tanathos/jquery.jqprint

<script src="jquery.jqprint-0.3.js"/>
<script>
$('#youid').jqprint({
      debug: false, //如果是true则可以显示iframe查看效果(iframe默认高和宽都很小,可以再源码中调大),默认是false
      importCSS: true, //true表示引进原来的页面的css,默认是true
      printContainer: true, //表示如果原来选择的对象必须被纳入打印(注意:设置为false可能会打破你的CSS规则)。
      operaSupport: true//表示如果插件也必须支持歌opera浏览器,在这种情况下,它提供了建立一个临时的打印选项卡。默认是true
});
</script>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324894027&siteId=291194637