TSC条码打印机webForm打印问题,急急急,在线等~~

limfungsuen 2012-03-27 02:33:55
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.Runtime.InteropServices;
public class TSCLIB_DLL
{
[DllImport("E:\\myWork\\TSCLIB.DLL-ASP.NET_in_VCsharp_2008\\ASP.NET_in_VCsharp_2008\\bin\\TSCLIB.dll", EntryPoint = "about")]
//HttpContext.Current.Server.MapPath(".\\bin\\TSCLIB.dll
public static extern int about();

[DllImport("E:\\myWork\\TSCLIB.DLL-ASP.NET_in_VCsharp_2008\\ASP.NET_in_VCsharp_2008\\bin\\TSCLIB.dll", EntryPoint = "openport")]
public static extern int openport(string printername);

[DllImport("E:\\myWork\\TSCLIB.DLL-ASP.NET_in_VCsharp_2008\\ASP.NET_in_VCsharp_2008\\bin\\TSCLIB.dll", EntryPoint = "barcode")]
public static extern int barcode(string x, string y, string type,
string height, string readable, string rotation,
string narrow, string wide, string code);

[DllImport("E:\\myWork\\TSCLIB.DLL-ASP.NET_in_VCsharp_2008\\ASP.NET_in_VCsharp_2008\\bin\\TSCLIB.dll", EntryPoint = "clearbuffer")]
public static extern int clearbuffer();

[DllImport("E:\\myWork\\TSCLIB.DLL-ASP.NET_in_VCsharp_2008\\ASP.NET_in_VCsharp_2008\\bin\\TSCLIB.dll", EntryPoint = "closeport")]
public static extern int closeport();

[DllImport("E:\\myWork\\TSCLIB.DLL-ASP.NET_in_VCsharp_2008\\ASP.NET_in_VCsharp_2008\\bin\\TSCLIB.dll", EntryPoint = "downloadpcx")]
public static extern int downloadpcx(string filename, string image_name);

[DllImport("E:\\myWork\\TSCLIB.DLL-ASP.NET_in_VCsharp_2008\\ASP.NET_in_VCsharp_2008\\bin\\TSCLIB.dll", EntryPoint = "formfeed")]
public static extern int formfeed();

[DllImport("E:\\myWork\\TSCLIB.DLL-ASP.NET_in_VCsharp_2008\\ASP.NET_in_VCsharp_2008\\bin\\TSCLIB.dll", EntryPoint = "nobackfeed")]
public static extern int nobackfeed();

[DllImport("E:\\myWork\\TSCLIB.DLL-ASP.NET_in_VCsharp_2008\\ASP.NET_in_VCsharp_2008\\bin\\TSCLIB.dll", EntryPoint = "printerfont")]
public static extern int printerfont(string x, string y, string fonttype,
string rotation, string xmul, string ymul,
string text);

[DllImport("E:\\myWork\\TSCLIB.DLL-ASP.NET_in_VCsharp_2008\\ASP.NET_in_VCsharp_2008\\bin\\TSCLIB.dll", EntryPoint = "printlabel")]
public static extern int printlabel(string set, string copy);

[DllImport("E:\\myWork\\TSCLIB.DLL-ASP.NET_in_VCsharp_2008\\ASP.NET_in_VCsharp_2008\\bin\\TSCLIB.dll", EntryPoint = "sendcommand")]
public static extern int sendcommand(string printercommand);

[DllImport("E:\\myWork\\TSCLIB.DLL-ASP.NET_in_VCsharp_2008\\ASP.NET_in_VCsharp_2008\\bin\\TSCLIB.dll", EntryPoint = "setup")]
public static extern int setup(string width, string height,
string speed, string density,
string sensor, string vertical,
string offset);

[DllImport("E:\\myWork\\TSCLIB.DLL-ASP.NET_in_VCsharp_2008\\ASP.NET_in_VCsharp_2008\\bin\\TSCLIB.dll", EntryPoint = "windowsfont")]
public static extern int windowsfont(int x, int y, int fontheight,
int rotation, int fontstyle, int fontunderline,
string szFaceName, string content);

}

namespace ASP.NET_in_VCsharp_2008
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}

protected void Button1_Click(object sender, EventArgs e)
{
//ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "msg", "alert('Hello TSCLIB.DLL')", true);
//TSCLIB_DLL.about(); //Show the DLL version
Response.Write("1");
TSCLIB_DLL.openport("TSC TTP-244 Plus"); //Open specified printer driver
Response.Write("1");
TSCLIB_DLL.setup("100", "63.5", "4", "8", "0", "0", "0"); //Setup the media size and sensor type info
Response.Write("2");
TSCLIB_DLL.clearbuffer(); //Clear image buffer
Response.Write("3");
TSCLIB_DLL.barcode("100", "50", "128", "50", "1", "0", "2", "2", "11110001"); //Drawing barcode
//TSCLIB_DLL.printerfont("300", "250", "3", "0", "1", "1", "王海军"); //Drawing printer font
//TSCLIB_DLL.windowsfont(100, 200, 24, 0, 0, 0, "ARIAL", "wanghaijun"); //Draw windows font
//TSCLIB_DLL.downloadpcx("C:\\ASP.NET_in_VCsharp_2008\\ASP.NET_in_VCsharp_2008\\UL.PCX", "UL.PCX"); //Download PCX file into printer
//TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX"); //Download PCX file into printer
//TSCLIB_DLL.sendcommand("PUTPCX 100,400,\"UL.PCX\""); //Drawing PCX graphic
Response.Write("4");
TSCLIB_DLL.printlabel("1", "1"); //(默认,打印张数) //Print labels
Response.Write("5");
TSCLIB_DLL.closeport();
Response.Write("6");
}
}
}


TSC条码打印机B/S模式打印接口,我在VS环境下调试正确,可以打印,配置到IIS下,用IE直接浏览打印,提示一个“登”的声音,什么框也没弹出,然后程序没反应了。请写过条码打印机的大侠指点。

我已经试过把TSCLIB_DLL,放到systems32目录,跟目录,bin目录...都是一样的情况。
...全文
563 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
l13873666736 2012-11-10
  • 打赏
  • 举报
回复
你在浏览器中使用客户端的打印机, 这个比较难,可能要用到浏览器插件
Saleayas 2012-11-10
  • 打赏
  • 举报
回复
Dllimport 的 DLL 路径不正确。
cnnbtop 2012-11-10
  • 打赏
  • 举报
回复
http://www.chinatsc.cn/ tsc官方网站下载打印驱动试试。还有,你把默认打印机设为条码打印机试试,我以前碰到过这个问题,我默认的是爱普生的,结果也是类似情况,你把默认打印机改了试试。
limfungsuen 2012-03-29
  • 打赏
  • 举报
回复
有大侠知道不?
limfungsuen 2012-03-28
  • 打赏
  • 举报
回复
没有知道吗?
自己先顶~

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧