3

I've been working on a label system in VB web app that prints to the Toshiba TEC Barcode printers for quite a while lately and it never seems to line up properly. I've tried changing the settings, and adjusting paper size, only re-calibrating the printer seems to help for a bit and then the alignment goes off again.

What I've been thinking of trying to do to overcome this issue is place a Button on the page that would allow the user to re-set/re-calibrate the printer. Figure this is better than them pulling on the label to line it back up again.

Here is the code used to print the label:

Public Sub SetPrintSettings(ByVal pd As PrintDocument, ByVal printer As String, ByVal printerselected As Integer)    

    Dim pSize As PaperSize    
    'set the printer
    pd.PrinterSettings.PrinterName = printer
    pd.DefaultPageSettings.Landscape = False

    pSize = New PaperSize("USER", 400, 202)
    pd.DefaultPageSettings.PaperSize = pSize
    pd.DefaultPageSettings.Margins = New Margins(0, 0, 0, 0)
End Sub

I've gone through the PrinterSettings and DefaultPageSettings and there is nothing in there that will allow me to reset the printer.

Anyone have any ideas?

Robert
  • 159
  • 2
  • 12
  • You will need to figure out the escape codes that reset that printer and send them when you want to do a reset – Mark Hall Nov 06 '12 at 17:06
  • Well, set PrintDocument.OriginAtMargins = True and tinker with the margins. – Hans Passant Nov 06 '12 at 19:39
  • @Hans, I've tried adjusting the margins accordingly and it still causes issues. The only setting that I can change that makes a real difference is the paper size, but again it continues to shift the more you print. – Robert Nov 07 '12 at 15:21
  • @Mark, thanks for the input using the escape codes, I think that's what I'm going to have to do. – Robert Nov 07 '12 at 15:25
  • @Robert I'm also suffering from the same problem, Each label is printing with different margins. Printout is totally differs from the print preview. What did you actually follow to solve this problem.? Please suggest any solutions. – Rajaprabhu Aravindasamy Jun 25 '13 at 13:51

1 Answers1

0

This is a comment really but I have put it as an answer so it formats better:

My guesses on what is causing this problem.

  • Too small a gap between labels. These printers can be very fussy about detecting the gap
  • Broken gap sensor on the printer
  • Incorrect commands being sent to the printer e.g. specifying a label size bigger than it actually is.
Matt Wilko
  • 26,994
  • 10
  • 93
  • 143