summaryrefslogtreecommitdiffstats
path: root/manpdf
blob: 32136f941e278b3fd92cf993360377d6e86a569a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#! /bin/bash

DIR=/tmp/manpdf
STYLE=$DIR/style.css
FNAME=$DIR/$1

[ -d $DIR ] || mkdir $DIR

if [ ! -r $STYLE ]
then
    echo "<style type=\"text/css\">
body { font-family: Whitney Medium; background: #181a1b; }
p    { font-size: 20px; color: white; }
h2   { font-size: 25px; display:inline; color: yellow; }
h1   { font-size: 30px; color: white; }
b    { color: #5ce7ad; }
i    { color: #ff4b4b; }
a    { font-size: 20px; color: #3391ff }
pre  { color: white; font-size: 15px; }
</style>" > $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