标签打印需要帮助 [英] label printing help needed

查看:57
本文介绍了标签打印需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用GC420GT Zebra标签打印机。

我的目标是打印大纸箱的标签贴纸(即纸卷宽度上的单列标签)和打印标签小包装贴纸(即2纸卷上的列标签宽度)

我需要根据用户定义的no打印它:标签



我搜索了谷歌我找到了ZPL,ZPL II和EPL2编程语言。



问题1)如果我用上述任何一种语言表达我的要求它是否支持普通标签打印机其他斑马?如果没有PLZ给你宝贵的建议PLZ ...



问题2)是否可以使用微软RawPrinterHelper.SendStringToPrinter()函数打印标签?

我用它进行热敏打印



问题3)对设备独立打印应该采用哪种方法?

plz给出帮助链接和有价值的建议

解决方案

1)ZPL& EPL是常见的Zebra打印机命令语言,可以与支持它们的任何Zebra打印机一起使用,也可以与通常运送ZPL或EPL仿真的其他品牌一起使用,如Datamax,Intermec等。如果您想支持更广泛的打印机,那么ZPL &安培; EPL不是要走的路。在.NET中,我使用PrintDocument类进行打印,这需要每台目标打印机使用Windows驱动程序。问题是打印性能。如果您要支持大容量打印,那么使用本机打印机命令语言(如ZPL或EPL for Zebras)是最好的方法,我不会通过Windows API打印(PrintDocument)。每种方法都有其专业版和专业版。缺点。



2)RawPrinterHelper只能用于发送原生打印机命令!即你可以发送ZPL,EPL,ESC / POS即目标打印机支持的任何命令



3)同样,我使用.NET PrintDocument,但打印性能永远不会与发送本机打印机命令相媲美。

Hello George,



您可以使用Zebra打印机对打印机使用简单的打印命令。您只需在打印期间设置标签尺寸。



下面给出代码: -





 使用系统; 
使用 System.Collections.Generic;
使用 System.Linq;
使用 System.Windows.Forms;
使用 System.Drawing.Printing;
使用 System.Drawing;
使用 System.Windows.Media;
使用 System.Drawing.Imaging;
使用 System.IO;
使用 System.Management;
使用 System.Globalization;



命名空间打印
{
public class PrintCode
{
#region属性和变量
PrintDocument pdoc = null ;
private decimal _price = 0 ;

public PrintCode()
{
}
#endregion



#region打印页面使用打印机
public void print()
{
尝试
{

PrintDialog pd = new PrintDialog();
string strDefaultPrinter = pd.PrinterSettings.PrinterName; // 获取默认打印机名称的代码
pdoc = new PrintDocument();
PrinterSettings ps = new PrinterSettings();
Font font = new 字体( Courier新 15 ); // 设置页面的默认字体
PaperSize psize = new PaperSize( 自定义 212 130 ); // set paper size sing code
pd.Document = pdoc;
pd.Document.DefaultPageSettings.PaperSize = psize;
pdoc.PrintPage + = new PrintPageEventHandler(pdoc_PrintPage);

// **************** *********设置默认打印机的代码************************************ *

string defaultPrinterName = ps.PrinterName; // 获取默认打印机的代码

if (defaultPrinterName == GC420GT
{
ps.PrinterName = GC420GT; / / 设置默认打印机名称的代码
pd.PrinterSettings.PrinterName = GC420GT; // 设置默认打印机名称的代码
}
else
{
ps.PrinterName = defaultPrinterName; // 设置默认打印的代码名称
pd.PrinterSettings.PrinterName = defaultPrinterName; // 设置默认打印机名称的代码
}


// *** *********************************结束**************** **********************************


DialogResult result = pd.ShowDialog();
if (result == DialogResult.OK)
{
pdoc.Print();

}


// *** ************************************************** **********结束*************************************** ************************** //

}
catch (Exception ex)
{


}

}

< span class =code-keyword> void pdoc_PrintPage( object sender,PrintPageEventArgs e)
{

StringFormat sf = new StringFormat();
// -------------------- - - - - - - - - -结束 - - - - - - - - - - - - - - - - --------------------- //


字体font = new 字体( Courier New 10 ); // 设置默认字体大小
float fontHeight = font.GetHeight();
int startX = 5 ; // x轴的位置
int startY = 2 ; // y轴的起始位置
< span class =code-keyword> int Offset = 0 ;
graphics.DrawString( xxxxxxxx字体( Courier New 9 ), new SolidBrush(System.Drawing.Color.Black),startX,startY + Offset);
Offset = Offset + 16 ;
graphics.DrawString(


+ 100 new 字体(< span class =code-string> Courier New 12 ,FontStyle。粗体), new SolidBrush(System.Drawing.Color.Black),startX,startY + Offset);
Offset = Offset + 20 ;
// ******************** ************************结束************************* *******************

抵消= 0 ;
}
#endregion





}
}


I am using a GC420GT Zebra label printer.
My aim was to print label Stickers for large Cartons( ie single column label on paper rolls width ) and print label Stickers for small packets(ie 2 column label on paper rolls width)
and i need to print it based on a user defined no: of labels

I have searched google and i found ZPL, ZPL II and EPL2 programming languages.

Ques 1) if i impliment my requirement in any of the above languages does it support on common label printers other than zebra? if not plz give your valuable suggestions plz...

Ques 2) is it possible to print labels using microsofts RawPrinterHelper.SendStringToPrinter() function?
I have used it for thermal printing

Ques 3) to impliment device independant printing what method should i follow ?
plz give helping links & ur valuable suggestions

解决方案

1) ZPL & EPL are common Zebra printer command languages and can be used with any Zebra printer supporting them as well as with other brands that usually ship ZPL or EPL emulation like Datamax, Intermec, etc. If you want to support a broader range of printers, then ZPL & EPL is not the way to go. In .NET, I'd use PrintDocument class for printing which will require a Windows driver for each target printer. Problem is printing performance. If you're going to support high volume printing, then using the native printer command language (like ZPL or EPL for Zebras) is the best approach and I'd not go through the Windows API printing (PrintDocument). Each approach has its pro & cons.

2) RawPrinterHelper can be used to send native printer commands only! i.e. you can send ZPL, EPL, ESC/POS i.e. any commands supported by the target printer

3) Again, I'd use .NET PrintDocument but printing performance will never be comparable to sending native printer commands.


Hello George,

you can use simple print command to printer using Zebra printer. You have to only set your tag size during printing.

Below is given code:-


using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Drawing.Printing;
using System.Drawing;
using System.Windows.Media;
using System.Drawing.Imaging;
using System.IO;
using System.Management;
using System.Globalization;



namespace Print
{
    public class PrintCode
    {
        #region Properties and Variables
        PrintDocument pdoc = null;
        private decimal _price = 0;
     
        public PrintCode()
        {
        }
        #endregion



        #region Print Page using Printer
        public void print()
        {
            try
            {
              
                PrintDialog pd = new PrintDialog();
                string strDefaultPrinter = pd.PrinterSettings.PrinterName;//Code to get default printer name  
                pdoc = new PrintDocument();
                PrinterSettings ps = new PrinterSettings();                
                Font font = new Font("Courier New", 15);//set default font for page
                PaperSize psize = new PaperSize("Custom", 212, 130);//set paper size sing code
                pd.Document = pdoc;
                pd.Document.DefaultPageSettings.PaperSize = psize;             
                pdoc.PrintPage += new PrintPageEventHandler(pdoc_PrintPage);

               //*************************Code to set Default Printer*************************************

                string defaultPrinterName = ps.PrinterName; // Code to get default printer

                if (defaultPrinterName == "GC420GT")
                {
                    ps.PrinterName = "GC420GT";//Code to set default printer name
                    pd.PrinterSettings.PrinterName = "GC420GT";//Code to set default printer name 
                }
                else
                {
                    ps.PrinterName = defaultPrinterName;//Code to set default printer name
                    pd.PrinterSettings.PrinterName = defaultPrinterName;//Code to set default printer name 
                }


                //************************************End**************************************************
               

                DialogResult result = pd.ShowDialog();
                if (result == DialogResult.OK)
                {
                 pdoc.Print();
                       
                }
                

                //***************************************************************End*****************************************************************//

            }
            catch (Exception ex)
            {

               
            }

        }

        void pdoc_PrintPage(object sender, PrintPageEventArgs e)
        {

            StringFormat sf = new StringFormat();
           //-------------------------------------End-----------------------------------------------------//

          
            Font font = new Font("Courier New", 10);// set default font size
            float fontHeight = font.GetHeight();
            int startX = 5;// Position of x-axis
            int startY = 2;//starting position of y-axis
            int Offset = 0;
            graphics.DrawString("xxxxxxxx", new Font("Courier New", 9), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset);
            Offset = Offset + 16;
            graphics.DrawString("


" + "100", new Font("Courier New", 12, FontStyle.Bold), new SolidBrush(System.Drawing.Color.Black), startX, startY + Offset); Offset = Offset + 20; //********************************************End******************************************** Offset = 0; } #endregion } }


这篇关于标签打印需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆