March 5th, 2007 § 0 comments

Anyone using Ruby and Rails knows that there are few decent reporting tools, and many of them are very hard to use. Since there’s no native solution, most developers resort to a combination of other tools to put their reports together.

In my last projects, I tested a lot of solutions and found one setup that I consider satisfactory: I’m using HTMLDOC to generate PDF reports from HTML input. HTMLDOC is an open-source application that converts HTML input to formatted HTML, PDF or PostScript output.

HTMLDOC is an excellent tool, but it’s an application, which means you need to invoke it and control its execution as a process. To make the job easier, I created a plugin/gem that allows me to use HTMLDOC via a Ruby class, with a couple of simple methods.

While I search for a permanent place for the project (RubyForge, for example), I’m making both the gem and the plugin available here. The usage information can be found in the README.txt file.

In order to use the class, you will obviously need the executable. Although HTMLDOC is open source, binaries are only available in paid versions. For Linux, the easiest option is to compile it yourself, which is quite simple. For Windows, old binaries can be found on the Internet. Obviously, they lack the most recent fixes. If you are deploying to Linux, though, that’s not much of a problem since you can test most of the options on Windows and run the most recent binary on Linux.

I hope this library will be as useful to others as it has been to be. If you have any comments, suggestions or fixes, please contact me.

Leave a Reply

Your email address will not be published. Required fields are marked *

What's this?

You are currently reading PDF::HTMLDoc at Reflective Surface.