Shawn Willden wrote:
Hi,
Please excuse this somewhat offtopic question. I'm posting it here because I
expect that some of the people on this list may have dabbled with all of
these technologies, and might have some useful experience to share. You may
wish to reply off-list. Suggestions of better fora are very welcome.
What I need to do is to programmatically generate a postscript document,
placing images and small chunks of text at locations specified by a template,
with specific values pulled from a database. I'm trying to determine what
would be the easiest and most flexible way of accomplishing this. The bulk
of the program is written in Java, but I have to call some shell scripts
anyway, so there is no problem with using command-line tools (on Linux).
The options I'm considering so far are:
1. Use the Java2D printing API to "draw" on an in-memory bitmap which can be
converted to PS
2. Generate a TeX/LaTeX document and convert to PS
3. Generate an XSL:FO document and convert to PS
4. Generate the PS document directly
Of course, I don't know TeX/LaTeX, XSL:FO, PS or the Java2D API, so I'm going
to have to learn whatever I use. I've got no objection to learning all of
them so that I can pick the best option, except that I'm working to a pretty
tight deadline. I also need fairly precise control over the output.
One more consideration is that all else being equal, I'd prefer to learn the
more useful tool. I suspect that may be TeX/LaTeX, and I'm quite certain
it's not the Java printing API. Given the time pressure, however, I need to
take the quickest path.
Any suggestions? I'm currently leaning toward writing code that generates PS
directly.
This depends a lot on what you really need.
If PS is all you need, then generating PS directly may be smart.
PS can also be converted to PDF later if need be. If you ever need
output in other formats (html?) then PS may not be the best choice.
latex can be converted to lots of formats. It also comes with limitations
of its own, as well as some strengths. The main strength is good
typesetting of text & math, so this depends on how big those "small chunks"
of text are. If all you have is captions for images, then latex
probably isn't what you need.
If you need line breaking (and possibly also hyphenation) for your text
chunks,
then latex may be the right tool for the job. Good line breaking with two
straight margins is not easy to do when generating postscript directly,
latex will do this with quality good enough for a printed book.
Latex is also nice if you need to print complicated formulas.
Helge Hafting