Google Books Downloader versus Pysheng to Download Google Books

gbd01Google Books Downloader is a little software that allows Google Books to be saved in PDF or JPEG format. It is a Windows based utility that will allow the downloading of a single book as a PDF, JPG or PNG in one of many resolutions ranging from 350px to 1280px. The default is 800px. The utility is a very effective for downloading single books, however, there is no command line version that would permit for the batch download of multiple Google books. This is where pysheng fills the void.

Google code developers have created a Python module, command-line appand PyGTK GUI called pysheng to download books from Google books. According to the project, PySheng “downloads a book from Google Books and saves a PNG image for each page or a single PDF. It can be run either from the command-line or using a simple GUI (graphical interface). It should work out-of-the box for Unix systems (GNU/Linux, BSD) and (hopefully) for Windows.”

Well I didn’t find the instructions to be effective. Each attempt to install pysheng led to one dead end or another, particularly where each instruction required a prerequisite. While results may vary, I was unable to get pysheng to completely install or run on a CentOS 5.6 operating system. However, I did get pysheng to install and work on a default, fresh Ubuntu 11.04 install and this is how it was done.

Off Topic
Ubuntu is designed for the enduser in mind, so the sudo command should precede the commands below, however, to login to Ubuntu as root, open terminal, and type in the following command.

sudo passwd root

Change the password and logoff as current user and login as root.

One more thing that I found useful was installing ssh so that Putty could be used to access the Ubuntu installation remotely.

apt-get install ssh

Prerequisites
Ubuntu 11.04
Ghostscript (Installed by default)
Python (Installed by default)
Python Imaging Library (Installed by default)
ReportLab
ImageMagick

Use Terminal or Putty access to type the following commands.

Install ReportLab

apt-get install python-reportlab python-reportlab-accel python-renderpm

Install ImageMagick

wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.6.8-10.tar.gz
tar xvfz ImageMagick-6.6.8-10.tar.gz
cd ImageMagick-6.6.8-10
./configure
make
make install
make check
display
ldconfig /usr/local/lib

Install pysheng

wget http://pysheng.googlecode.com/files/pysheng-0.1.tgz
tar xvzf pysheng-0.1.tgz
cd pysheng-0.1
sudo python setup.py install

Usage
More details on the usage of this utility is available at the Google Code Project, pyscheng. To download a single Google Book, which will result in individual PNG files.

pysheng "http://books.google.com/books?id=8x4EAAAAMBAJ"

or

pysheng "8x4EAAAAMBAJ"
pysheng-01

According to the pysheng project homepage, the following code should use ImageMagick and pysheng to download individual PNG images and combine into a single PDF. While this did not display any errors, I was unable to get this “feature” to produce a PDF.

convert $(pysheng "8x4EAAAAMBAJ" ) book.pdf

Conclusion(s)
The original goal was to batch download multiple Google books with scripts. This goal was not met. The setup was for Pysheng cumbersome, (seemed to be) Linux distro specific, and after much trial and error did not produce the desired results. Pysheng did download individual PNG images, however, the quality of the images were not good or adjustable. Pysheng was slow to download the images.

For the moment, between the two utilities, the Windows based utility Google Books Downloader downloads high quality images, quickly, and directly to PDFs (which was optional). Highly recommended.

gbd01
sshot-2

Hopefully the Pysheng will improve the image quality of the downloaded pages of each Google Book, that was the real show stopper. At that point it wasn’t worth troubleshooting the convert to PDF issue.

All the instructions are derived from various resourses and compiled to this consise little guide. Hopefully this assists someone else.