5 ms·
I tried to use it to make an invoice system: wanted to convert plain-text CSV (description,amount,cost) --> to Markdown tables --> to PDF. But I was unable to
by malloc-0x90 3y ago
I tried to use it to make an invoice system:
wanted to convert plain-text CSV (description,amount,cost) --> to Markdown tables --> to PDF.
But I was unable to align the following 2nd table with taxes: cells are all over the place and it does whatever it wants. And there is no information online to be found about it.
(I eventually gave up long time ago and still to this day manually do them in LibreOffice Writer adding taxes with a calculator)
Except this, it's a really neat piece of FOSS software!
- jddj 3y agoMaybe you could use html as an intermediate point instead of markdown. Might give you more control over the layout. Might have to use a headless chromium wrapper (maybe pandoc has this anyway) to then get to pdf but that may not be too bad
- stakhanov 3y agoI was thinking the same thing: I would use HTML as an intermediate, targeting PDF through weasyprint. In fact I quite often go .md -> .html with pandoc, but write the .md in such a way that, when translated, it is the kind of html that weasyprint will be able to turn into the PDF that I want.
- wiredfool 3y agoI just recently put together something for invoices that wound up being Jinja2 + data -> HTML-> weasyprint -> pdf. Was quite straight forward, all in all.
- actionfromafar 3y agoI use pandoc quite often - but I wish the intermediate, internal pandoc format was a little more expressive, exactly for things like this. I also tried making an invoice.
- tambourine_man 3y agoI tried something like that but ended up going with markdown -> html -> puppeteer to generate an A4 pdf -> ghostscript to compress it. It’s an ugly script that’s been working quite well for more than a decade, but I wouldn’t recommend it to anyone other than myself.
- deciduously 3y agoI have a very similar homegrown mess. I wonder how many of us there are doing the same thing for this use case.
- tambourine_man 3y agoBy looking at this thread, quite a few. The problem is creating a solution that would fit all of our idiosyncrasies. For example, in my code, if a table has the class “total” it sums all <td>s which contains a dollar sign, and so on.
- Karellen 3y agoHave you looked at hledger, which generates everything from plain-text accounts files? https://hledger.org/ https://hledger.org/ https://hledger.org/invoicing.html https://hledger.org/invoicing.html https://plaintextaccounting.org/ https://plaintextaccounting.org/ One previous discussion: https://news.ycombinator.com/item?id=20012499 https://news.ycombinator.com/item?id=20012499