/cli-phomemo-printer

a script that prints images to the phomemo m02s

Primary LanguageJavaScript

cli-phomemo-printer

a nodejs script that allows you to print images to a phomemo printer.

Tested with phomemo M02s.

printer-smol.mov

How to install & run

Permissions

For MacOS: You must enable Bluetooth permissions for the terminal on which this runs

This is done by going to System Settings -> Privacy & Security -> Bluetooth, and then adding the terminal program (e.g. iTerm) to allow Bluetooth connections.

Clone & run

This isn't listed on npm (yet?) so you need to clone and build locally to run, e.g.

$ git clone git@github.com:vrk/cli-phomemo-printer.git
$ npm install
$ node index.js

If you run it without command-line arguments, you'll print out a burger sticker.

cli args

Options:
  -f, --file <path>   path for image to print (default: "./burger.png")
  -s, --scale <size>  percent scale at which the image should print (1-100+) (default: 100)
  -h, --help          display help for command

IMPORTANT USAGE NOTES

  1. If you're not using the Phomemo M02S: You will need to edit index.js to change BYTES_PER_LINE to match your paper. IDK what's the math for this, I just used guess & check to figure it out lol.
  2. If you're using smaller receipt paper: The Phomemo M02S comes with 3 sizes of paper, 53mm (default), 25mm, 15mm. If you're using anything other than 53mm, you're going to have to scale the image using the -s flag, e.g. -s 50 for 25mm paper.
  3. Known issue: I've found that the dithering library I'm using doesn't work well on certain black & white images. I'll swap it out later...

Credits

This code was cobbled together by reading the very helpful breadcrumbs left by: