Spire.Barcode is a professional barcode library specially designed for .NET developers (C#, VB.NET, ASP.NET, .NET Core) and Java developers (J2SE and J2EE) to generate, read and scan 1D & 2D barcodes.

Thu Nov 09, 2017 2:26 pm

Hello

I am using Spire.Barcode in my projects (Winforms and WPF C#) and my main purpose is to create barcode and print the output in Barcode printer - (I have two: Zebra 105SL and SATO CL4NX).

How I do it:
First I tried to create an image and print it (using file path),
after I receive not a desirable result, I change my logic and put the barcode image as background, and then print the window.
These two ways gives me the same result,
and both Zebra and SATO prints with very low quality and pixelated labels.
I'm sure it is not a problem about the printer device because if I use BarTender (for example) it's fine.

My BarcodeSetting object look like that:

Code: Select all
//WPF application

BarcodeSetting barcodeSettings = new BarcodeSettings();
barcodeSettings.Data = myString;
barcodeSettings.Data2D = myString;
barcodeSettings.Type = BarCodeType.Code128; // (or Code39 - same issue);
barcodeSettings.TextFont = new Font("Arial", 10, FontStyle.Regular);
barcodeSettings.BarHeight = 15;
barcodeSettings.ShowText = true;
barcodeSettings.ShowCheckSumChar = false;
barcodeSettings.ForColor = Color.FromName("Black");
barcodeSettings.DpiX = 975;
barcodeSettings.DpiY = 273;
barcodeSettings.ShowTextOnBottom = true;
BarCodeGenerator generator = new BarcodeGenerator(BarcodeSettings);
using(Image barcode = generator.GenerateImage())
{
      using(MemoryStream stream = new MemoryStream())
       {
            //Save barcode as a stream and make it as wpf window background
           barcode.Save(stream, ImageFormat,Jpeg);
           stream.Seek(0, SeekOrigin.Begin);
           BitmapImage source = new BitmapImage();
           source.BeginInit();
           source.CacheOption = BitmapCacheOption.OnLoad;
           source.StreamSource = stream;
           source.EndInit();
           myWindow.ImageSource = source;


           PrintDialog pd = new PrintDialog();         
           pd.PrintQueue.DefaultPrintTicket.PageMediaSize = new PageMediaSize(264,37);
           pd.PrintQueue = new PrintQueue(new PrintServer(), "SATO CL4NX (305 dpi)");
           pd.PrintVisual(Window, string.empty);

       }
}



I also tried
* Not saving into stream but save to localhost and using the file path to load image as background
* Without to define DpiX and DpiY
* Winforms and WPF
* Save as file and send the path to the printer
* Zebra 105SL 300DPI and SATO CL4NX 305dpi

everything is the same: pixelated barcode label.


Any idea?

Thanks alot

Orh1989
 
Posts: 6
Joined: Thu Nov 09, 2017 1:50 pm

Fri Nov 10, 2017 2:29 am

Hello Orh1989,

Thanks for your inquiry.
Since I didn't reproduce the issue on my side. To help us with a better investigation, could you please send the following information to us via email(support@e-iceblue.com)?
1. The data string that you use to generate the barcode.
2. The result image you got before printing.
3. The Spire.Barcode version you were using.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Sun Nov 12, 2017 8:35 am

Thanks.

I sent the mail

Orh1989
 
Posts: 6
Joined: Thu Nov 09, 2017 1:50 pm

Mon Nov 13, 2017 2:34 am

Hi Orh1989,

Thanks for your details in the email.
I have tested the scenario with the latest hotfix(Spire.BarCode(Hot Fix) Version:1.4.11) and the result is correct, please upgrade your dlls to the newest one.
Attached is the result image I got.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Tue Nov 14, 2017 8:41 am

Hello Orh1989,

Greetings from E-iceblue!
How is your issue now? Your feedback will be greatly appreciated.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Thu Nov 16, 2017 11:15 am

I change my way about printing,
and use barcode control which has print method.

But now I have another issue :) irrelevant to this post .

Orh1989
 
Posts: 6
Joined: Thu Nov 09, 2017 1:50 pm

Fri Nov 17, 2017 1:47 am

Hello,

Thanks for your feedback.
We have noticed another issue you posted and reply you there.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Mon Aug 06, 2018 6:48 am

I generate barcode and print through zebra printer but the image is not scanning
my code is --------
protected void btnGenerateBarcode_Click(object sender, EventArgs e)
{
System.Drawing.Printing.PrintDocument pd = new PrintDocument();
pd.PrintPage += pd_PrintPage;
pd.PrinterSettings.PrinterName = "ZDesigner GT800 (EPL) (Copy 1)";
pd.Print();
}

void pd_PrintPage(object sender, PrintPageEventArgs e)
{
BarCodeControl bb = new BarCodeControl();
bb.Data = "12345";
System.Drawing.Image hh = bb.GenerateImage();
bb.ImageHeight = 2.5F;
bb.ImageWidth = 4.0F;
e.Graphics.DrawImage(hh, 0, 0, 200, 100);
}

ashhar@karam
 
Posts: 1
Joined: Mon Aug 06, 2018 6:40 am

Mon Aug 06, 2018 8:59 am

Hi,

Thanks for providing screenshot via email.
I noticed that the barcodes in your screenshot were damaged in some degrees. Sorry we don't have the ZDesigner GT800 (EPL) (Copy 1) printer to verify the print result at present. I used the "HP LaserJet P1007" printer to print, there was no problem. And your code related to our product is to generate the "hh" image, to help us narrow the search of the problem, please check if the image is damaged after saving "hh" to disk ( hh.Save(Server.MapPath("result.png"));) and tell us your result. If the image is correct, I guess your issue might be caused by the print process implemented by the PrintDocument class of .Net Framework. And could you please try to print with other printer like "HP LaserJet P1007"? Will your issue still happen? Please also provide your system configuration (E.g. Win7 64-bit) and region setting (E.g. China Chinese) for further investigation. Thanks in advance.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.BarCode