Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to build a web application for generating stylish PDF documents. The layout should be based on a design templates and the data should come dynamically from the database. Ideally I want to design the template in a "publishing like" tool with placeholders and replace these placeholders by the web application with the data from the database. Think of something like an invoice generator, where a customer could choose from different invoice templates and the invoice data itself coming from the DB. Thanks for your ideas!

share|improve this question
2  
latex of course! see also this question: stackoverflow.com/questions/8622973/… –  Gerhard Burger May 27 '13 at 11:08
    
What have you tried? –  Martin Schröder May 27 '13 at 17:17

2 Answers 2

I use perl (with HTML::Template) to generate an .ods document from database data, then I use unoconv to convert it to pdf. To be precise:

  • first, create an .ods document that looks good. Make sure the variable fields are recognizable.
  • unzip the .ods document and edit the file contents.xml.
  • in contents.xml, change all the variable fields to <TMPL_VAR> tags as per HTML::Template. This contents.xml file is going to be your template.
  • write a Perl program that reads the database, fills the TMPL_VAR fields, writes a new contents.xml file and re-zips the new contents.xml file into a new .ods document.
  • then use unoconv to convert the new document to pdf.

Easily extended to use more than one template.

share|improve this answer

I have used Java, Jasper Reports and iReport for a similar task. Hope that helps.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.