Creating PDF Invoices - Are there any templating s

2019-01-31 09:12发布

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?

22条回答
劳资没心,怎么记你
2楼-- · 2019-01-31 09:49

This html-2-pdf site may be a helpful starting point: http://maarten.lippmann.us/?p=101

A site a friend of mine built uses a script to churn HTML pages into printable PDFs, too - http://philambdaupsilon.org. Not sure on the exact details of it, but he is an SO user, and I'll send this question to him, too.

查看更多
三岁会撩人
3楼-- · 2019-01-31 09:51

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.

查看更多
叛逆
4楼-- · 2019-01-31 09:52

I've previously produced invoices by templating a PostScript file, and then using Ghostscript's ps2pdf to convert those into PDFs.

查看更多
放我归山
5楼-- · 2019-01-31 09:52

Unfortunately, the best system on the market (at present) is passing the HTML & CSS to a ColdFusion server and have that return the rendered PDF. So if money isn't a big concern, this is the quickest to deploy solution that'll render the best results.

I've tried very hard to get FPDF, TCPDF, the R&OS pdf class, and even CodeIgniter's recommendation to work, but nothing with stable output for anything beyond the most basic/bland HTML files.

Honestly, if the ColdFusion solution isn't viable, I'd use html2ps, and then ps2pdf to convert your files into a PDF.

(This is all assuming that you don't want to take the time and design each PDF using the native PDF-creator code in PHP. This is what systems like SugarCRM use. Though its very functional with stable results, the actual creation of each PDF-generator file is a most painful process)

查看更多
登录 后发表回答