To StringTemplate Or Not. Advice Needed!

44 views
Skip to first unread message

Stuart Maclean

unread,
Jul 12, 2017, 6:08:26 PM7/12/17
to stringtemplate-discussion
I have a Java Swing based desktop app which visualizes scientific data.  It's mostly JTables, with certain cells custom-rendered, and JFreeChart plots.  There's also a map with GPS fixes plotted.

I want to convert all the plots, tables (and perhaps the map) into a PDF document, a kind of 'offline summary' of the data.  I would like to add text (chapters, paragraphs,etc) to accompany/support the plots, tables, things like 'As can be seen from Figure 1, widget X did really well at task T".  Ideally, I want to generate the 'report' via some machine-generated process.

So far, I have got as far as just dumping all the plots and tables into a PDF by way of the Java itextpdf library.  But moving forward, I don't really want to learn much more of the itextpdf API to do the text part of the report (including e.g. adding a Table of Contents).  I would prefer to move to Latex, and have IT produce my PDF.  I would then use ImageIO to dump all the plots and tables to PNG files, and write out Latex source to include those graphics.

My hunch is that StringTemplate might be the way to go to generate my Latex source document.  If ST can produce entire Java source code classes as the output of ANTLR, I imagine it can indeed also produce structured Latex source.

Looking for any advice on best way to proceed, especially from anyone who has 'been there, done that'.  I should point out am I fairly proficient in Latex and ANTLR, but a newbie to both itextpdf and ST.

Stuart

Can Bican

unread,
Jul 13, 2017, 10:22:12 AM7/13/17
to stringtempla...@googlegroups.com
Been there, done that :) I also had to add an extra step for processing markdown, since users were supposed to edit their templates and something easier than latex would be required.

You may need to change the ST delimiters, as $ can be confusing in a latex template.

After you come up with the latex file, you won’t need itextpdf, I think. Let latex do the pdf instead.

--
Can Bican



--
You received this message because you are subscribed to the Google Groups "stringtemplate-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stringtemplate-dis...@googlegroups.com.
To post to this group, send email to stringtempla...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/stringtemplate-discussion/9e842b19-1770-40f9-84d3-896dd0cf313f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages