Skip to content

Instantly share code, notes, and snippets.

@devinprater
Last active August 26, 2023 09:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devinprater/a09bf343e44f7aeb3f34a54d60735a20 to your computer and use it in GitHub Desktop.
Save devinprater/a09bf343e44f7aeb3f34a54d60735a20 to your computer and use it in GitHub Desktop.
Embossing text and images on WSL

Embossing text and Images using Windows and WSL

Recently, I've been looking for a free way to emboss not only text, but images too. While on Linux, I was able to connect the embosser through CUPS and use that to emboss images and text. Meanwhile, on Windows, there only seems to be free programs for embossing text, like BrailleBlaster. I know that images are harder, but if I could do it on Linux, surely I could do it through WSL2.

Caveats

  • This only works for networked embossers, sorry. No USB support for WSL.
  • I've only tried this on an Index D V5 embosser.
  • It'll take a good 15 to 30 minutes to set up.

Initial Setup

I'm using an HP laptop with an AMD 5500 processor, running Windows 11 and WSL2. If you use Windows 10, as long as you have WSL2, you should be fine.


First, let's install WSL2. Follow this guide. Install a distribution of Linux. I went with plain Ubuntu.

wsl install -d ubuntu

Now, let's start the Ubuntu system.

wsl

You may be asked to enter a Unix username, and password. Use whatever you like; it doesn't have to be tied to your Windows info. Once you see something like this:

devin@Devin-hp:~$

You're good. Your username and computer name will be different, of course. Now, let's update the system.

sudo apt update

It'll probably have some updates. If so, do

sudo apt upgrade

Press y when given a prompt to update. Once you're back at the command line, we'll get going!

devin@Devin-hp:~$ 

Now, to use CUPS, the Common Unix Printing Service, we need SystemD to manage the CUPS service for us. Unfortunately, since Linux isn't running low enough to the system hardware to manage it, SystemD doesn't really work without some help.

DistroD and SystemD

So, we'll need something to make SystemD work. Distrod is a program which we can use to make SystemD work. I tried installing a distro into it, which didn't work, but installing it into the current Ubuntu we have running did work. To do that, we do:

curl -L -O "https://raw.githubusercontent.com/nullpo-head/wsl-distrod/main/install.sh"
chmod +x install.sh
sudo ./install.sh install

Now, to run it, we do:

/opt/distrod/bin/distrod enable

You can see what else you can do by reading the linked page above for the project. Now, we have to restart our Ubuntu session. First, we exit the Ubuntu shell by typing exit and pressing Enter. Then, in the Windows shell, we do:

wsl --terminate ubuntu

and then restart it:

wsl

Now, we have systemD. So we can install CUPS and get going! In Ubuntu, we do:

sudo apt install cups imagemagick

We're installing ImageMagick now, because it's needed to turn images into braille later. When asked, press y then Enter to allow the installation of the two packages.

Once that's done, we need to set up CUPS and the embosser.

Setting up CUPS

First, we need to start the CUPS systemD service:

sudo systemctl start cups

If you want, you can also enable the CUPS service to start every time Ubuntu does, so you can save some time:

sudo systemctl enable cups

Now, we go to the web browser. This is where we will be managing CUPS and the embosser. In the address bar, Enter

localhost:631

This points our browser to the CUPS server running out of WSL! So now, on the resulting page, we go to "Administration," then "Add Printer".

Setting Up the Embosser

This is where you'll need a bit of knowledge of your embosser. You can try what I did, but you may need to use a different communication method or port number. Look at how you connected through Windows to get an idea of how to do it through Linux.

First, choose the connection method. For the Index D V5, I choose "AppSocket/HP JetDirect." Press the Continue button to move on to the next step.

Now, you enter the URI, connection method, IP address, and port number. For the embosser I used, I entered:

socket://192.168.0.203:9100

Remember to check what IP Address your embosser is on. It will be different.

Now we get to some easier things:

  • Name: Name your embosser. If you've ever wanted an embosser named Bob, Wei Shi Lindon, or Adonalsium, now's your chance. I just called mine Index because I'm boring.
  • Description: Put whatever you want here, or leave it blank.
  • Location: If you have your embosser in the bathroom for some reason, you can put that info here, in order to differentiate it from all the other embossers you have, in the bathroom.
  • Share: You can share the printer with others using your WSL container... I guess.
  • Now, continue adding the printer. You choose the maker of the embosser, or if they aren't on the list, choose the generic embosser. Then, choose your model from the next list. Proceed until you get to the printer options page.

Printer options

Now, we're reading to set up how the embosser is going to get data. When we emboss text, we can have it in grade 1 Braille, or Grade 2. We can have page numbers on the top or bottom. That kind of thing.

  • Media Size: Set to A4, I choose to leave it that way.
  • Double Sided: I choose "off." I hate double-sided braille.
  • Braille Transcription: I choose "Unified English contracted braille (en-ueb-g2.ctb)". All languages from LibLouis is there.
  • Leave the rest alone. If your embosser has a specific text dot distance, set that in the appropriate field. If your language is an 8-dot system, set the text dots to 8 dots.
  • Braille page number: I have it set aat its default of bottom margin on the right.
  • Print page number: I have it set to the top margin.
  • Print page separator: This is when a print page starts, but can fit on the current braille page.
  • Set the rest of the text settings to your liking. You don't have to hit the set default options on all panels.
  • Graphic dot distance: Mine is set to 2.0 MM, giving as good a feeling as textbooks when I was in school.
  • Rotation: Rotate clockwise to fit paper. Since I wouldn't know if the image is rotated or not, I think I'm going to turn this off.
  • Resize: These radio buttons can be tricky, but if the first one is checked, that's yes. If the second one is checked, that's no. Set these as you like.
  • Mirror: I'm not sure what this one does. It's set to no.
  • Edge detection: Canny. This makes it easier to feel edges and such.
  • Negate: No. This is probably video negation, making darker colors brighter to feel them better.
  • EdgeFactor:: I'm not sure what this does.

Let's move on to:

  • Multiple Impact: 1. Some embossers may need this set to a higher value.
  • Installed Firmware: Choose which version of the firmware you have.
  • Z-folding: This is probably specific to the Index embosser.
  • Sideways folding: I didn't know braille paper could do that.
  • Starting and ending banner: You can choose one of the options to add a banner to your papers.

Now, press "set default options" and let's try it!

Embossing

Now, find a document or image to emboss. It can be either on your WSL filesystem or the Windows filesystem. Navigate there using the Ubuntu terminal, and then type something like:

lp image.png

Or:

lp The-Way-Of-Kings.html

The, press Enter. If all goes well, your picture, or huge book, will be embossed. If not, read any error messages, check your embosser, and try different connection methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment