[erlang-questions] PDF reports from Mnesia: Erlguten and XMerL?

Gaspar Chilingarov nm@REDACTED
Fri Oct 9 14:12:20 CEST 2009

Hi Nina!

I would like to share my experience. In my case there were a reports, 
which should be sent every month.

I've used ready html2pdf converter (written in php) for a several reasons:

- I had the template engine, which allows generation of HTML from HTML 
template file and deeply nested proplist structures (and it supports 
FOREACH and IF statements in templates - so they are completely flexible).
- HTML templates are easily editable in any visual HTML editor - so I 
can pass all design work to another person.
- html2pdf converter usually works faster than latex.
- you can easily check your output before pdf generation and fix it or 
write automatic tests.

The remaining part was exactly the same as below - spawning external 
command and so on and so on.


PS. When generating command name and arguments - be VERY careful. Do not 
allow user inject any illegal symbol in that string, in other case it 
may lead to OS command injection by remote attacker.

On 09/10/09 15:05, Roberto Aloi wrote:
> Hi Nina,
> I had to automatically generate PDF around one year ago. After
> struggling a bit with Erlguten, I found it a bit too "alpha".
> My requirements were very different from yours, but this is what I did
> at the end.
> - I defined a new LaTeX template
> - I reused some code from the wpart_gen.erl module contained in Erlang
> Web to build a "file injector" (15 minutes job).
> - Then I was able to do the following:
> {ok, Title} = injector:inject("report.tex", [{"title", Title}]),
> Where report.tex was my .tex file, looking like:
> [...]
> \author{Roberto Aloi}
> \title{<% title %>}
> \begin{center}
> [...]
> - Then I used the latex2pdf to generate the pdf file.
> Again, this is far away from an optimal and/or efficient solution, but
> it worked fine and it was quick!
> Regards,
> Roberto Aloi
> Nina Alex Juliadotter wrote:
>> Hi all
>> I'm writing an app with a Mnesia backend that needs to generate PDF
>> files from the data and was wondering if anyone had any tips on how to
>> go about doing this.
>> I've come across Erlguten for PDF generation, which takes XML files as
>> input. So, to use Mnesia data, I take it I could use XMerL to
>> transform it into XML? The only trouble is that both these projects
>> seem rather idle and alpha like, the last time I've seen any
>> discussions was in 2004 and the source I found is from 2003. Is anyone
>> generating PDF files in their Erlang app, and in that case what
>> libraries are you using?
>> Thanks heaps
>> Nina
>> ________________________________________________________________
>> erlang-questions mailing list. See http://www.erlang.org/faq.html
>> erlang-questions (at) erlang.org
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org

Gaspar Chilingarov

tel +37493 419763 (mobile - leave voice mail message)
icq 63174784
e mailto:nm@REDACTED mailto:gasparch@REDACTED
w http://gasparchilingarov.com/

More information about the erlang-questions mailing list