Skip to content

Instantly share code, notes, and snippets.

@zshipko
Last active December 25, 2015 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zshipko/6946368 to your computer and use it in GitHub Desktop.
Save zshipko/6946368 to your computer and use it in GitHub Desktop.
linux/osx text to pdf conversion script
#! /usr/bin/env bash
if [ $# -lt 1 ]
then
echo "USAGE: txt2pdf [filename] > output.pdf"
exit
fi
uname=$(uname)
if [[ $uname == Darwin ]] # OSX
then
cupsfilter "$@"
elif [[ $uname == Linux ]] # Linux
then
a2ps --borders=no --portrait -B --columns=1 "$@" -o - | ps2pdf - -
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment