0

I'm creating an Java application for self-employed workers. In this application, the self-employed workers can keep track of hours worked on different projects. Storing hours worked on different projects is now working. I store it in a MySQL database. Next step is to use this data and create invoices. The first option I want to work on is creating an invoice in PDF format. Could you suggest an approach?

One approach is generate an XML document and use that to generate the PDF document. Possible with a template containing a pre-formatted invoice. But how?

ManoDestra
  • 6,325
  • 6
  • 26
  • 50
De Macamba
  • 51
  • 1
  • 2
  • 5
  • You should probably find your answer in this [topic](http://stackoverflow.com/questions/3986105/pdf-generation-library-for-java) – Julpark Apr 08 '16 at 14:05
  • Check [JasperReports](http://community.jaspersoft.com/project/jasperreports-library) – seenukarthi Apr 08 '16 at 17:05

3 Answers3

1

Another approach may be to generate a PDF using pure PDFBox. You can use a background image as a template and then overlay it with details that you retrieve from your DB.

Coffee Monkey
  • 481
  • 2
  • 7
0

You can use Apache FOP to generate a pdf from a xml using xsl transformations

Plebios
  • 835
  • 1
  • 7
  • 17
0

You can use iText library for creating pdf. Its open source and easy to use with Java. Also the documentation provided by iText team is very good for starting any PDF generation project.

  • 1
    iText may be open source, but it's not free to use in a commercial application. – Coffee Monkey Apr 08 '16 at 15:05
  • I thought above application for self employed workers is non-commercial, hence iText is best choice. But yes, you are right, for commercial application there will be some cost involved with respect to use of iText. – Parag P. Phatak Apr 08 '16 at 17:14
  • The OP did not specify that there should not be a cost. – Amedee Van Gasse Apr 08 '16 at 18:01
  • I didn't imply that OP asked for a a free solution. I was just suggesting that by using the terminology "open source", OP might get the impression that it's free to use. – Coffee Monkey Apr 11 '16 at 07:22