top of page
検索
yukuko

How To Create Receipt Poetry(For Mac)

1、Get a thermal printer with a USB connection. (Note: Some models may not connect properly, so choose a model that supports USB for the best results.)


I got these, and they work well↓↓

SM-5805


MP-B20



2、Open Terminal and install Python 3. Type the following command and press Enter:

brew install python3


3、Install PyUSB. Type the following command and press Enter:

pip3 install python-escpos



4、Install the library for USB. Type the following command and press Enter:

pip3 install pyusb 



5、Type the following command and press Enter: brew install libusb



6、Connect the printer and type the following command to start:

python3


Then, type the following commands one by one:

from escpos.printer import Usb

p = Usb(0x0416, 0x5011)

p.text("abcdef/n")

p.cut()



DONE!!!!!




7、If you want to print picture data, create PNG data with a resolution of 72 DPI.

Here’s the one I created↓↓



















Then, generate the print data using the following Python script:


from escpos.printer import Usb

p = Usb(0x0416, 0x5011)

p.image("yourdataname.png", fragment_height=7000)

p.cut()


8.Create a folder similar to this one, including both PNG and Python files.



9. Finally, type the following command and drop the folder into the Terminal:

cd



10.Type the following command and press Enter:

sudo python3 ./print.py





GREAT!! Way to go!!!

閲覧数:13回

Comments


bottom of page