斑马打印机连三菱PLC与VB.NET

前端之家收集整理的这篇文章主要介绍了斑马打印机连三菱PLC与VB.NET前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

一,通过三菱PLC连斑马打印机

1)通过RS指令发送ZPL II (zebra的编程语言)到打印机。通讯方式为RS232。

注意:RS指令要一直通电,通过脉冲触发M8122(发送请求),就能将指令传到打印机打印。

2)在三菱的D Memoryz中写入字符(ZPL II指令),可以用复制/粘贴TXT文档中的指令。

3)ZM400打印机的有Z/R/E存储区,分别为EPROM/DRAM/FLASH。DRAM掉电后不保持。

4)通过DF/XF存储/调用在存储区的打印格式。


二、通过VB.NET控制Zebra M400打印

1)http://support2.microsoft.com/default.aspx?scid=KB;EN-US;322090

2)http://www.cnblogs.com/zhanghl/archive/2005/09/08/232798.html

三、如何将ZebraDesigner设计的标签转成为ZPL指令的.txt文档?

安装好打印机驱动,修改打印机端口,新建一个打印机端口,类型为本地端口,端口名称设置为C:\printer.log,再用标签设计软件打印一次,此文件中就有ZPL指令了。

这时碰到一个问题,就是如何将多行字符传送到RawPrinterHelper(),将字符串放入xml中,如下:

Dim strZPL = <string>

^XA

^XFR:SAMPLE.GRF

^FN1^FD<%= TextBox1.Text %>^FS 'TestBox1中的内容

^XZ

</string>.Value


四、将电脑上的打印机名称列举出来

For Each pkInstalledPrinters As String In System.Drawing.Printing.PrinterSettings.InstalledPrinters
            cmbInstalledPrinters.Items.Add(pkInstalledPrinters)
        Next
        If (cmbInstalledPrinters.Items.Contains("Zebra  ZM400 200 dpi (ZPL)")) Then
            cmbInstalledPrinters.Text = "Zebra  ZM400 200 dpi (ZPL)"
        End If



Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports ZPLPrinter
Imports System.IO.File
 
Public Class Form1
 
 
 
    Dim pkInstalledPrinters As String
    Dim strZPLFormat = <string>
    ^XA
    ^LH0,0
    ^DFR:SAMPLE.GRF^FS
    ^FO30,40
    ^ADN18,10
    ^FDSHIP TO:^FS
    ^FO50,60
    ^ADN20,20
    ^FN1^FS
    ^XZ
    </string>.Value
 
    
 
    Private Sub Form1_Load(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.Load
 
        For Each pkInstalledPrinters As String In System.Drawing.Printing.PrinterSettings.InstalledPrinters
            cmbInstalledPrinters.Items.Add(pkInstalledPrinters)
        Next
        If (cmbInstalledPrinters.Items.Contains("Zebra  ZM400 200 dpi (ZPL)")) Then
            cmbInstalledPrinters.Text = "Zebra  ZM400 200 dpi (ZPL)"
        End If
    End Sub
 
 
    Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click
        RawPrinterHelper.SendStringToPrinter(cmbInstalledPrinters.Text,strZPLFormat)
 
    End Sub
 
    Private Sub SendFile_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles SendFile.Click
        RawPrinterHelper.SendFileToPrinter(cmbInstalledPrinters.Text,"D:\print.log")
    End Sub
 
    Private Sub Button2_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button2.Click
        Dim strZPL = <string>
    ^XA
    ^XFR:SAMPLE.GRF
    ^FN1^FD<%= TextBox1.Text %>^FS     
    ^XZ
    </string>.Value
        If (Not String.IsNullOrEmpty(TextBox1.Text)) Then
            RawPrinterHelper.SendStringToPrinter(cmbInstalledPrinters.Text,strZPL)
        Else
            MessageBox.Show("text is Empty")
        End If
 
    End Sub
 
     
End Class


How to insert barcode images into a Microsoft Excel worksheet using C# or VB.NET and Barcode Professional for .NET

http://www.neodynamic.com/ND/FaqsTipsTricks.aspx?tabid=66&prodid=3&sid=35

原文链接:https://www.f2er.com/vb/256665.html

猜你在找的VB相关文章