Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.4: Use Preview to view formatted man pages' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Use Preview to view formatted man pages
Authored by: aalegado on Dec 31, '05 03:08:18PM
I didn't have 'ps2pdf' on my system (Tiger, 10.4.3). Instead, I had 'pstopdf' so the original script didn't work for me. I came up with something a little different based on doctype's script.

#! /bin/sh
pathtopdfs='/Absolute/path/to/folder/for/PDFs'
pdffile="$1.pdf"

cd "$pathtopdfs"

if [ "$1" ]
then
	if [ -r "$pdffile" ]
	then
		echo "The PDF for that man page already exists. Here it is..."
		open "$pdffile"
	else
		echo "The PDF for that man page does not exist. Creating it now..."
		man -t "$1" | pstopdf -i -o "$pdffile"
		open "$pdffile" 
	fi
else
	echo "No command specified. Exiting..."
fi
If your intended storage location for the PDFs has spaces in the directory name (e.g. a folder in your Documents folder named "PDFs of man commands"), you can get away with something like:

'/Users/username/Documents/PDFs of man commands'
Also note that the trailing slash isn't needed since I'm using this variable differently.

[ Reply to This | # ]