I'm wanting to do some docbook to pdf conversion.
I assume the "right" way would be some combination
of REXML and PDF::Writer.
Anyone done anything like this?
Ideally I'd like to be able to tweak a few things
such as margins and page size without changing
anything else...
Ideas welcome.
My first thought is Holy Crap! Really, I've got a kid about that age
The typical XML way to do this is DocBook -> XSL:FO -> pdf because
you'll be able to use Norm Walsh's stuff. If you do this and you have
input documents bigger than, say, two pages, you'll be wanting the
*fastest* XML processors you can get. I did this a couple of years
ago and found libxml2 and libxslt2 the way to go. Getting a good
XSL:FO processor was quite a trick then, and I have not been keeping
up to date, so keep that in mind. The only free one that I could find
was the Apache FOP processor, and it wasn't all that good
(incomplete). There are a couple of commercial processors that are
apparently very good, but I wasn't willing to spend a couple hundred
bucks on them.
An alternative that is worked quite well was to use the SGML
processors for DocBook.
As I said, I've not been keeping up, but apparently both the Apache
XML processors and Saxon have become much faster in the last couple
of years. Both of those are Java. Unfortunately I don't think Ruby
has a remote chance of being useful as an XML processor for this kind
of application until Ruby gets much faster.
Putting Ruby into that pipeline for processing the stream sounds more
reasonable, but still, that stream is going to get *very* long once
you've got XSL:FO.
If you really want to do this yourself brace yourself for a lot of
work. Maybe you should choose a subset of DocBook (isn't there a small
(ish) subset already defined?)
Are you committed to DocBook? If not you should have a look at DITA
(from IBM), and consider latex/contex or one of the groff macro
packages (like om (mom)). I'm having some fun with publicon from
Wolfram these days (it reminds me of FrameMaker but runs on OS/X (and
Windows, linux coming, maybe) and can generate HTML, XML, and latex
output). If publicon works out (I'm using it to document a ruby
project I'll be open sourcing soon, and a couple of things for work)
I'll be sticking with that.
Cheers,
Bob