Want to convert html table to image file, how?

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
dynamically).

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
wrong).

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.

Glenn

···

--
Posted via http://www.ruby-forum.com/.

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.

http://www.miktex.org/

There are versions for Linux, Mac as well
(http://www.tug.org/texlive/\).

To obtain a latex fhttp://www.miktex.org/
ile from HTML input, you could use a tool like
html2latex.
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 formats.
(See the not so short guide above for examples on how to include
graphs and tables..)

Best regards,

Axel

-------- Original-Nachricht --------

···

Datum: Fri, 13 Jul 2007 14:00:36 +0900
Von: Glenn Reed <glenn@anztec.com>
An: ruby-talk@ruby-lang.org
Betreff: Want to convert html table to image file, how?

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
dynamically).

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
wrong).

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.

Glenn

--
Posted via http://www.ruby-forum.com/\.

--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: GMX Handytarife 2024 | jetzt wechseln & sparen