I need a VB.Net code to print directly to the port of a bead printer without using any Windows driver .
I add that my printer is connected by USB but in the future I needed it to print on any type of port: COM, Parallel, USB ...
I need a VB.Net code to print directly to the port of a bead printer without using any Windows driver .
I add that my printer is connected by USB but in the future I needed it to print on any type of port: COM, Parallel, USB ...
I can not say exactly to your printer because I do not know it, but essentially you have to write directly to the port, usually PRN
or LPT1
or COM1
.
By sending directly to the port you avoid going through the Windows print manager.
Simplified example (does not have the quality that a production code should have):
Dim impressora = new System.IO.StreamWriter(@"\.\COM1");
impressora.Write("Teste");
impressora.Flush();
impressora.Close();
If the USB printer may be available configured as a COM1
for example, this will work as well.
If I have to write to the same USB, I would not know exactly what to do. Some tips:
Use the LibUSBdotNet library that is a binding for LibUSB .