Thursday, November 5, 2009

web and print with moinmoin, pdflatex, google charts and eastwood

As always, this is mainly a reminder to myself... We wanted to create a nice report/handbook that will be occasionally be printed, but in between printings should be a living (web) document. As typical for reports, it will contain charts and tables. We went with a wiki, which has pretty good tables and google charts looked like a perfect fit, until we saw that output is limited to png with a maximum resolution of 300k pixels. Then we found eastwood, a reimplementation of the google chart api in java with jfreechart as the back end.
So here's how we do it:
  • each report section is a moinmoin wiki page

  • limit yourself to moinmoin's native tables, footnotes, sections, enumerations, descriptions

  • use moinmoin's HTML macro to add google charts inline

  • for the print version, install Eastwood, the free java re-implementation of the google chart API

  • into Eastwood, integrate the Batik library for rendering SVG

  • use inkscape -z -E chart.eps chart.svg to convert svg to eps (eps works better than pdf for chart boundaries) and use epstopdf chart.eps to convert eps to pdf

  • install the moinmoin formatter from moinmoin FormatterMarket (this adds a renderAsLatex action)

  • use wget -O section.tex --user-agent="Mozilla/5.0" --user=user --password=pw '' (or curl -o section.text -A 'Mozilla/5.0' -u user:pw '') to download one of your wiki pages as LaTeX

  • For professional stuff, hire a LaTeX expert to define/create a professional print layout and its associated macros

  • use your script-fu (e.g. awk,sed) to fixup the moinmoin-translated LaTeX markup and e.g. to call the right latex macros for including the pdf charts

  • use pdflatex for generating your print-format report

  • Automate all of the above with ant, make, shell or even .bat files

  • And editmoin allows you to use
    to edit content instead of a browser's textarea editor

1 comment:

hoho said...
This comment has been removed by a blog administrator.