打印机正在从 Asp.net 开发中打印,而不是从 IIS 中打印
Printer is printing from Asp.net development but not printing from IIS
我正在尝试从 asp.net 应用程序打印条码标签到 Zebra 条码标签 printer.I 已经使用 asp.net 代码创建了 .txt 文件并且这些文件在开发过程中打印良好environment.but 发布 IIS 后未打印
我创建了以下代码以使用以下代码编写 .txt 文件
Using con
Using dr As SqlDataReader = cmd.ExecuteReader()
Using StringWriter
StringWriter.WriteLine("CT~~CD,~CC^~CT~")
StringWriter.WriteLine("^XA~TA000~JSN^LT0^MNW^MTD^PON^PMN^LH0,0^JMA^PR2,2~SD15^JUS^LRN^CI0^XZ")
While dr.Read()
Dim linex As String = "^FD>;" & dr.Item("BARCODEVALUE") & "^FS"
StringWriter.WriteLine("^XA")
StringWriter.WriteLine("^MMT")
StringWriter.WriteLine("^PW406")
StringWriter.WriteLine("^LL0203")
StringWriter.WriteLine("^LS0")
StringWriter.WriteLine("^BY3,3,82^FT51,113^BCN,,Y,N")
StringWriter.WriteLine(linex)
StringWriter.WriteLine("^PQ1,0,1,Y^XZ")
End While
End Using
End Using
End Using
Then below code to print the textfile by calling the cmd shell
<pre> Dim proc As New System.Diagnostics.Process
With proc.StartInfo
.FileName = "cmd.exe"
.Arguments = _shellcmd
.WindowStyle = ProcessWindowStyle.Hidden
End With
proc.Start()
其中 _shellcmd 是
Dim shellcommand As String = "/C copy " & barcodefile + " lpt1"
一切正常,正在打印标签,但是当我发布到 IIS 时它正在打印 nothing.I 已将默认池用户添加到服务器系统中连接的打印机
我需要在 Zebra 条码打印机上从 asp.net 应用程序打印标签
如果您的 Zebra 通过打印服务器连接,您可以使用 TcpClient。
using System.IO
using System.Net.Sockets
...
Dim tcpClient As New TcpClient()
tcpClient.Connect(printerIpAddress, printerPortNumber)
Using writer = New StreamWriter(tcpClient.GetStream())
writer.Write(zplString)
End Using
我正在尝试从 asp.net 应用程序打印条码标签到 Zebra 条码标签 printer.I 已经使用 asp.net 代码创建了 .txt 文件并且这些文件在开发过程中打印良好environment.but 发布 IIS 后未打印
我创建了以下代码以使用以下代码编写 .txt 文件
Using con Using dr As SqlDataReader = cmd.ExecuteReader() Using StringWriter StringWriter.WriteLine("CT~~CD,~CC^~CT~") StringWriter.WriteLine("^XA~TA000~JSN^LT0^MNW^MTD^PON^PMN^LH0,0^JMA^PR2,2~SD15^JUS^LRN^CI0^XZ") While dr.Read() Dim linex As String = "^FD>;" & dr.Item("BARCODEVALUE") & "^FS" StringWriter.WriteLine("^XA") StringWriter.WriteLine("^MMT") StringWriter.WriteLine("^PW406") StringWriter.WriteLine("^LL0203") StringWriter.WriteLine("^LS0") StringWriter.WriteLine("^BY3,3,82^FT51,113^BCN,,Y,N") StringWriter.WriteLine(linex) StringWriter.WriteLine("^PQ1,0,1,Y^XZ") End While End Using End Using End Using
Then below code to print the textfile by calling the cmd shell
<pre> Dim proc As New System.Diagnostics.Process
With proc.StartInfo
.FileName = "cmd.exe"
.Arguments = _shellcmd
.WindowStyle = ProcessWindowStyle.Hidden
End With
proc.Start()
其中 _shellcmd 是
Dim shellcommand As String = "/C copy " & barcodefile + " lpt1"
一切正常,正在打印标签,但是当我发布到 IIS 时它正在打印 nothing.I 已将默认池用户添加到服务器系统中连接的打印机
我需要在 Zebra 条码打印机上从 asp.net 应用程序打印标签
如果您的 Zebra 通过打印服务器连接,您可以使用 TcpClient。
using System.IO
using System.Net.Sockets
...
Dim tcpClient As New TcpClient()
tcpClient.Connect(printerIpAddress, printerPortNumber)
Using writer = New StreamWriter(tcpClient.GetStream())
writer.Write(zplString)
End Using