Windows Develop Bookmark and Share   
 index > Windows Forms General > Zebra barcode printing problem
 

Zebra barcode printing problem

Hello!
I print barcodes from .Net application to Zebla TLP 2844 printer.
It works fine except one very important issue.

Print preview and output are different. Preview lokks fine. everything goes good. but output is not correct.

My label printed is placed wrong. it is shifted down. And after this i see, that next label on the ribbon is not placed correctly, but is just a little forward. And this is that little, my label is misplaced.

When i print something from Microsoft Word to zebra, no problems occure. it rewinds come lables, but it prints at the correct place and next label is not moved forward.

Does anybody can advice me anything solving this problem???

private PrintCanvas(){
PrintPreviewDialog preview = new PrintPreviewDialog();
PrintDocument pdNew = new PrintDocument();

pdNew.PrinterSettings.PrinterName =BarcodePrinter;
pdNew.PrintPage += this.pd_PrintPage;

//pdNew.DefaultPageSettings.Margins.Top = 0;
//pdNew.DefaultPageSettings.Margins.Bottom = 0;
//pdNew.DefaultPageSettings.Margins.Left = 0;
//pdNew.DefaultPageSettings.Margins.Right = 0;
//pdNew.OriginAtMargins = true;

preview.Document = pdNew;
preview.ShowDialog();
}

private void pd_PrintPage(System.Object sender, PrintPageEventArgs ev)
{
ev.Graphics.DrawString("aaa", new Font("Arial", 7, FontStyle.Bold), Brushes.Black, 0, 0);
ev.Graphics.DrawRectangle(Pens.Black, 10 , 10, 10, 10);
ev.HasMorePages = false;
}
ftpuser  Friday, March 20, 2009 9:13 AM

It's my understanding that these printers can be difficult when working with windows, they have their own built in language they are designed to work with. You can find the manual athttp://www.exalt.pl/drukarki/podreczniki_programisty/epl2en.pdf

I frequently print barcode labels withsimilar printers inmy .net applications, I simply create a string with the appropriate codes and then send the string directly to the printer, it works great and it's fast. Sending the string directly to the printer is the tricky part, if you are interested I can post the code for that part.

Kliot  Friday, March 20, 2009 9:34 PM
If you uncomment the OriginAtMargins line, the print should be correct. The preview will now be off by the same amount that the print was but in the opposite directions. Since nothing is cut in preview this is normally not objectionable. If it is, detect PrintToPreview in the BeginPrint event andadjust the margins for the hardmargins. Reset the margins in the EndPrint event.
JohnWein  Friday, March 20, 2009 9:27 AM
No it doesn't help... I tried more than one time. And what is interesting, preview appears in right way, it is not shifted down, only left...

Printing with this gives one interesting moment.
first i print smth from Word - for zebra to be calibrated. than i print from application. it prints (and in right place, as i understan), but it doesn't rewind the ribbon to give me a label, it rewinds just a little. that little, all my next labels will be shifted!!!

text printed stays in the printer. Next label printed will be rewinded, but that shift alreay appears.
ftpuser  Friday, March 20, 2009 9:53 AM
What arethe hard margins?
JohnWein  Friday, March 20, 2009 9:55 AM
pdNew.DefaultPageSettings.HardMarginX == 5.0
pdNew.DefaultPageSettings.HardMarginY == 0
ftpuser  Friday, March 20, 2009 9:59 AM
in printdocument.Print Eventhandler:

ev.PageSettings.Margins {[Margins Left=0 Right=0 Top=0 Bottom=0]}

ftpuser  Friday, March 20, 2009 10:03 AM
OriginAtMargins should give correct print in the X direction, you'll have to contact Zebra for your other problems.
JohnWein  Friday, March 20, 2009 10:07 AM
But how does Word do this???
Does anybody has other suggestions?
ftpuser  Friday, March 20, 2009 10:11 AM
the problem is not clear at all, but i've solved half of it.

Tags i had were of two parameters. Paper Size and Label Size. I used Paper size, when Label Size was correct to use. Paper size is larger than Label size. As i understand, Paper Size = Label Size + Gap...

Open question now is following: Every label printed zebra calibrates itself right way. But ouput is misplaced anyway. I tired

pdNew.DefaultPageSettings.Margins.Top = 0;
pdNew.DefaultPageSettings.Margins.Bottom = 0;
pdNew.DefaultPageSettings.Margins.Left = 0;
pdNew.DefaultPageSettings.Margins.Right = 0;
pdNew.OriginAtMargins = true;

And it didn't help me... Even with this code my label is misplaced more than without. Without it i have only down shifitng, and with it i have it left shifted too.
ftpuser  Friday, March 20, 2009 12:09 PM

It's my understanding that these printers can be difficult when working with windows, they have their own built in language they are designed to work with. You can find the manual athttp://www.exalt.pl/drukarki/podreczniki_programisty/epl2en.pdf

I frequently print barcode labels withsimilar printers inmy .net applications, I simply create a string with the appropriate codes and then send the string directly to the printer, it works great and it's fast. Sending the string directly to the printer is the tricky part, if you are interested I can post the code for that part.

Kliot  Friday, March 20, 2009 9:34 PM

You can use google to search for other answers

Custom Search

More Threads

• How does MID Parent form know child window created?
• Getting SelectedNode's Key
• Change color of directory
• Copy TreeView items checked states from treeview to another ??
• app control using only keyboard
• Folder and Icon information
• Can't find Select Event in ToolStripMenuItem
• Printing the_whole_contents of a form.
• how to disable a particular link in datagridviewlinkcolumn?
• Locking Mechanism Across Multiple Processes