如何在vue项目中使用lodop打印插件
https://www.jianshu.com/p/d288963c1a80先写了个webdemo<%--Created by IntelliJ IDEA.User: AdministratorDate: 2018/12/17Time: 13:49To change this template use File | Settings | Fil...
·
先写了个webdemo
<%--
Created by IntelliJ IDEA.
User: Administrator
Date: 2018/12/17
Time: 13:49
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>$Title$</title>
<%--<script type="text/javascript" src="../res/vankewebstyle/js/jquery-1.9.0.js"></script>--%>
<script language="javascript" src="lodop/LodopFuncs.js"></script>
<object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0>
<embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0 pluginspage="install_lodop.exe"></embed>
</object>
<script type="text/javascript">
var LODOP; //声明为全局变量
function printPreview(){
//创建小票打印页
CreatePrintPage();
//打印预览
LODOP.PREVIEW();
}
function printOrder() {
//创建小票打印页
CreatePrintPage();
//开始打印
LODOP.PRINT();
};
function CreatePrintPage() {
var LODOP=getLodop();
LODOP.PRINT_INIT("test");
LODOP.SET_PRINT_PAGESIZE (1,'209mm','196mm',2);//设置纸张大小
LODOP.SET_PRINT_MODE("PRINT_PAGE_PERCENT","Auto-Width");//设置页面缩放
LODOP.ADD_PRINT_HTM(25,25,"100%","100%",document.getElementById("textarea01").value);//设置页面填充内容
//LODOP.PRINT();
LODOP.PREVIEW();
}
</script>
<body>
<embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0 pluginspage="../res/lodop/install_lodop32.exe"></embed>
<textarea rows="15" cols="80" style="display: none;" id="textarea01">
<h2> 青岛港国际物流有限公司</h2>
<h3> 代理费用支出审批单 </h3>
<p> <strong> NO.1544670046087</strong></p>
<h3> 申请日期:2018-03-14</h3>
<table border="1" cellspacing="0" style="width:698.8500pt">
<tbody>
<tr>
<td colspan="2" style="height:24.9500pt; vertical-align:top; width:141.8000pt">
<p>付款方式: </p>
</td>
<td colspan="5" style="height:24.9500pt; vertical-align:top; width:324.0500pt">
<p>支票 [√] 网付 [ ] 现金 [ ] 其他 [ ] </p>
</td>
<td colspan="4" style="height:24.9500pt; vertical-align:top; width:233.0000pt">
<p>申请人: </p>
</td>
</tr>
<tr>
<td colspan="2" style="height:25.5500pt; vertical-align:top; width:141.8000pt">
<p>收款单位: </p>
</td>
<td colspan="5" style="height:25.5500pt; vertical-align:top; width:324.0500pt">
<p>青岛尚世通报关公司</p>
</td>
<td colspan="4" style="height:25.5500pt; vertical-align:top; width:233.0000pt">
<p>申请部门:矿石 </p>
</td>
</tr>
<tr>
<td colspan="2" style="height:24.9500pt; vertical-align:top; width:141.8000pt">
<p>开户行: </p>
</td>
<td colspan="5" style="height:24.9500pt; vertical-align:top; width:324.0500pt">
<p>青岛银行崇明岛支行 </p>
</td>
<td colspan="4" style="height:24.9500pt; vertical-align:top; width:233.0000pt">
<p>结算审核: </p>
</td>
</tr>
<tr>
<td colspan="2" style="height:24.9500pt; vertical-align:top; width:141.8000pt">
<p>账号 </p>
</td>
<td colspan="5" style="height:24.9500pt; vertical-align:top; width:324.0500pt">
<p>6226661584247</p>
</td>
<td colspan="4" style="height:24.9500pt; vertical-align:top; width:233.0000pt">
<p> </p>
</td>
</tr>
<tr>
<td style="height:33.4000pt; vertical-align:top; width:84.9500pt">
<p>客户名称 </p>
</td>
<td style="height:33.4000pt; vertical-align:top; width:56.8500pt">
<p>货种 </p>
</td>
<td style="height:33.4000pt; vertical-align:top; width:56.8000pt">
<p>船名 </p>
</td>
<td style="height:33.4000pt; vertical-align:top; width:71.0500pt">
<p>航次 </p>
</td>
<td style="height:33.4000pt; vertical-align:top; width:78.1000pt">
<p>提单号 </p>
</td>
<td style="height:33.4000pt; vertical-align:top; width:99.4500pt">
<p>箱型\箱量 </p>
</td>
<td colspan="2" style="height:33.4000pt; vertical-align:top; width:92.3000pt">
<p>费用项目 </p>
</td>
<td style="height:33.4000pt; vertical-align:top; width:81.6500pt">
<p>付款金额 </p>
</td>
<td colspan="2" style="height:33.4000pt; vertical-align:top; width:77.7000pt">
<p>备注 </p>
</td>
</tr>
<tr>
<td style="height:24.9500pt; vertical-align:top; width:84.9500pt">
<p> </p>
</td>
<td style="height:24.9500pt; vertical-align:top; width:56.8500pt">
<p> </p>
</td>
<td style="height:24.9500pt; vertical-align:top; width:56.8000pt">
<p> </p>
</td>
<td style="height:24.9500pt; vertical-align:top; width:71.0500pt">
<p> </p>
</td>
<td style="height:24.9500pt; vertical-align:top; width:78.1000pt">
<p>附明细 </p>
</td>
<td style="height:24.9500pt; vertical-align:top; width:99.4500pt">
<p> </p>
</td>
<td colspan="2" style="height:24.9500pt; vertical-align:top; width:92.3000pt">
<p>单证费 </p>
</td>
<td style="height:24.9500pt; vertical-align:top; width:81.6500pt">
<p>50.00</p>
</td>
<td colspan="2" style="height:24.9500pt; vertical-align:top; width:77.7000pt">
<p> </p>
</td>
</tr>
<tr>
<td style="height:12.7500pt; vertical-align:top; width:84.9500pt">
<p>合计(¥/$)</p>
</td>
<td style="height:12.7500pt; vertical-align:top; width:56.8500pt">
<p> </p>
</td>
<td style="height:12.7500pt; vertical-align:top; width:56.8000pt">
<p> </p>
</td>
<td style="height:12.7500pt; vertical-align:top; width:71.0500pt">
<p> </p>
</td>
<td style="height:12.7500pt; vertical-align:top; width:78.1000pt">
<p> </p>
</td>
<td colspan="3" style="height:12.7500pt; vertical-align:top; width:191.7500pt">
<p> </p>
</td>
<td colspan="2" style="height:12.7500pt; vertical-align:top; width:82.5500pt">
<p>50.00</p>
</td>
<td style="height:12.7500pt; vertical-align:top; width:76.8000pt">
<p> </p>
</td>
</tr>
<tr>
<td colspan="2" style="height:24.9500pt; vertical-align:top; width:141.8000pt">
<p>大写 ( 人民币 / 美金 )</p>
</td>
<td colspan="9" style="height:24.9500pt; vertical-align:top; width:557.0500pt">
<p>伍拾元整</p>
</td>
</tr>
</tbody>
</table>
<p>总经理: 财务部经理: 部门经理: </p>
<p> </p>
<h2> 代理费用支出审批单明细</h2>
<p> <strong> NO.1544670046087</strong></p>
<p> </p>
<table border="1" cellspacing="0" style="width:429.3500pt">
<tbody>
<tr>
<td style="height:15.4500pt; vertical-align:top; width:45.4500pt">
<p>客户名称 </p>
</td>
<td style="height:15.4500pt; vertical-align:top; width:42.9000pt">
<p>货种 </p>
</td>
<td style="height:15.4500pt; vertical-align:top; width:42.9000pt">
<p>船名 </p>
</td>
<td style="height:15.4500pt; vertical-align:top; width:45.3000pt">
<p>航次 </p>
</td>
<td style="height:15.4500pt; vertical-align:top; width:74.7000pt">
<p>提单号 </p>
</td>
<td style="height:15.4500pt; vertical-align:top; width:45.7500pt">
<p>箱型/箱量 </p>
</td>
<td style="height:15.4500pt; vertical-align:top; width:42.9000pt">
<p>费用项目 </p>
</td>
<td style="height:15.4500pt; vertical-align:top; width:46.4000pt">
<p>付款金额 </p>
</td>
<td style="height:15.4500pt; vertical-align:top; width:42.9000pt">
<p>备注 </p>
</td>
</tr>
<tr>
<td style="height:16.2000pt; vertical-align:top; width:45.4500pt">
<p>青岛光辉通达物流仓储公司 </p>
</td>
<td style="height:16.2000pt; vertical-align:top; width:42.9000pt">
<p>锰矿 </p>
</td>
<td style="height:16.2000pt; vertical-align:top; width:42.9000pt">
<p>asd </p>
</td>
<td style="height:16.2000pt; vertical-align:top; width:45.3000pt">
<p>123</p>
</td>
<td style="height:16.2000pt; vertical-align:top; width:74.7000pt">
<p>SHSGSSGS</p>
</td>
<td style="height:16.2000pt; vertical-align:top; width:45.7500pt">
<p> </p>
</td>
<td style="height:16.2000pt; vertical-align:top; width:42.9000pt">
<p>报关费 </p>
</td>
<td style="height:16.2000pt; vertical-align:top; width:46.4000pt">
<p>¥50.0</p>
</td>
<td style="height:16.2000pt; vertical-align:top; width:42.9000pt">
<p> </p>
</td>
</tr>
<tr>
<td style="height:15.4500pt; vertical-align:top; width:45.4500pt">
<p>合计(¥/$)</p>
</td>
<td colspan="7" style="height:15.4500pt; vertical-align:top; width:340.8500pt">
<p>¥50.00</p>
</td>
<td style="height:15.4500pt; vertical-align:top; width:42.9000pt">
<p> </p>
</td>
</tr>
<tr>
<td colspan="2" style="height:15.4500pt; vertical-align:top; width:88.3500pt">
<p>大写(人民币/美金)</p>
</td>
<td colspan="7" style="height:15.4500pt; vertical-align:top; width:340.8500pt">
<p>伍拾元整</p>
</td>
</tr>
</tbody>
</table>
<p> 申请人:徐洋洋 </p>
<p> 申请日期:2018-03-14</p>
<p> </p>
</textarea>
<input type="button" value="打印预览" onclick="printPreview()" />
<!-- 控制打印按钮,自动打印可以直接执行printOrder-->
<input type="button" value="直接打印" onclick="printOrder()" />
</body>
</html>
生成的word的html还未进行页面调整,而且还有一些变形,预览效果显示真的很差...就先这样吧。
更多推荐
已为社区贡献3条内容
所有评论(0)