Personally, I'd avoid third-party Bwana and the reliance on Safari. I'd take advantage of
-- prompt for command name
set shellCmd to text returned of (display dialog "Command to man:" default answer "ls")
try -- be sure command is available
do shell script "which " & shellCmd
on error
display dialog ("Shell command \"" & shellCmd & "\" wasn't found.") buttons "Cancel"
end try
-- save man page as PDF on Desktop
set manPagePath to "~/Desktop/"
try
do shell script "man -t " & shellCmd & " | pstopdf -i -o " & manPagePath & shellCmd & ".pdf"
do shell script "open -a preview " & manPagePath & shellCmd & ".pdf"
on error errText number errNum
if errNum is 232 then -- make PDF by alternate method
do shell script "man -t " & manPagePath & ".ps > " & manPagePath & shellCmd & ".ps"
do shell script "open -a preview " & manPagePath & shellCmd & ".ps"
set dialogMessage to "Please save the open man page as a PDF."
displayDialog(dialogMessage, "Cancel", 1, 0)
else if errNum is 234 then -- no man page available
display dialog ("No man page exists for \"" & shellCmd & "\".") buttons "Cancel"
else -- throw the error
error errText number errNum
end if
end try
Stan C.