Printing Japanese in Linux (as well as FreeBSD and NetBSD) has become relatively simple. Many applications such as OpenOffice and Firefox, will automatically send things to a printer as Postscript Level 2 or higher, which correctly prints Japanese text.
Much of this information was taken from an excellent pageon using multilingual text in Linux by JWS.
This will also enable you to print text files, such as one that you might create with vi. Open the file in firefox, hit print and it will print correctly.
You can also open the file in OpenOffice (and probably AbiWord, though I haven't checked that) to print it.
Another trick is to use OpenOffice to print it without actually opening OpenOffice writer.
Find out what command your distribution uses to start OpenOffice. (In GUI based distributions like Ubuntu, this can sometimes be a challenge--usually, you can right click on a command and left click on properties.) In FreeBSD for example, the command is
openoffice.org-
.
For example, at time of writing, to use OpenOffice I would type
openoffice.org-SRC680_m214
(In reality, I type openoff and hit the tab key and leave it my shell's tab completion feature.)
For purposes of this discussion, say that your distribution uses the command ooffice to start OpenOffice. If you have a text file in Japanese called nihongo.txt you can print it this way
ooffice -p nihongo.txt
Another way to do it is to use the very good paps program. Many distributions (e.g., Ubuntu, Fedora) have a package for it. In others, such as ArchLinux or the BSD's, you will have to install it yourself.
To install it, download the source code and save it somewhere. It requires that you have doxygen, pkgconfig and pango installed. (All of these are available as packages in ArchLinux, FreeBSD and NetBSD, the only three systems where I've done this. In FreeBSD at least, pkgconfig was called pkg-config.)
In Linux, it's simply a matter of downloading the source, untarring it and installing it in typical fashion. (The source code tarbarll is available at the link given above).
tar zxvf paps
.tar.gz
cd paps
./cofigure && make && make install
In the BSD's, if you just do this, it will compile and install, but will give an error message about installing the documentation. This documentation is more for programmers than end users--the man page and --help option are more than sufficient for the non-programmer. If you need the documentation or simply hate error messages, after untarring paps, cd into the
paps
Once it is installed, you would use it like this. Taking that same nihongo.txt file (assuming that you have used UTF-8 encoding)
paps nihongo.txt | lp
The paps program only works on UTF-8 encoded files. If you have used EUC or something else, you would first have to use iconv to convert it to UTF-8 encoding. The iconv program is often installed by default, but if not, it should be available as a package.
To use it, first do iconv -l (a lower case letter L, as in list) to see how your distribution's version names things. For instance, in FreeBSD, doing iconv -l |grep -i euc shows me that I can use either EUC-JP or EUCJP.
So, if I have a file encoded in EUC called nihongoeuc.txt I would do it this way
iconv -f EUCJP -t UTF8|nihongoeuc.txt|paps|lp
The -f and -t are for from and to.
I have found that sylpheed (at least the last time I used it) wouldn't automatically translate things to Postscript Level 2 so I use paps with it.
In the sylpheed Configuration menu there is a section for Details, External Commands. The default is lpr %s. I changed this to
paps %s|lp
I usually use mutt as my email client. The mutt program lets you pipe things to a command by hitting the | key. So, if I wanted to print a Japanese email I received, in mutt I would type
|paps|lp
I use HP printers both at work and home. The generic laserjet and deskjet drivers didn't work properly with paps, I had to install the hpijs program (available in most distributions) to get more sophisticated ppds. If it's not available in your distribution, you can get the source code from the HPLIP page. (The HPLIP package includes hpijs.)
Printing