Man; I wish I knew this many years ago

@JeanYves you can use the ‘pstopdf’ command line tool to convert postScript format files to PDF’s.
And then you can open the created PDF document with the ‘Preview.app’.

This is an example based on Normans script, but made as an AppleScript.

set toolName to "ls"
set manPDFPath to "/tmp/" & toolName & ".pdf"
set manPDFFile to do shell script ("man -t " & toolName & " | pstopdf -i -o " & manPDFPath)
delay (1.0)
set openManPDFFile to do shell script "open " & manPDFPath & " -a Preview"

Regards Mark

1 Like