Printing to a label printer

qex

Well-known member
Joined
Apr 2, 2003
Messages
78
I am trying to print a barcode to a label printer in older versions raw data was sent to the printer to accomplish this.

I found this vb6 code that I believe prints a barcode by sending commands to the printer. How is this accomplished in .net I can print to the printer but everything is viewed as text to be printed. Is there a way to switch to program mode or something of that nature.

Here is the vb6 code

Debug.Print strvar4 barcode
Printer.Print Spc(2); vbCrLf & "N" & vbCrLf & "Q507,20+0" & vbCrLf & "R0,0" & vbCrLf & "S2" & vbCrLf & "D5" & vbCrLf & "ZT" & vbCrLf & "TTH:m:s:,+" & vbCrLf & "TDy2.mn.dd" & vbCrLf & "B207,10,0,3,2,4,101,B, RC-97-0001" & vbCrLf & "P1" & vbCrLf strvar4;
 
I may need to add a new printer to your PC running with the "Generic / Text Only" printer driver. You should then be able to send plain text directly to it. There may be a way to do this with any printer driver but I have never used printers in .NET so Im not sure.
 
I found what I was looking for the only way to do it is to open the com port directly and write raw data to the label printer. I was hoping there was a cleaner solution in .net. It really seems funny that they didnt provide any way to easily write printer commands out to peripherals within the framework
 
Back
Top