Re: Generating fancy/pretty documents



Bernie Cosell <bernie@xxxxxxxxxxxxxxx> wrote:
Suggestions on how to produce "nice" text documents from Perl? Plain
text is easy, of course, but I need to be able to do fancier/formatted
stuff. What I've done in the past is generate HTML [with <tables>,
<fonts>, etc] and then use an app like HTMLDOC to convert that to PDF
(and, indeed, a long time back I used to generate troff input and use
ghostscript to process *that*). That kind of approach sort of works,
but the whole procedure is a bit klunky and fragile. Is there some
way to produce "pretty" PDF or ODF document directly? I see there's a
suite of modules PDF::API2 -- it looks pretty complicated....anyone
used that? PDF::Create also seems complicated.

I would slightly disagree with Joost Diepenmaat -- any interface is no
more complicated than underlying structure. If you are familiar with
a structure then no braindamage in an interface would stop you. If a
structure is unknown, you would fail sooner or later. Even I would
stress that as much simple an interface is as harder and sooner you will
fail.

Am I just being naive about this? As I say, in the past I've used
troff and HTML as an intermediate "layout" format and things like
fonts, titles, indenting, tables, simple drawing (e.g., putting a box
around some text) etc were all relatively easy. Is that kind of thing
easy/reasonable to do with one of the "direct to PDF" packages? In
looking at the organization and methods for the PDF modules, using
HTMLDOC (<http://www.htmldoc.org/>) starts looking more and more
attractive...

Wait a moment. You have to make clear for yourself, either you want
convert HTML to PDF or you want to have nice PDF. Those are slightly
different beasts.

Once I've downloaded PDF made from SGML (LDP, HOWTO's, you know)... It
was awful. Typesetting was even worse than wordproccessors make. I was
sick of it. However it was no different from rendered HTML. So what's
the problem? That PDF can't be passed upstream. You can read it
(somewhat), you can sidenote it, you can discard it. But you can't give
it away. Giving away such an awful typesetting, would render you
incompetent.

If you want good quality PDF (or PostScript, which are somewhat the
same), then you don't need converter. You need a tool that specializes
on B<typesetting>. You B<must> not focus on making typesetting
yourself. And here you have an option.

=item LaTeX

Hmm,.. Let's be honest, LaTeX isn't my favorite tool for making
typesetting. It's my only tool for that. But here we have the first
pitfall: you have to be familiar with it. I would disagree with Joost
Diepenmaat again -- LaTeX isn't easy, it's fscking braindamage, but as
soon as you adapt to it, than the whole world of typesetting becomes
bright and shiny (I must admit, it's still dark for me). First of all,
forget about B<PerlTeX>; you have to get that out of sandbox first; if
you'd fail (I failed), than you get nothing more than a heavy calculator
inside LaTeX source.

I'm quite successful in making LaTeX-generators. Perl does all
calculations, then passes to LaTeX some source and points to F<.sty>
(style files are alike (not exactly) F<.pm>). Now I'm brave enough to
pass LaTeX output directly to printer without proofreading.

If you are still not afraid (and you are?), (looking at yours headers)
consider MikTeX -- if my guess is right it's something alike ActivePerl
but from LaTeX world.

=item openoffice.org

(not tested, any feedback is appreciated). There're at least 2
distributions about OO.org on CPAN. B<OpenOffice::OOBuilder> seems not
ready -- it declares that it works only with spreadsheets.
B<OpenOffice::OODoc> seems to be much better.

I believe, that if you go with OO.org (whatever interface you chose) it
would be just slightly different with LaTeX way. There's something
named B<Styles> inside; maybe that would allow some kind of templating;
maybe not.

=item some-trademark

And what I'm supposed to say here?

--
Torvalds' goal for Linux is very simple: World Domination
.