hiprint.init(); hiprintTemplate = new hiprint.PrintTemplate({ template: JSON.parse($('#barcodeJson1').val()), settingContainer: '#PrintElementOptionSetting' });
<!-- 创建打印模板对象--> var hiprintTemplate = new hiprint.PrintTemplate(); <!-- 模板对象添加打印面板 paperHeader:页眉线 paperFooter:页尾线--> var panel2 = hiprintTemplate2.addPrintPanel({ width: 210, height: 297, paperHeader: 45, paperFooter: 780,paperType:'A4' }); <!-- 添加表格元素--> panel2.addPrintTable({ options: { "left": 16.5, "top": 57, "height": 38, "width": 562.5, "textAlign": "center", "field": "table", " columns": [[{ "title": "姓名", "field": "name", "width": 99.87127733295982, "colspan": 1, "rowspan": 1 }, { "title": "性别", "field": "gender", "width": 95.65764630289445, "colspan": 1, "rowspan": 1 }, { "title": "爱好", "field": "like", "width": 104.71872050066564, "colspan": 1, "rowspan": 1 }, { "width": 101.99066954092144, "colspan": 1, "rowspan": 1 }, { "width": 81.6409089895988, "colspan": 1, "rowspan": 1 }, { "width": 89.12077733295979, "colspan": 1, "rowspan": 1 }]] } }); <!-- 打印设计--> hiprintTemplate2.design('#hiprint-printTemplate2');
<!-- 创建打印模板对象--> var hiprintTemplate3 = new hiprint.PrintTemplate(); <!-- 模板对象添加打印面板 paperHeader:页眉线 paperFooter:页尾线--> var panel3 = hiprintTemplate3.addPrintPanel({ width: 210, height: 297, paperHeader: 45, paperFooter: 780,paperType:'A4' }); <!-- 传入超文本--> panel3.addPrintTable({ options: { "left": 16.5,"top": 57,"height": 38,"width": 562.5,"textAlign": "center","content": $('#tablehtml').html() } });