As someone who did something similar back in the day - it is actually pretty easy since you literally have to connect the printer (hardest part, as you will need adaptor cables) and then write to a dev output, which is just a file (assuming you want to run this on Linux).
If you're in DOS (not NT/XP+, not sure about 9x), you can use the debug command to write to the serial and parallel ports. You can also use `ECHO > COM1` for serial, or for the parallel port `ECHO > LPT1`