Generate a PDF Copy of the Man Page for a Shell Command

(I had to correct this a couple of times, kindly look at the final version, please.)

Thanks!

Enscript (installed using HomeBrew) is a possibility, if "enscript.cfg" is modified so that the line

DefaultOutputMethod: printer

is changed to

DefaultOutputMethod: stdout

In that case, a pipe such as

enscript --filter="transcode-video --help" | pstopdf -l -o ~/desktop/onefile.pdf

is successful.

However, substituting

enscript --filter=$CMD | pstopdf -l -o $MANPDF

for

man -t $CMD | pstopdf -l -o $MANPDF

in the macro didn't work, apparently because "transcode-video --help" when entered into the dialog, is interpreted as two separate commands.

So that's one issue to be solved (my proficiency is mainly limited to AppleScript), and the second is to fork between the two command versions based on a conditional (should be easy to trap an error when either executable doesn't receive correct input).

I still used to get better results with "open -f -a /Applications/Preview.app" (before prepending the app path with "/System" was required).

"| open -f -a /Applications/Safari.app" is still beneficial to some extent, however.