lukevp / ESC-POS-.NET

Efficient, Easy to Use Thermal Printing & POS (Windows/Linux/OSX, WiFi/BT/USB/Ethernet)
MIT License
523 stars 171 forks source link

Printing to LPT1? #225

Open dpskipper opened 1 year ago

dpskipper commented 1 year ago

Any ideas how to print to a parallel printer on port LPT1?

Have tried using serial printer, but its not finding any ports called LPT1, probably because you can't use serial ports to print parallel.

lukevp commented 1 year ago

I don't currently have a way to test this as I don't have any computers with LPT ports. It doesn't work the same as a serial port though from my limited research. If you're on Windows, there are examples about how to use native Windows dlls to open a pseudo file handle to the LPT1 port by name and write files to it.

You could write a Parallel implementation based on FilePrinter but using the native windows comm to connect to LPT1. I'd be interested in a PR for it, but only if we were able to dynamically wrap it, so that even if the implementation only worked on Windows, the library could continue to target .net standard and not target full .net framework. This project needs to remain cross-platform first and foremost. I'm curious if LPT would work from Linux or Mac using FilePrinter like serial does.

igorocampos commented 1 year ago

Hey @lukevp and @dpskipper I have successfully printed to LTP1 before, but it was with my old library. It lacks a LOT of features that ESC-POS-.NET has, but it uses temp files to handle sending the bytes to a port, that way I didn't have to worry about opening and closing ports and addresses, the OS did it for me. Beware it was never tested on MacOS, but I'm pretty sure it worked on linux if I remember correctly.