I have used many different methods over the years to print documents to PDFs from the command line. Some have been complicated sequences of pipes to and from groff, others required TeX, and occasionally I set up a "virtual" printer, simply to print to file. I recently read documentation for cups-pdf, however, and found that cupsfilter command is sufficient for most of my own tasks in its bare form!
For example, to print 80-column ASCII plaintext (the majority of my code), I can use this:
$ cupsfilter foo.txt > foo.pdfIf you find the output of that command a bit verbose (as I do), you can send the errors silently to the null device using this version:
$ cupsfilter foo.txt > foo.pdf 2> /dev/nullThere are many ways to wrap this simple command even more conveniently, but I'll omit those here for now. The reason this method is ideal is because it uses built-in routines in OS X; any time you can take advantage of these, do, because many of the core technologies are significantly faster and more secure than third-party alternatives.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20091124090053385