Forum: Ruby Want to convert html table to image file, how?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
38345d2e22fbb938e54709c5dea45e8a?d=identicon&s=25 Glenn Reed (glenn_nz)
on 2007-07-13 07:00
Hi all,

This is my first time on this list so I hope I'm not breaking any
ettiquette rule by posting here.

I have been using ruby and rails for about 3 months now and enjoying it
quite alot.

I am working on a project.  It involves ruby on rails.  The development
is being done on InstantRails under Windows 2000 but the final product
is expected to reside on a Linux server.

However I have been in the process of trying to generate PDFs.  I've
been using pdfwriter and seems to be working quite well.  It also has
capability of creating tables.  The basic idea is to provide hard copy
of the same information that is on screen which includes html tables,
formatted using css, and also includes graphics (barcharts created

The only problem is that the tables created using pdfwriter are a lot
more limited than those created in html.  For instance no column
spanning which I use for creating the heading.  To be more precise I
have something like this.  Excuse text formatting..

--------   ----- Previous Year --- ----- Current Year ---  Comparison
Week  Profit  Days  Profit % Profit Days Profit %  %Diff  $Diff

Excuse the "----" characters which I have just put in to help space
things out.  See the two row heading.  Major headings "Previous Year"
and "Current Year" span a number of other headings underneath.  This
pdfwriter does not appear to be able to do.  (please correct me if I'm

Hence I am looking for a better solution.  One thought it that maybe I
can use some other library or tool for converting the html table to an
image and then including that in the pdf.  Someone suggested htmldoc but
that looks very unstable as there is a list of kludges that were
required for it to work such as it launches the actual table in a
browser and then screen captures it using ImageMagick.  Not suitable for
a web application that could be serving up multiple clients at one time.

Will consider commercial tools as well but would prefer open source
tools if possible.

Thanks in advance.

D0338c0de4cb3c5c17300396159933d1?d=identicon&s=25 Axel Etzold (Guest)
on 2007-07-13 15:49
(Received via mailing list)
Hello Glenn,

welcome to the list!
I'd like to propose a non-Ruby solution ... which
you might put together using Ruby.
A professional layout program that will let you do
just about anything you'd want in publishing is latex

Using that free software, you can generate tables, graphs,
whole books, from ascii text.

It's got a reputation of being somewhat cryptic to a beginner, however,
since it's not WYSIWYG.
You'd need an installation of the  MikTEX distribution on Windows
to be able to use it.

There are versions for Linux, Mac as well

To obtain a latex f
ile from HTML input, you could use a tool like
Having converted the .html file to a .tex file, you'd run
dvipdf or dvipdfm, which is included with MikTEX, and the TexLive
distribution,  to produce a pdf output of the entire document. This can
include external graphs,pictures etc. which may be in diverse graphics
(See the not so short guide above for examples on how to include
graphs and tables..)

Best regards,


-------- Original-Nachricht --------
Datum: Fri, 13 Jul 2007 14:00:36 +0900
Von: Glenn Reed <>
Betreff: Want to convert html table to image file, how?
This topic is locked and can not be replied to.