#! /bin/bash DIR=/tmp/manpdf STYLE=$DIR/style.css FNAME=$DIR/$1 [ -d $DIR ] || mkdir $DIR if [ ! -r $STYLE ] then echo "" > $STYLE fi if [ ! -r $FNAME.pdf ] then gunzip --to-stdout $(man --where $1) | groff -mandoc -Thtml > $FNAME.html sed -i "/<\/style>/r $STYLE" $FNAME.html wkhtmltopdf $FNAME.html $FNAME.pdf fi evince $FNAME.pdf