This article refers to this: https://www.cnblogs.com/chenyucong/p/5996544.html
The use of JS has three, the first is jquery, put in the first, the second is a two-dimensional code generation plug-in Jquery.qrcode.js, the third is the print plug-in jquery.jqprint-0.3.js
The following is a simple example:
<! DOCTYPE html> </body>
1th:
The canvas label does not print directly, because it is dynamic and the print will show blank,
Here is the use of an IMG tag, first assign the canvas image to IMG, and then print IMG, because the display property above the definition of the IMG tag is none, so it will not be displayed.
2nd:
On lines 84 and 85, when you get the canvas and IMG tags, you cannot use JQ to get them, or you will be given an error, as follows
3rd:
The properties of render can be changed to table, but cannot be printed when the table is changed, because it is not an image and cannot be transferred to IMG.
The end result is as follows:
Click to generate two-dimensional code map
Click Print Chart
Use jquery's Jqcode plugin to generate two-dimensional code and print