4

For ten years I have been generating billings for me and my wife in this way:

  1. Create TeX template with LyX or by hand
  2. Using in this source placeholder text
  3. Then:

    cat template | sed s/placeholder1/somevalue1/ |sed s/placeholder2/somevalue2 ... > output.tex
    pdflatex output.tex 
    

Sadly in last years this process is becoming more and more difficult because TeX packages are becoming larger and larger (don't know why, but a full TeX installation on Ubuntu is almost 3 GB), and I always get lots of errors in the generation.

So, since I can control all the processes involved, is there a better (easier/more portable) way to create the template and then fill it with fields and create a PDF?

  • You don't need a full TeX install, since you are in control of the process, just install the packages you need. How complicated are these PDFs? Do you have multiple images, graphs, links etc? Could we see a sample file? Have you considered using markdown? – terdon Jan 16 '14 at 12:46
  • Yes but the packages I need vary from year to year in name, content, and so on. The same packages I installed one or two years ago now are not enough. When I upgrade distro, every single time, there is something that does not work. The files are very simple, table-like, with an image as logo and some basic formatting (right alignment, left, italic, bold...), very simple. – d3k Jan 16 '14 at 13:12
  • You could use HTML and then html2ps -> ps2pdf but LaTeX is probably the best solution. – terdon Jan 16 '14 at 13:14
  • Mmmm, at first I did not think at markdown because I started with a Writer (.doc) page, then I switched to LaTeX for flexibility. But... if my pages are so simple, maybe markdown could be the way. I need to find a markdown dialect that supports tables, colour background for tables, and pdf export (or ->html->pdf). – d3k Jan 16 '14 at 13:19
  • Well, you could also just generate the HTML and have your browser print to PDF. – terdon Jan 16 '14 at 13:20
6

I have seen PDF files generated by using Python and ReportLab. In the open source version you have to do some programming to get to the output, but there are several examples and this should be straightforward for someone who could handle TeX.

What I have not used but what seems even simpler is to use rst2pdf. The generating/editing the .rst markup format is much the same as using LaTeX.

  • I am checking ReportLab and it's a very good solution, stable and complete – d3k Jan 16 '14 at 13:34
  • rst2pdf is nice, and does not dipend on latex, just python. I like it. Similar to pandoc+markdown, but pandoc uses latex. – d3k Jan 16 '14 at 16:24
  • @d3k I had seen pandoc as well, but did not like the LaTeX dependency. I played a bit with rst2pdf, seems useful, have not touched the include directive which should come in handy instead of using sed. Does rst give you enough control over the layout? – Timo Jan 16 '14 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.