Dienstag, 8. Dezember 2009

OS X: Create PDFs from command line

Re-Blogging from Mac OSX Hints:

(...) 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.pdf

If 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/null

There 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.

Of course, your mileage may vary :-).


Keine Kommentare:

Kommentar veröffentlichen