We are talking about a line printer. This type of printer accepts raw text and prints it. They typically support 255 characters and must be configured to on of a few supported character sets, such as ASCII or CP437.
These printers accept "raw" input - meaning characters, spaces, line breaks, etc. They sometimes support images also.
Basically you'll need to
- Add a raw printer through CUPS (common unix printing interface)
- Send raw text, PDF, or PS to the printer
1) Turn on CUPS web administration
- Open a Terminal
- Enter the command
$ sudo cupsctl WebInterface=yes
That will enable a feature that lets you add and remove printers from the CUPS localhost web administration site.
2) Find printer address
If it's a local printer:
- Run the command
$ lpinfo -v | grep usb
You'll get a response that looks like:
usb:///<printer name>?location=<locationID> is your printer address on the USB hub. Copy that text.
If it's a network printer
You'll want the IP address and port of that printer. The full address will be:
3) Add printer
Go to your CUPS Administration Page (http://localhost:631)
Click Add printer
Click AppSocket/HP JetDirect (Don't click your existing printer if it shows up), click Continue
Paste your printer address from Step 2 in the Connection input, click Continue
Give the printer a name and description, click Continue
Select Raw in the Make selection and click Continue. If you are super lucky you might see your manufacturer here. Good luck.
Select Raw Queue (en) in the Model selection and click Add Printer
Select printer options. For Raw Queue (en), you'll see a Starting Banner and Ending Banner. You'll probably want to select None for both of those.
4) Connect new printer to MacOS System Preferences
- Click Administration
- Click Add class
- Fill out the form. The Name field will be the human-readable name you want to appear in the Printers and Scanners section of System Preferences.
- Select the printer you just added from Members and click Add class
- Your printer should now appear in your Printers and Scanners
- (optional) - turn off CUPS web administration by issuing the command
$ sudo sudo cupsctl WebInterface=no in your Terminal
5) Find your printer
- In your Terminal, issue the command
$ lpstat -p. This will list your printers
printer HP_LaserJet_200_color_M251nw__0200B9_ is idle. enabled since Tue Jan 15 00:24:06 2019
printer PDF_Printer is idle. enabled since Sat Jan 11 14:00:23 2020
printer rongta is idle. enabled since Sun Jan 10 14:37:44 2021
printer Rongta_80mm_Thermal_Printer is idle. enabled since Sun Jan 10 14:42:19 2021
In my case I have a
Ok so here your mileage may vary.
- From your Terminal, issue the command
$ lp -d <printer_name> file.txt to print
file.txt to printer
<printer_name>, and you'll get a print job ID in response.
In my case, I issued:
$ echo "hello" > file.txt
$ lp -d Rongta_80mm_Thermal_Printer file.txt
request id is rongta-61 (1 file(s))
Apparently you can print PDF and PostScript files this way as well, since MacOS's printing system is supposed to manage the translation between the system and the printer.