码迷,mamicode.com
首页 > 其他好文 > 详细

lodoop打印控件详解

时间:2014-07-31 13:21:06      阅读:444      评论:0      收藏:0      [点我收藏+]

标签:lodoop在线打印

注意:使用此打印控件需要引入(在我上传的Demo中都有):
	install_lodop32.exe
	install_lodop64.exe
	LodopFuncs.js
	jquery-1.10.0.min.js

具体Demo下载地址: http://download.csdn.net/download/l294333475/7697807

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>My JSP 'TestLodoop.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	


	<script language="javascript" src="<%=basePath%>lodop/LodopFuncs.js"></script>
	<script src="<%=basePath%>js/jquery-1.10.0.min.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></embed>
	</object>
	
	<script language="javascript">
		var LODOP=getLodop(document.getElementById('LODOP_OB'),document.getElementById('LODOP_EM'),"<%=basePath%>lodop/");
		$(document).ready(function(){
			if(LODOP == null || (typeof(LODOP.VERSION)=="undefined")){
				$("#btnPrintView").attr("disabled","disabled");
				$("#btnPrint").attr("disabled","disabled");
				$("#btnNext").attr("disabled","disabled");
			}
			else{
				CreatePrinterList();
			}
		});
		
		//打印
		function print(){
			document.getElementById("showInstall").innerHTML = "";
			Create();
			//LODOP.SET_PRINT_COPIES(2);
			LODOP.SET_PRINT_MODE("CATCH_PRINT_STATUS",true);
			var code = LODOP.PRINTA();
			alert(code);
			var ret = LODOP.GET_VALUE("PRINT_STATUS_OK",code);
			alert(ret);
			if(ret){
				$("#btnNext").attr("disabled","none");
			}
			else{
				document.getElementById("showInstall").innerHTML = "<font color='#FF00FF'>打印失败</font>";
			}
		}		
		
		
		//加载打印机
		function CreatePrinterList(){
		    if (document.getElementById('PrinterList').innerHTML!="") return;
			LODOP=getLodop(); 
			var iPrinterCount=LODOP.GET_PRINTER_COUNT();
			for(var i=0;i<iPrinterCount;i++){
	
	   			var option=document.createElement('option');
	   			option.innerHTML=LODOP.GET_PRINTER_NAME(i);
	   			option.value=i;
				document.getElementById('PrinterList').appendChild(option);
			};	
		};
		
		//打印预览
		function preview() {
			Create();
			LODOP.SET_PREVIEW_WINDOW(1,0,0,0,0,"");
			LODOP.PREVIEW();
		};
		
		function Create(){
			LODOP.PRINT_INIT("");	
			LODOP.SET_PRINT_MODE("WINDOW_DEFPRINTER",getSelectedPrintIndex());//设置打印机
			LODOP.SET_PRINT_MODE("WINDOW_DEFPAGESIZE:"+getSelectedPrintIndex(),"A4");//设置打印纸张为A4
			
			LODOP.ADD_PRINT_HTM(10,30,700,1080,document.getElementById("tRequest").innerHTML);
			
			LODOP.NewPage();							
			CreateDataBill();
			
			LODOP.NewPage();			
			CreateDataSeal();
			
			LODOP.NewPage();
			LODOP.ADD_PRINT_HTM(30,30,700,1080,document.getElementById("tDeal").innerHTML);
		}
		
		//选择打印机
		function getSelectedPrintIndex(){
			return document.getElementById("PrinterList").value;
		};
		
		//法人代表授权书
		function CreateDataBill() {
		
			LODOP.ADD_PRINT_TEXT(97,220,500,20,"法人代表授权书");
			LODOP.SET_PRINT_STYLEA(0,"FontSize",30);
			LODOP.SET_PRINT_STYLE("FontSize",14);
			LODOP.ADD_PRINT_TEXT(190,150,300,20,"本授权书声明:总部设在(地址)");
			LODOP.ADD_PRINT_LINE(205,420, 205, 600,0, 1);
			LODOP.ADD_PRINT_TEXT(190,600,150,20,",(公司名称)");
			
			LODOP.ADD_PRINT_LINE(255,100, 255, 250,0, 1);			
			LODOP.ADD_PRINT_TEXT(240,250,200,20,"公司(法人代表)");
			LODOP.ADD_PRINT_LINE(255,400, 255, 500,0, 1);
			LODOP.ADD_PRINT_TEXT(240,500,250,20,"(即下面签字的授权人),");
			
			LODOP.ADD_PRINT_TEXT(290,100,300,20,"代表本公司授权(被授权人)");
			LODOP.ADD_PRINT_LINE(315,350, 315, 450,0, 1);
			LODOP.ADD_PRINT_TEXT(290,450,400,20,"(即下面签字的被授权人)");
			LODOP.ADD_PRINT_TEXT(340,100,600,20,"为本公司合法代理人,到贵方办理CFCA数字证书相关事宜。");
			
			LODOP.ADD_PRINT_TEXT(420,150,550,20,"本公司承认该代表所签署文件及提交公司文件的法律效力。");
			
			LODOP.ADD_PRINT_TEXT(500,100,100,20,"被授权人:");
			LODOP.ADD_PRINT_TEXT(500,400,100,20,"授权人:");
			LODOP.ADD_PRINT_TEXT(600,100,200,20,"填写公司名称(公章)");
			LODOP.ADD_PRINT_TEXT(650,100,200,20,"日期");
			
		};
		
		//印章采集页
		function CreateDataSeal(){
			LODOP.ADD_PRINT_TEXT(97,250,500,20,"印章采集");
			LODOP.SET_PRINT_STYLEA(0,"FontSize",30);
			LODOP.SET_PRINT_STYLE("FontSize",14);
			LODOP.ADD_PRINT_TEXT(190,100,550,20,"此印章仅用于办理中国大唐集团公司集采平台电子钥匙使用。");
			LODOP.ADD_PRINT_TEXT(240,100,550,20,"请将公章/合同专用章加盖在以下方框内。");
			LODOP.ADD_PRINT_RECT(290, 200, 200, 200,0, 1);
			LODOP.ADD_PRINT_TEXT(540,100,650,20,"此法人签字/印章仅用于办理中国大唐集团公司集采平台电子钥匙使用。");
			LODOP.ADD_PRINT_TEXT(590,100,650,20,"请将法人签字写在以下方框内,或者将法人印章加盖在以下方框内。");
			LODOP.ADD_PRINT_RECT(640, 200, 200, 200,0, 1);
		}
	</script>
	
	
  </head>
  <body>
  <!-- 以下为设置打印内容 -->
   <div>
		<p class="text1"><span>指定打印机:<select id="PrinterList" size="1"></select></span></p>
		<p class="text1"><span>指定纸张:A4</span></p>
		<p>
		<button id="btnPrintView" onclick="preview();">在线预览</button>
		<button id="btnPrint" onclick="print();">在线打印</button>
		</p>
		<p><div id="showInstall"></div></p>
	</div>
	
	<button id="btnNext" onClick="javascript:window.location.href='<%=basePath%>supplier/send.do'">下一步</button>
	
	
	
	<!-- 以下为具体需要打印的内容 -->
	<div id ="tRequest" style="display:none;">
	<p style="margin:0px;text-align:center;font-size:30px;">企业证书申请表<img src="01.jpg" /></p>
	  <table style="border-collapse:collapse;width:700px;">
	  	<tr>
	  		<td style="width:30px"></td>
	  		<td style="width:70px"></td>
	  		<td style="width:150px"></td>
	  		<td style="width:100px"></td>
	  		<td style="width:100px"></td>
	  		<td style="width:100px"></td>
	  		<td style="width:150px"></td>
	  	</tr>
		<tr>
	  		<td colspan="2" style="width:100px;border: 1px solid #000;height:50px;">申请日期</td>
	  		<td colspan="2" style="width:200px;border: 1px solid #000;">2014-07-31</td>
	  		<td style="width:100px;border: 1px solid #000;">证书数量</td>
	  		<td colspan="2" style="width:290px;border: 1px solid #000;">2</td>
	  	</tr>
	  	<tr>
	  		<td colspan="2" style="border: 1px solid #000;height:50px;">证书种类</td>
	  		<td colspan="5" style="border: 1px solid #000;">
	  			<input type="checkbox" />高级证书<input type="checkbox" checked/>普通证书<input type="checkbox" />Direct Server证书
	  			<input type="checkbox" />Web Server证书
	  			<input type="checkbox" />安全E-mail证书<input type="checkbox" />CodeSigning证书<input type="checkbox" />其它种类证书
	  		</td>
	  	</tr>
	  	<tr>
	  		<td colspan="2" style="border: 1px solid #000;height:25px;">所属系统</td>
	  		<td colspan="5" style="border: 1px solid #000;">
	  			<input type="checkbox" />E-01<input type="checkbox" checked/>J-01
	  		</td>
	  	</tr>
	  			
	  	
	  	<tr>
	  		<td style="width:30px;text-align:center;vertical-align:middle;border: 1px solid #000;" rowspan="10">企业信息</td>
	  	
	  		<td colspan="2" style="border: 1px solid #000;height:25px;width:150px;">中文名称</td>
	  		<td colspan="4" style="border: 1px solid #000;">南京优泰科技发展有限公司</td>
	  	</tr>
	  	<tr>
	  		<td colspan="2" style="border: 1px solid #000;height:25px;">英文/拼音简称</td>
	  		<td colspan="4" style="border: 1px solid #000;">utc</td>
	  	</tr>
	  	<tr>
	  		<td colspan="2" style="border: 1px solid #000;height:25px;">WEB域名</td>
	  		<td colspan="4" style="border: 1px solid #000;">www.utcsoft.com(仅限于服务器证书)</td>
	  	</tr>
	  	<tr>
	  		<td colspan="2" style="border: 1px solid #000;height:25px;">证件类型</td>
	  		<td colspan="4" style="border: 1px solid #000;">
	  			<input class="myradio" type="checkbox" name="radioCardType" value="zzjg">组织机构代码证
				<input class="myradio" type="checkbox" name="radioCardType" value="yyzz">企业营业执照
				<input class="myradio" type="checkbox" name="radioCardType" value="qt">其他
	  		</td>
	  	</tr>
	  	<tr>
	  		<td colspan="2" style="border: 1px solid #000;height:25px;">证件号码</td>
	  		<td colspan="4" style="border: 1px solid #000;">1111</td>
	  	</tr>
	  	<tr>
	  		<td colspan="2" style="border: 1px solid #000;height:25px;">主管领导(签名)</td>
	  		<td colspan="3" style="border: 1px solid #000;"></td>
	  		<td rowspan="5" style="width:150px;border: 1px solid #000;vertical-align:bottom;">(单位盖章)</td>
	  	</tr>
	  	<tr>
	  		<td colspan="2" style="border: 1px solid #000;height:25px;">单位地址</td>
	  		<td colspan="3" style="border: 1px solid #000;">1111</td>
	  	</tr>
	  	<tr>
	  		<td colspan="2" style="border: 1px solid #000;height:25px;">省(市)</td>
	  		<td colspan="3" style="border: 1px solid #000;">1111</td>
	  	</tr>
	  	<tr>
	  		<td colspan="2" style="border: 1px solid #000;height:25px;">电话</td>
	  		<td colspan="3" style="border: 1px solid #000;">1111</td>
	  	</tr>
	  	<tr>
	  		<td colspan="2" style="border: 1px solid #000;height:25px;">传真</td>
	  		<td colspan="3" style="border: 1px solid #000;">1111</td>
	  	</tr>
	  	<tr>
	  		<td style="width:30px;text-align:center;vertical-align:middle;border: 1px solid #000;" rowspan="8">办理人信息</td>
	  	
	  		<td colspan="2" style="border: 1px solid #000;height:25px;">姓名(签名)</td>
	  		<td colspan="4" style="border: 1px solid #000;">刘鹏</td>
	  	</tr>
	  	<tr>
	  		<td colspan="2" style="border: 1px solid #000;height:25px;">证件类型</td>
	  		<td colspan="4" style="border: 1px solid #000;">
				<input type="checkbox" checked/>身份证<input type="checkbox" />军官证<input type="checkbox" />港澳通行证
				<input type="checkbox" />护照<input type="checkbox" />其他
			</td>
	  	</tr>
	  	<tr>
	  		<td colspan="2" style="border: 1px solid #000;height:25px;">证件号码</td>
	  		<td colspan="4" style="border: 1px solid #000;">${agent.agentCardNum}</td>
	  	</tr>
	  	<tr>
	  		<td colspan="2" style="border: 1px solid #000;height:25px;">电话</td>
	  		<td colspan="4" style="border: 1px solid #000;">1111</td>
	  	</tr>
	  	<tr>
	  		<td colspan="2" style="border: 1px solid #000;height:25px;">电子邮件</td>
	  		<td colspan="4" style="border: 1px solid #000;">1111</td>
	  	</tr>
	  	<tr>
	  		<td colspan="2" style="border: 1px solid #000;height:25px;">通信地址</td>
	  		<td colspan="4" style="border: 1px solid #000;">1111</td>
	  	</tr>
	  	<tr>
	  		<td colspan="2" style="border: 1px solid #000;height:25px;">邮政编码</td>
	  		<td colspan="4" style="border: 1px solid #000;">1111</td>
	  	</tr>
	  	<tr>
	  		<td colspan="2" style="border: 1px solid #000;height:25px;">确认意见</td>
	  		<td colspan="4" style="border: 1px solid #000;">
				<input type="checkbox" checked/>上述信息属实<input type="checkbox" />上述信息不属实
			</td>
	  	</tr>
	  	<tr>
	  		<td style="width:30px;text-align:center;vertical-align:middle;border: 1px solid #000;" rowspan="2">C<br>F<br>C<br>A<br>意见</td>
	  	
	  		<td colspan="2" style="border: 1px solid #000;height:25px;">CFCA经办人:</td>
	  		<td colspan="2" style="border: 1px solid #000;">
	  			<input type="checkbox" />以上手续完备<br><input type="checkbox" />以上手续完备
	  		</td>
	  		<td colspan="2" style="border: 1px solid #000;">
	  			业务部审核员:<br>
	  			业务审核日期:
	  		</td>
	  	</tr>
	  	<tr>
	  		<td colspan="4" style="border: 1px solid #000;height:25px;">分管领导:<br><br><br><br></td>
	  		<td colspan="2" style="border: 1px solid #000;vertical-align:bottom;">
	  			(CFCA盖章)
	  		</td>
	  	</tr>
	  	<tr>
	  		<td style="width:30px;text-align:center;vertical-align:middle;border: 1px solid #000;">操作</td>
	  	
	  		<td colspan="4" style="border: 1px solid #000;height:25px;">
				运行部录入人员:<br>
				录入日期:
			</td>
	  		<td colspan="2" style="border: 1px solid #000;">
	  			运行部审核人员:<br>
	  			审核日期:
	  		</td>
	  	</tr>
	  	<tr>
	  		<td style="width:30px;text-align:center;vertical-align:middle;border: 1px solid #000;">备注</td>
	  	
	  		<td colspan="6" style="border: 1px solid #000;">
				如您办理电子钥匙续费,请在此栏注明您所持有的电子钥匙的DN号码:<br><br>
			</td>
	  	</tr>
	  </table>
	</div>
	
	
	
	<div id="tDeal" style="display:none;">
		<p style="text-align:center;font-size:30px;">购买协议</p>
		<table style="border-collapse:collapse;width:700px;">
			<tr>
				<td style="width:30px;"></td>
				<td style="width:150px;"></td>
				<td style="width:150px;"></td>
				<td style="width:200px;"></td>
				<td style="width:170px;"></td>
			</tr>
			<tr>
				<td rowspan="3" style="width:30px;text-align:center;vertical-align:middle;border: 1px solid #000;">供方</td>
				<td style="width:80px;height:30px;border: 1px solid #000;">企业名称</td>
				<td colspan="4" style="height:30px;border: 1px solid #000;">南京优泰科技发展有限公司</td>
			</tr>
			<tr>
				<td style="width:80px;height:30px;border: 1px solid #000;">开户银行</td>
				<td colspan="4" style="height:30px;border: 1px solid #000;">工商银行南京市新街口支行</td>
			</tr>
			<tr>
				<td style="width:80px;height:30px;border: 1px solid #000;">账号</td>
				<td colspan="4" style="height:30px;border: 1px solid #000;">4301010019101143205</td>
			</tr>
			<tr>
				<td rowspan="2" style="width:30px;text-align:center;vertical-align:middle;border: 1px solid #000;">需方</td>
				<td style="width:150px;height:30px;border: 1px solid #000;">企业名称</td>
				<td colspan="3" style="height:30px;border: 1px solid #000;"></td>
				<td rowspan="2" style="width:150px;height:150px;border: 1px solid #000;vertical-align:bottom;">(盖章)</td>
			</tr>
			<tr>
				<td style="width:150px;height:30px;border: 1px solid #000;">联系人/电话</td>
				<td colspan="3" style="height:30px;border: 1px solid #000;"></td>
			</tr>
			<tr>
				<td colspan="2" style="height:30px;border: 1px solid #000;">产品名称</td>
				<td colspan="4" style="height:30px;border: 1px solid #000;">优泰电子签章系统软件V9.0</td>
			</tr>
			<tr>
				<td colspan="2" style="height:30px;border: 1px solid #000;">数量</td>
				<td colspan="4" style="height:30px;border: 1px solid #000;">优泰电子签章系统软件V9.0</td>
			</tr>
			<tr>
				<td colspan="2" style="height:30px;border: 1px solid #000;">金额</td>
				<td style="height:30px;border: 1px solid #000;">¥</td>
				<td colspan="3" style="height:30px;border: 1px solid #000;">大写</td>
			</tr>
			<tr>
				<td colspan="2" style="height:30px;border: 1px solid #000;">日期</td>
				<td colspan="4" style="height:30px;border: 1px solid #000;">优泰电子签章系统软件V9.0</td>
			</tr>
			<tr>
				<td style="width:30px;text-align:center;vertical-align:middle;border: 1px solid #000;">备注</td>
				<td colspan="5" style="height:200px;border: 1px solid #000;">
					1、	本软件产品受著作权法及国际条约条款和知识产权保护法及条约的保护。<br>
					2、	本软件产品用于大唐项目。<br>
					3、	本软件在供方确认收款后,三个工作日内发出。<br>
					4、	请将此协议盖章后与其他申请材料一同邮寄<br>
					5、	需方签署本协议,表明需方已接受在办理电子钥匙时提供公章或者法人签字的图片,并保证其真实性。
					
				</td>
			</tr>
		</table>
	</div>
	
  </body>
</html>
bubuko.com,布布扣bubuko.com,布布扣bubuko.com,布布扣bubuko.com,布布扣

lodoop打印控件详解,布布扣,bubuko.com

lodoop打印控件详解

标签:lodoop在线打印

原文地址:http://blog.csdn.net/liupeng_family/article/details/38314219

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!