3 ms·
The best way to create invoices (not just invoices) IMHO is to use an html to pdf converter. There are several API services and you can use headless chrome to d
by eknkc 3y ago
The best way to create invoices (not just invoices) IMHO is to use an html to pdf converter. There are several API services and you can use headless chrome to do it yourself. Easy to design an invoice using a web route and simply convert it to PDF.
- progx 3y agoNope, the "easiest" way is to use a html to pdv converter, good enough for 90%. But if you want precise good results (99%), you need to create it manually.
- xnorswap 3y agoHTML to PDF is orders of magnitude slower than more direct PDF manipulation libraries in my experience, although I haven't used this particular library ( https://github.com/signintech/gopdf https://github.com/signintech/gopdf ) that this project uses so I can't say for sure.
- iveqy 3y agoUnfortunately not, it’s a complicated process. I’m working with a software that does this and is using wktmltopdf and it’s a real mess
- eknkc 3y agoI never liked wkhtmltopdf. We experimented with phantomjs, headless chrome, electron, headless firefox etc and headless chrome produces really good results at this point.
- jlokier 3y agoI did the same and ended up using Chrome to generate invoices too, after years of painful workarounds with other tools and methods. So much time was wasted on different tools and methods, until Chrome HTML print-to-PDF proved to be reasonably reliable and attractive. Especially PhantomJS whose updates tended to break the invoice formatting severely (like radically changing the rendered font size in PDF across a PhantomJS update). Firefox required a virtual X server, but that was doable. I'd prefer to use Firefox, but unfortunately its PDF rendering screwed up the thickness of border lines, making them far too thick or not present at all, though it did a better job of pagination than Chrome. And even having settled into using Chrome for this, there are two ways to generate a print-to-PDF that produce different results in Chrome, at least when it's Chrome on MacOS. Only one of them lays out my invoice PDFs correctly.
- iveqy 3y agoIsn't it a huge performance problem? Running a headless browser is quite heavy?
- eknkc 3y agoIt most certainly is. Never had a reason to create pdf documents fast though. Even when you have a user waiting for a PDF download it is generally acceptable.
- deleted 3y ago[deleted]