简体   繁体   English

asp.net c#条形码问题

[英]asp.net c# Barcode issue

在此处输入图片说明 For generating Barcode in asp.net c#, Bitmap object is used that saved the image in jpeg (also checked changing image extension gif and dpi). 为了在asp.net c#中生成条形码,使用位图对象将图像保存为jpeg(还选中了更改图像扩展名gif和dpi)。 But the problem is when we print the barcode, barcode quality is not good(it shows the fade print). 但是问题是当我们打印条形码时,条形码质量不好(显示褪色打印)。 Although printer "Zebra GK420" quality is good. 尽管打印机“ Zebra GK420”的质量还是不错的。 I did some R&D on the google and used some demo dlls for barcode but barcode quality problem persists. 我在Google上进行了一些研发,并使用了一些演示dll来处理条形码,但条形码质量问题仍然存在。 Here is the code snippet and print output document; 这是代码片段和打印输出文档;

   Bitmap objBmpImage = new Bitmap(192, 96);
   Font CR10BP = new Font("Courier New", 10, FontStyle.Bold, GraphicsUnit.Pixel);
   Font TR10NP = new Font("Times New Roman", 10, FontStyle.Regular, GraphicsUnit.Pixel);
   Font ID12NP = new Font("IDAutomationHC39M", 12, FontStyle.Regular, GraphicsUnit.Point);

   Graphics objGraphics = Graphics.FromImage(objBmpImage);

   objGraphics.Clear(Color.White);

   objGraphics.DrawString(line1, TR10NP, new SolidBrush(Color.Black), 10, 2);
   objGraphics.DrawString(line2, TR10NP, new SolidBrush(Color.Black), 10, 12);
   objGraphics.DrawString(line3, TR10NP, new SolidBrush(Color.Black), 10, 22);

   objGraphics.TextRenderingHint = TextRenderingHint.SingleBitPerPixel;

   objGraphics.DrawString(line4, ID12NP, new SolidBrush(Color.Black), 10, 36);

   objGraphics.Flush();

   return objBmpImage;

When trying to print barcodes from Zebra printers, you are better off using ZPL to tell it the information about the barcode and having it rendered on the printer. 尝试从Zebra打印机打印条形码时,最好使用ZPL告诉它有关条形码的信息,并将其呈现在打印机上。 This is the ZPL guide (only opens in IE for me) for a 420d printer. 这是420d打印机的ZPL指南 (仅在IE中为我打开)。 Read the guide about the text you send to the printer to get it working. 阅读有关发送到打印机以使其正常工作的文本的指南。 You can send a text file from the command line to test the printer using standard print commands, so you don't have to continuously recompile as you are learning the language. 您可以从命令行发送文本文件以使用标准打印命令来测试打印机,因此在学习该语言时不必不断地重新编译。

Since it looks like you are using a 3of9 font, you will probably use ^B3, which is the 3 of 9 command for ZPL. 因为看起来您使用的是3of9字体,所以您可能会使用^ B3,这是ZPL的9之3的命令。 Something as simple as this command (an example from the PDF), will render a barcode: 像此命令一样简单的操作(来自PDF的示例)将呈现条形码:

^XA
^FO100,100^BY3
^B3N,N,100,Y,N
^FD123ABC^FS
^XZ

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM