Printing Solutions


Table of Contents

tool:bg5ps 
Info 
Usage 
Description 
Comments 
Help 
Under Debian 
Under RedHat 
Version 1.3.0 (1.1b2) 
Print man pages 
Test History 
pkg:chpfb 
Info 
newest version of chpfb 
Description 
Features 
Examples 
Help 
Version 1.3 
Chinese printing 
Chinese printing 
CNPRINT 
Description 
Related Urls 
Versions 3.20/3.21 * 

tool:bg5ps 

Info 

High quality true type font ps printing tool.

Usage 

bg5ps -if file.sample.cc.big5 -of $tf.ps
bg5ps -en gb2312 -if file.sample.cc.gb2312 -of $tf.ps
mpage file.sample.cc.gb2312 | bg5ps -en gb2312 -nps y > $tf.ps
mpage file.sample.cc.big5 | bg5ps -nps y > $tf.ps
gv $tf.ps &
gv -swap $tf.ps &

Description 

Bg5ps uses the ttf2ps program to convert the Big5 Coding chinese text into a printable postscript file. Since it uses true type font, the quality is much better than using bitmap fonts.

Comments 

There is a footnote, "printed by bg5ps" or something, which can be annoying. This can be circumvented by using mpage. NB using pipe like the following won't help:

cat file.sample.cc.gb2312 | bg5ps > $tf.ps

Help 

Quick Help 

$ bg5ps -h
bg5ps version:1.1b2
Copyright (C) 1998  Chen-Shan Chin

bg5ps -fp fontpath -fn fontname
      -o [1|0] -e [1|0]
      -s size -ls linespacing -cs charspacing
      -tm topMargin -bm bottomMargin -lm leftMargin -rm rightMargin
      -if inputfile -of outputfile
      -cf configFile
      -en encoding
      -nps y/n

Size, linespacing, charspacing, and margins are
numbers in unit of pt(1 pt=1/72 in).

encoding can be big5 or gb2312.

bg5ps -h: print this help
bg5ps -nps y: toggle netscape or mpage mode

Run as a filter:
cat big5text | bg5ps options > outputfile

Examples:

bg5ps -en big5 -fn ntu_kai -o 1 -e 0 -s 15 -ls 10 -cs 2 -tm 72 -bm 72 -if test -of test.ps

cat netscape.ps | bg5ps -en big5 -nps y -fn ntu_kai > test.ps

mpage -2 big5.txt | bg5ps -en big5 -nps y > test.ps

Detail Help 

Available at /usr/share/doc/bg5ps-1.3.0/html/bg5ps.html

Under Debian 

zcat /usr/share/doc/bg5ps/examples/netscape.ps.gz | bg5ps -en big5 -nps y > $tf.ps

1<<, >>

bg5ps -en gb2312 -if file.sample.cc.gb2312 -of $tf.ps

Note, RedHat has prepared etc/bg5ps.conf.zh_CN* files. So:

/etc/bg5ps.conf.zh_CN found. Use configuration file /etc/bg5ps.conf.zh_CN

While debian not, so have to specify '-en gb2312', otherwise:

$ LANG=zh_CN.gb2312 bg5ps -if file.sample.cc.gb2312 -of $tf.ps
No configuration file option is given.
 Trying ~/.bg5ps.conf
~/.bg5ps.conf not found.
 Trying /etc/bg5ps.conf.
 /etc/bg5ps.conf found. Use configuration file /etc/bg5ps.conf
running /usr/bin/ttf2psm -b /usr/share/fonts/truetype/arphic/bsmi00lp.ttf < /tmp/tmpK4p2yT

2<<, >>

sed 's/\(Encoding=\).*$/\1"gb2312"/' < /etc/bg5ps.conf > /etc/bg5ps.conf.zh_CN
diff /etc/bg5ps.conf /etc/bg5ps.conf.zh_CN
cd /etc
lns bg5ps.conf bg5ps.conf.zh_TW
lns bg5ps.conf bg5ps.conf.zh_TW.Big5
lns bg5ps.conf.zh_CN bg5ps.conf.zh_CN.GB2312

then,

LANG=zh_CN bg5ps -if file.sample.cc.gb2312 -of $tf.ps

Nope, it doesn't work.

 Trying /etc/bg5ps.conf.
 /etc/bg5ps.conf found. Use configuration file /etc/bg5ps.conf
running /usr/bin/ttf2psm -b /usr/share/fonts/truetype/arphic/bsmi00lp.ttf < /tmp/tmpTqLvKk

So, guys at RedHat has really did some nice works on bg5ps.

rm bg5ps.conf.zh_*

Under RedHat 

Usage 

bg5ps -if file.sample.cc.big5 -of $tf.ps
LANG=zh_CN bg5ps -if file.sample.cc.gb2312 -of $tf.ps
mpage file.sample.cc.gb2312 | bg5ps -nps y > $tf.ps
mpage file.sample.cc.big5 | bg5ps -nps y > $tf.ps
gv $tf.ps &
gv -swap $tf.ps &

Version 1.3.0 (1.1b2) 

bg5ps-1.3.0-12.i386.rpm

Test Run 

tf=…

gb text printing 

Summary, to use bg5ps to print GB, LANG should be set to zh_CN.

Under GB Environment

$ bg5ps -if file.sample.cc.gb2312 -of $tf.gb.ps
bg5ps version:1.1b2
Copyright (C) 1998  Chen-Shan Chin

No configuration file option is given.
 Trying ~/.bg5ps.conf
~/.bg5ps.conf not found.
 Trying /etc/bg5ps.conf.
 /etc/bg5ps.conf.zh_CN found. Use configuration file /etc/bg5ps.conf.zh_CN
running /usr/bin/ttf2psm -g /usr/share/fonts/zh_CN/TrueType//gbsn00lp.ttf < /tmp/@4000.0

Totally 233 different Chinese characters have been processed.

2 of 2 pages postscript file has been generated.

gv $tf.gb.ps &

OK!

Not Under GB Environment

bg5ps -en gb2312 -if file.sample.cc.gb2312 -of $tf.gb.ps
Error: Font file /usr/share/fonts/zh_TW/TrueType//gbsn00lp.ttf not found.
LANG=zh_CN bg5ps -if file.sample.cc.gb2312 -of $tf.gb.ps
big5 text printing 

Summary, to use bg5ps to print big5, LANG can either by C or zh_TW, just not zh_CN.

$ bg5ps -en big5 -if file.sample.cc.big5 -of $tf.bg5.ps
bg5ps version:1.1b2
Copyright (C) 1998  Chen-Shan Chin

No configuration file option is given.
 Trying ~/.bg5ps.conf
~/.bg5ps.conf not found.
 Trying /etc/bg5ps.conf.
 /etc/bg5ps.conf.zh_CN found. Use configuration file /etc/bg5ps.conf.zh_CN
Error: Font file /usr/share/fonts/zh_CN/TrueType//bsmi00lp.ttf not found.

Changed to LANG=zh_TW environment and run again:

$ bg5ps -en big5 -if file.sample.cc.big5 -of $tf.bg5.ps
bg5ps version:1.1b2
Copyright (C) 1998  Chen-Shan Chin

No configuration file option is given.
 Trying ~/.bg5ps.conf
~/.bg5ps.conf not found.
 Trying /etc/bg5ps.conf.
 /etc/bg5ps.conf.zh_TW found. Use configuration file /etc/bg5ps.conf.zh_TW
running /usr/bin/ttf2psm -b /usr/share/fonts/zh_TW/TrueType//bsmi00lp.ttf < /tmp/@4020.0

Totally 233 different Chinese characters have been processed.

2 of 2 pages postscript file has been generated.

gv $tf.bg5.ps &

NB, it is also ok when LANG=C:

$ bg5ps -if file.sample.cc.big5 -en big5 -of $tf.bg5.ps
bg5ps version:1.1b2
Copyright (C) 1998  Chen-Shan Chin
bg5ps comes with ABSOULETY NO WARRANTY, see GNU General Public License for detail.

No configuration file option is given.
 Trying ~/.bg5ps.conf
~/.bg5ps.conf not found.
 Trying /etc/bg5ps.conf.
 /etc/bg5ps.conf found. Use configuration file /etc/bg5ps.conf
running /usr/bin/ttf2psm -b /usr/share/fonts/zh_TW/TrueType//bsmi00lp.ttf < /tmp/@4231.0

Totally 233 different Chinese characters have been processed.

2 of 2 pages postscript file has been generated.

mpage file.sample.cc.big5 | bg5ps -nps y > $tf.ps
mpage file.sample.cc.big5 | bg5ps -s 8 -nps y > $tf.ps
mpage file.sample.cc.big5 | bg5ps -s 15 -nps y > $tf.ps

char size are the same. They are controlled by mpage!

to pdf 
ps2pdf  $tf.gb.ps  $tf.gb.pdf
xpdf $tf.gb.pdf &

The outcome is much worse than the .ps version, viewed at 400% level at both side.

documented on: 2004.03.10