3 ms·
I'm surprised more people aren't simply trying to use TeX or LaTeX to generate dynamic PDFs. Most of the libraries I've looked at historically were comically in
by andrewstuart2 11y ago
I'm surprised more people aren't simply trying to use TeX or LaTeX to generate dynamic PDFs. Most of the libraries I've looked at historically were comically incapable, limited to basics like "place a single line of text at these coordinates," with no provisions for line wrapping, paragraphs, tables, etc.
LaTeX (or any TeX variety) on the other hand give you so many different powerful features to generate any arbitrary document, and not only in PDF. There are, of course, a few associated risks that would need to be mitigated as with anywhere user input gets compiled in some turing-complete system, but I'd imagine it would be fairly straightforward to make sure input gets properly escaped so an attacker couldn't run arbitrary code.
- topogios 11y agoPDFBox is quite good at extracting text from pdfs. When I use PDFBox, it is for extraction. Maybe this has changed with newer versions of PDFBox, but 5+ years ago, the internet wisdom was to use PDFBox for extraction and something else, like a version of iText that suited your license needs, for generation. As much as I like LaTeX, if you have made no prior time investment in typesetting with it, it is not trivial to produce custom good-looking output with it. Have you tried using (La)TeX in a real world project? Would be cool to hear from someone on whether compilation time is an issue. Some TeX packages have a quite severe impact on performance.
- dunham 11y agoFor many of our reports, we've been using FOP (Apache's XSL-FO implementation). It's an XML format, similar to HTML, with stuff like page masters to help with layout. We generate the XML with a velocity template, feed it into FOP, and which generates the PDF.
- ternaryoperator 11y ago>"Most of the libraries I've looked at historically were comically incapable," He apparently did not look at iText, which can generate docs with support for all major fonts and bidirectional writing, forms (interactive and not), and sign them digitally.