Originally Posted by TOC56
I also need this to be done in background, initiated by a script.
Actually the linux runnings this does not have a gui at all.
I was wondering if that was the case. Obviously, txt2pdf is the easiest way, but that isn't free, so I'm guessing you ruled that out. Other than that, I'm not aware of anything to do it in a single step, but you can do it as a two-step process. You could use enscript to convert the files to postscript files and then use ps2pdf to convert the postscript files to pdf.
There also might be a way to print to the CUPS pdf printer (Libre Office does have a command line interface). This
(although rather old) gives you a rough idea of how you might do this. I'll do some more digging and see if I can find something cleaner.