views:

66

answers:

4

Say I'm writing a Java program with a GUI, and I'd like to generate nicely formated pdf results. I'm quite familiar with both LaTeX and Java, what is the best way to include the necessary LaTeX files to generate reports with my program when distributing it on windows, and then compile them with java calling the necessary programs?

Edit Especially looking for F/OSS that can be bundled with my program when distributed.

A: 

LaTeX is not really easily pluginable. If you need to distribute the software for Windows, I would look for other options.

LaTeX is a quite big piece of software divided in many files which have their own preferences on where to reside. You can override the defaults, but it is not an easy task. When you finally have bundled a LaTeX environment with all modules you may need, you may be ready to go. I would let the Java program generate LaTeX files, then use a batch script for compiling them.

Why overriding the default installation paths for LaTeX? Well, else it might conflict if the user has already one installation. LaTeX modules tend to be quite version specific, so depending on a custom installation is doomed to fail.

That's just my two pieces of eight.

Johan
A: 

LaTeX is probably not the best choice for programmatic report generation in Java, since you would depend on a large native software package. You could consider other options like BIRT, WikiText or iText.

Fabian Steeg
+1  A: 

iText is a very popular Java PDF library, especially if you want full programmatic control over your output.

It's fine if you want to generate just LaTeX files, since the user may already have LaTeX (depends on your target audience) and it would be nice to have that option, but LaTeX can be several hundred megabytes to a few gigabytes depending on what all you include.

erjiang
+1  A: 

XML + Apache FOP is probably your best bet.

If you need a decent set of style sheets to start from, check out the DocBook 5.0 XSLT's

Mica