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

Thanks for your answer. I'm under Big Sur (11.2.1).

pstopdf --help

gave:

pstopdf: illegal option -- -
Usage: pstopdf [inputfile] [-o outname] [-l] [-p]
Try: man pstopdf

The next:

man pstopdf

is OK. Then with:

man -t tr | pstopdf -l -o "$HOME/Desktop/tr.pdf"

I obtain 2 files, the expected tr.pdf and a tr.pdf.log (it contain a list of fonts). The next command:

open "$HOME/Desktop/tr.pdf"

is also OK. The pdf is opened in Preview.app.

Your new version of "Shell manual page for command (as PDF).kmmacros" don't work neither.

So, I go to the Keyboard Maestro preferences to delete the "man page PDF folder", and retry with your new version, and set the destination folder to ~/Documents/man-page-PDF, and it works.

My previous destination folder was ~/Documents/Man page PDFs (via Keyboard Maestro).

Doesn't your macro support path with spaces in it?

But, the second macro "Browse Bash command man page(s).kmmacros" don't work (nothing displayed). To try understand why it don't work, I modified the last "Execute shell script" to change form "ignore results" to "display results in a window". But no window is displayed. In last resort, I add an "Alert" action before the last "Execute shell script" and the alert is displayed as expected. So what can I do with the Javascript code to test what is wrong?