I am interested in ebook reader for quite a while. But after trying
with a 6-inch e-ink reader (Hanlin V3), I found it is almost useless
to read normal PDF files on these machines. The font size is too
small, while the page size is too wide.

So, a method to render PDF for these small devices is thought about
and prototyped. The details are as follow:

1. Convert pdf to image. I use pdftoppm of xpdf. Such as: 
   pdftoppm -r 180 -f 245 -l 245 -gray -aa yes a.pdf a

2. Analyze the generated images. Break page into lines.

3. Divide each line long enough to two segments.

4. Rearrange the segments into a new page, with half of the width.


Basic Usage:

tar -xjf pi.tar.bz2
cd pi
. env.sh
cd test
pi_format.py chap.conf
/* output goes in out */
img_dir_to_pdf.sh out chap6-rf.pdf
