4 ms·
I always found SVG (plus the Inkscape CLI) to be the best interface for generating PDF documents. I'm sure there are arguments in favour of libraries like this
by plq 11y ago
I always found SVG (plus the Inkscape CLI) to be the best interface for generating PDF documents.
I'm sure there are arguments in favour of libraries like this such as performance or better control but when all you need is to generate a simple invoice with a couple of dynamic fields, just use Inkscape to draw your template and your favourite XML library to put values in it in your code. When you need the PDF, use inkscape --export-pdf to get your PDF document.
SVG also makes it quite easy to show an in-browser preview of the generated document before performing the actual conversion, avoiding a costly PDF generation most of the time.
- vram22 11y agoInteresting. So do you run inkscape manually from a command line or shell out to it from a program? And I guess that would not scale well f you want to generate many PDFs, in the sense of running inkscape each time would be a perf hit?
- tracker1 11y agoIt seems that it would scale just find with RabbitMQ, and worker queues. It may not be maximum performance per node... but that's not the same as scalability.
- vram22 11y agoI guess if you have enough hardware resources, and the delta is low, it may not matter. After all, we run Unix commands tens or hundreds of times a day, alone or in pipelines, to get things done, vs. putting all the needed functionality into one program and calling it. Various pros and cons exist for both approaches ...
- dunham 11y agoWe use FOP for document-shaped stuff, and it's worked out pretty well for us. But I could see using SVG when you want a single page with complex layout (esp. rotated text, etc.) For an invoice with a couple of fields filled in, you could also consider using a PDF form. (And use a library like iText or pdfbox to fill it in.)