Created
July 6, 2014 07:59
-
-
Save 646b/6f9f6727602a9240a39e to your computer and use it in GitHub Desktop.
Man to pdf convert script (tested on Mac OS X)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Available fonts (use `grep -r "internalname" /usr/share/groff/1.19.2/font/devps/` to get the list): | |
# | |
# AB:AvantGarde-Demi | |
# ABI:AvantGarde-DemiOblique | |
# AI:AvantGarde-BookOblique | |
# AR:AvantGarde-Book | |
# BMB:Bookman-Demi | |
# BMBI:Bookman-DemiItalic | |
# BMI:Bookman-LightItalic | |
# BMR:Bookman-Light | |
# CB:Courier-Bold | |
# CBI:Courier-BoldOblique | |
# CI:Courier-Oblique | |
# CR:Courier | |
# EURO:FreeEuro | |
# HB:Helvetica-Bold | |
# HBI:Helvetica-BoldOblique | |
# HI:Helvetica-Oblique | |
# HNB:Helvetica-Narrow-Bold | |
# HNBI:Helvetica-Narrow-BoldOblique | |
# HNI:Helvetica-Narrow-Oblique | |
# HNR:Helvetica-Narrow | |
# HR:Helvetica | |
# NB:NewCenturySchlbk-Bold | |
# NBI:NewCenturySchlbk-BoldItalic | |
# NI:NewCenturySchlbk-Italic | |
# NR:NewCenturySchlbk-Roman | |
# PB:Palatino-Bold | |
# PBI:Palatino-BoldItalic | |
# PI:Palatino-Italic | |
# PR:Palatino-Roman | |
# S:Symbol | |
# SS:Symbol-Slanted | |
# TB:Times-Bold | |
# TBI:Times-BoldItalic | |
# TI:Times-Italic | |
if [ $# != 2 -a $# != 1 ] | |
then | |
echo "Usage: `basename $0` [section] name." | |
exit $E_BADARGS | |
fi | |
if [ ! -z $2 ] | |
then | |
NAME=$2 | |
SECTION=$1 | |
else | |
NAME=$1 | |
fi | |
groff -Tps -mandoc -f P `man -w $SECTION $NAME` | pstopdf -i -o "$NAME.pdf" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment