Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating PDF Invoices - Are there any templating solutions? [closed]

Our company is looking to integrate invoices into a new system we are developing.

We require a solution to create a layout of the invoice and then convert to pdf.

We have considered just laying out the invoice in html/css then converting to pdf. We have also considered using SVG->PDf conversion.

Both of these solutions integrate well into our existing templating language used for our web application.

Historically we have been a Microsoft based business and used Crystal Reports for such a task but we are looking for an open source Linux solution for this project.

Does any one have any suggestions of an approach or technology we could use for such a task?

like image 657
smashedmercury Avatar asked Nov 06 '08 23:11

smashedmercury


2 Answers

Try this... create a blank invoice with Word (or whatever you want) and save it as a PDF.

Then use a PDF library to modify the PDF (insert the text at particular coordinates). We do this in the Microsoft world and it is extremely easy.

The biggest benefit is that we can use our own tools to create and modify the template. If we want to add some static text, we just crank open Word, make the change and save it to a PDF file (that is being used as a template).

For Microsoft, we use iTextSharp which is actually a C# port of the original Java version of iText


Additionally...

You can use Adobe Acrobat to insert fields in the PDF (address, phone, invoice number, line item 1, line item 2, etc...) and then use iText/iTextSharp to populate these fields at run time.

This is, in more detail, what we do... and it is extremely easy.

like image 167
Jason Avatar answered Sep 30 '22 12:09

Jason


The normal way is to install (La)TeX (probably already on the linux box) and run pdflatex to get the pdfs. You can also use Apache FOP, if you prefer xslt and xsl-fo.

If the number of invoices to create is low you might want to use open-office (directly or as a toolkit).

If you want high-precision positioning and low-level access, a low-level pdf library (I don't know if iTextSharp works with mono) might be what you want.

I would try out LaTeX first, because it allows you to get results with the least effort.

like image 37
Stephan Eggermont Avatar answered Sep 30 '22 13:09

Stephan Eggermont