Dot matrix printing: Difference between revisions
Line 39: | Line 39: | ||
You send a character as ASCII, and depending on which font is loaded, it is printed. | You send a character as ASCII, and depending on which font is loaded, it is printed. | ||
Some ASCII characters are not printable, like the bell. To send it, you need to send it as ASCII but translate it from another encoding system on your computer, for example hex. | Some ASCII characters are not printable, like the bell or the esc key. To send it, you need to send it as ASCII but translate it from another encoding system on your computer, for example with Python, and send it to the print in hex. | ||
The user manual lists all the possible special commands that can be | |||
To switch to italic for instance, you need to send <code>esc</code> and <code>4</code>. | |||
To get the esc key in hex in Python: <code>chr(27)</code> which returns <code>'/x1b'</code>, etc. | |||
==Examples== | ==Examples== |
Revision as of 13:22, 5 February 2025
OKI Microline 320
- owner: XPUB
- status: does not work (possibly hardware issue)
- connect to the printer: USB-A → centronics cable (you can find this one either in the office or XML, it's black)
- user manual: File:45690101EE1 ML320 UG EN 128084.pdf
- driver: https://www.oki.com/us/printing/support/drivers-and-utilities/dot-matrix-printers/62411601/
Test report 5 Feb 2025:
Joseph and Manetta tried to get this printer to work, we changed the settings to match the NEC printer, but this did not help. Current intuition is that it is a hardware issue.
NEC PINWRITER P60
- borrowed from: Varia? Silvio?
- status: works
- connect to the printer: USB-A → centronics cable (you can find this one either in the office or XML, it's black)
- user manual:
- maintenance guide: File:P60_SM_NEC_EN_text.pdf
This printer has 21 pins. One is broken, you can see it.
In the back there are magnets, one for each pin, and when the electricity hits the magnet, the pin is being activated or not.
There are 2 rows of pins, one is slightly shifted (you can see it!), which makes the resolution higher. It is divided into 2 rows, because there is no mechanical space to have so many pins so narrowly next to each other in one row.
There is a way to speak to these pins individually.
A driver translates the pixelized image into the pins of the printer. Here you can find dithering strategies to convert an image into a type of image that could be printed on the dot-matrix printer. So dithering was a technical limitation. These days, it's often an aesthetic choice, which is different.
The printer works with 80 columns.
Before was the daisy wheel printer (close to typewriter), but with the dot-matrix printers you can make your own characters. Which helped to promote it and sell it internationally. Other character cards were also distributed, with fonts etc, which you could load into your printer.
There was not one fixed character set for all dot-matrix printers.
You send a character as ASCII, and depending on which font is loaded, it is printed.
Some ASCII characters are not printable, like the bell or the esc key. To send it, you need to send it as ASCII but translate it from another encoding system on your computer, for example with Python, and send it to the print in hex.
The user manual lists all the possible special commands that can be
To switch to italic for instance, you need to send esc
and 4
.
To get the esc key in hex in Python: chr(27)
which returns '/x1b'
, etc.
Examples
Pruning Station with Irmak - The magic of scanner, OCR and dotmatrix printer (SI19)
Python script to scan a page from a book, apply OCR (optical character recognition) and print it on the dot matrix printer.
import os
print("starting the pruning process")
scanning = "sudo scanimage --resolution 300 --mode color -o image.png"
os.system(scanning)
os.system("tesseract image.png text.txt -l eng")
fantasyname = open("text.txt.txt" , "r")
fantasyname = fantasyname.readlines()
for line in fantasyname:
line = line.split(" ")
for l in line:
if l!="" or l != ['\n', '\r\n']:
print(l)
os.system("echo '"+l+"' > /dev/usb/lp0")