套打程序代码。

打印机:EPSON LQ-300K+II ESC/P2

制式:针孔;

纸张大小:134mm * 181mm

采用控件:LODOP 4.0 ;

 

前台代码展示:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="LoDopVesionContinuousPrint4_test.aspx.cs" Inherits="LoDopVesionContinuousPrint4_test" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>批量套打...</title>
<script language="javascript" src="CheckActivX.js"></script>
<object id="LODOP" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0>
</object>
</head>
<body>
<form id="form1"  runat="server"  >
<script language="javascript">
    var LODOP=document.getElementById("LODOP");//这行语句是为了符合DTD规范
    CheckLodop();
</script>
<script language="javascript" type="text/javascript">  

    function Preview2() {       
        CreateDataBill();
        LODOP.PREVIEW();       
    };           
    function Setup2() {       
        CreateDataBill();
        LODOP.PRINT_SETUP();       
    };
    function Design2() {       
        CreateDataBill();
        LODOP.PRINT_DESIGN();

    };   
    function RealPrint() {       
        CreateDataBill();
        if (LODOP.PRINTA())
           alert("已发出实际打印命令!");
        else
           alert("放弃打印!");
    };   
   

</script>
<%=this.mybuilder%>

 

<%--<asp:Button ID="Button1" runat="server"  Text="打印预览"    OnClientClick="javascript:Preview2()"    />--%>

<div align="center" >
点击:<img src="printmore.jpg"  οnclick="javascript:RealPrint()"  alt="批量打印"  />
<hr/>
<asp:TextBox ID="Txt_workFormIDs" runat="server"  TextMode="MultiLine"  width="400"  Height="400"  />
<font color="red"><h3><font color='#FF00FF'>如果打印控件未安装,点击这里<a href='install_lodop.exe'>执行安装</a>,安装后请刷新页面。</font></h3></font>
</div>
</form>


</body>
</html>

 

后台代码展示:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;
using System.Collections.Generic;

public partial class LoDopVesionContinuousPrint4_test : System.Web.UI.Page
{
    public string Width = "134mm";
    public string Height = "181mm";
    public int AddHeight = 0;
    public StringBuilder mybuilder;
    public int fontSize = 11;
    public int heightAdd = 0;
    public int leftAdd = -15;
   
    protected void Page_Load(object sender, EventArgs e)
    {

 

        if (Session["workFormID_Print"] == null)
        {
            Response.Write("Session[/"workFormID_Print/"]为NULL");
            Response.End();
        }
        string[] splitChar = { "," };
        List<string> listWorkFormID = Public.Split(Session["workFormID_Print"].ToString(), splitChar);

        mybuilder = new StringBuilder();

 

 

        this.Txt_workFormIDs.Text = "您要批量打印的单据是:"; 

        mybuilder.Append("<script language=/"javascript/" type=/"text/javascript/">");

        mybuilder.Append("/n");
        mybuilder.Append("function CreateDataBill() {");
        mybuilder.Append("/n");
        mybuilder.Append("var heightAdd=0;");
        mybuilder.Append("/n");
        mybuilder.Append("var leftAdd = -15;");
        mybuilder.Append("/n");
        mybuilder.Append("var fontsizeID = 0;");
        mybuilder.Append("/n");
        mybuilder.Append("LODOP.PRINT_INIT(/"打印插件功能演示_Lodop功能_自定义纸张/");");
        mybuilder.Append("/n");
        mybuilder.Append("LODOP.SET_PRINT_PAGESIZE(1,1340,1810,/"/");");
        mybuilder.Append("/n");

        foreach (string workID in listWorkFormID)
        {
            this.Txt_workFormIDs.Text += workID+",";
           
            mybuilder.Append("LODOP.ADD_PRINT_TEXT(parseInt(110)+parseInt(heightAdd),parseInt(70)+parseInt(leftAdd),91,21,'" + workID + "');");//单号
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(1)+parseInt(fontsizeID), /"FontSize/", " + fontSize + ");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(1)+parseInt(fontsizeID),/"Bold/",1);");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.ADD_PRINT_TEXT(parseInt(110)+parseInt(heightAdd),parseInt(231)+parseInt(leftAdd),110,20,/"2010-06-22 15:01/");");//投诉时间
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(2)+parseInt(fontsizeID), /"FontSize/", 9);");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.ADD_PRINT_TEXT(parseInt(105)+parseInt(heightAdd),parseInt(395)+parseInt(leftAdd),85,20,/"strName/");");//受理人
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(3)+parseInt(fontsizeID), /"FontSize/", " + fontSize + ");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(3)+parseInt(fontsizeID),/"Bold/",1);");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.ADD_PRINT_TEXT(parseInt(142)+parseInt(heightAdd),parseInt(128)+parseInt(leftAdd),105,22,/"2525775/");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(4)+parseInt(fontsizeID), /"FontSize/", " + fontSize + ");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.ADD_PRINT_TEXT(parseInt(143)+parseInt(heightAdd),parseInt(315)+parseInt(leftAdd),100,22,/"李振飞/");");//用户姓名
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(5)+parseInt(fontsizeID), /"FontSize/", " + fontSize + ");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.ADD_PRINT_TEXT(parseInt(170)+parseInt(heightAdd),parseInt(127)+parseInt(leftAdd),105,22,/"客户中心/");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(6)+parseInt(fontsizeID), /"FontSize/", " + fontSize + ");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.ADD_PRINT_TEXT(parseInt(168)+parseInt(heightAdd),parseInt(316)+parseInt(leftAdd),100,22,/"关云长/");");//联系人
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(7)+parseInt(fontsizeID), /"FontSize/", " + fontSize + ");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.ADD_PRINT_TEXT(parseInt(240)+parseInt(heightAdd),parseInt(124)+parseInt(leftAdd),331,20,/"佛山市南海区天佑三路/");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(8)+parseInt(fontsizeID), /"FontSize/", " + fontSize + ");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.ADD_PRINT_TEXT(parseInt(270)+parseInt(heightAdd),parseInt(110)+parseInt(leftAdd),38,20,/"一般/");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(9)+parseInt(fontsizeID), /"FontSize/", 10);");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.ADD_PRINT_TEXT(parseInt(270)+parseInt(heightAdd),parseInt(238)+parseInt(leftAdd),85,20,/"2010-05-30/");");//上次报障时间
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(10)+parseInt(fontsizeID), /"FontSize/", 9);");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.ADD_PRINT_TEXT(parseInt(270)+parseInt(heightAdd),parseInt(460)+parseInt(leftAdd),30,20,/"5/");");//报障次数
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(11)+parseInt(fontsizeID), /"FontSize/", " + fontSize + ");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.ADD_PRINT_TEXT(parseInt(316)+parseInt(heightAdd),parseInt(56)+parseInt(leftAdd),406,99,/"(1)电缆残旧破损(2)电费接头氧化接触不良(3)私...(省略)/");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(12)+parseInt(fontsizeID), /"FontSize/", " + fontSize + ");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.ADD_PRINT_TEXT(parseInt(440)+parseInt(heightAdd),parseInt(104)+parseInt(leftAdd),100,20,/"隋新/");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(13)+parseInt(fontsizeID), /"FontSize/", " + fontSize + ");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.ADD_PRINT_TEXT(parseInt(440)+parseInt(heightAdd),parseInt(261)+parseInt(leftAdd),82,20,/"常永刚/");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(14)+parseInt(fontsizeID), /"FontSize/", " + fontSize + ");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.ADD_PRINT_TEXT(parseInt(200)+parseInt(heightAdd),parseInt(161)+parseInt(leftAdd),100,20,/"0755-3237531/");");//固话
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(15)+parseInt(fontsizeID), /"FontSize/", 10);");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.ADD_PRINT_TEXT(parseInt(199)+parseInt(heightAdd),parseInt(310)+parseInt(leftAdd),159,20,/"15012345678/");");//手机
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(16)+parseInt(fontsizeID), /"FontSize/", " + fontSize + ");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.ADD_PRINT_TEXT(parseInt(500)+parseInt(heightAdd),parseInt(170)+parseInt(leftAdd),286,20,/"I5/");");//故障代码
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(17)+parseInt(fontsizeID), /"FontSize/", " + fontSize + ");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.ADD_PRINT_TEXT(parseInt(560)+parseInt(heightAdd),parseInt(106)+parseInt(leftAdd),353,87,/"经过上门维修,问题已经全部解决,客户满意程度高,信赖程度更高...(省略)/");");
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(18)+parseInt(fontsizeID), /"FontSize/", " + fontSize + ");");
            mybuilder.Append("/n");

            mybuilder.Append("LODOP.ADD_PRINT_TEXT(parseInt(645)+parseInt(heightAdd),parseInt(256)+parseInt(leftAdd),95,20,/"张建波/");");//--vesion4 设置OK
            mybuilder.Append("/n");
            mybuilder.Append("LODOP.SET_PRINT_STYLEA(parseInt(19)+parseInt(fontsizeID), /"FontSize/", " + fontSize + ");");
            mybuilder.Append("/n");
            mybuilder.Append("heightAdd+=parseInt(684);");
            mybuilder.Append("/n");
            mybuilder.Append("heightAdd+=parseInt(83);");//--这一行去掉,则预览时,多张都位置吻合,但加上“80”的高度,是为了吻合实际针头走纸的偏差。
            mybuilder.Append("/n");
            mybuilder.Append("fontsizeID+=parseInt(19);");

            mybuilder.Append("/n");
        }
        mybuilder.Append("/n");
        mybuilder.Append("LODOP.ADD_PRINT_SETUP_BKIMG(/"<img src='禅城有线电视维修通知单2.png' />/");");
        mybuilder.Append("/n");
        //mybuilder.Append("LODOP.SET_SHOW_MODE (/"BKIMG_IN_PREVIEW/",1);");
        //mybuilder.Append("/n"); 
        mybuilder.Append("}</script>");

 

 


          }
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值