Christopher R. Maden wrote:
On Mon, 2007-09-03 at 17:33 -0500, Michael Hipp wrote:
I'm writing an application in Python that needs to produce reports and
printouts. DocBook seems like a great starting point for defining the
layouts.
For better or worse, PDF seems like the way to send printouts to the
printer. Are there any other options (when starting from DocBook)?
Using Python, how do I get from my DocBook XML XSLT files to PDF?
Unless you are using a very well-defined subset of DocBook and have
experience with typesetting into PDF, I would say you don’t.
But let’s back up a bit: DocBook isn’t really good for “defining
layouts.” It’s good for describing the semantics of techpubs (and some
other textual information). It may be able to represent your reports,
but if all you want is PDF, DocBook may be an unnecessary diversion.
However, if you want to archive your reports in some reusable form,
DocBook may make sense.
That said, the most straightforward general way to get from DocBook to
PDF is to use XSL, and the most straightforward free way to do that is
with FOP, from the Apache Project. There are other implementations of
XSL, as well.
However, FOP is written in Java, not Python. You could use the Python
interface to libxslt to do the transformation part, from DocBook into
XSL-FO, but that doesn’t solve the problem of typesetting into PDF. And
if you’re going to generate the PDF yourself from within Python, you may
as well not bother with the XSL part.
In short, you need to better define your problem, and not presume that
DocBook or XML are necessarily going to be part of the solution.
All good points. I'm not necessarily settled on DocBook, but I've tried
the option of directly generating printouts from within a program and
found it to be utterly unsustainable.
Anyway, I need to display and print reports as requested by the user and
also do program-driven printouts with no user intervention. And not make
a career of it. Simple, right?
So my constraints are:
- Printouts are mostly defined outside of program code (e.g. template files)
- Changing data can be inserted into the template processing stream with
minimal fuss
- Standards-based; some degree of future-proof; minimal dependence on
single vendor
- Options for various output types (i.e. PDF, web, etc.)
- Mostly written by someone other than me (I've enough to do)
- Without the hood welded shut
- Callable from Python
- Multi-platform (Win & Lin)
- As lightweight and resource stingy as possible
- A visual report designer would be nice, but not a necessity
Mostly I've come down to these options:
1. DocBooks using xsltproc and apache-fop
2. RML using Tiny rml2pdf
3. OpenRpt
4. PythonReports
All of those solutions fail on one constraint or another. Numbers 3 & 4
would likely be "last resort" for various reasons. RML is appealing but
isn't any kind of standard. DocBooks is a real standard but coupled with
fop weighing in at 68M it doesn't seem lightweight and the complexity is
intimidating.
I know I'm not plowing any new ground here, so I'd like to learn from
others experiences.
Thank you to both Christopher Maden and Dave Pawson.
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]