Create PDF documentation on the fly

In software development, testers need to create a lot of documentation. Mac users can create very comfortable the documentation in PDF.

manpage to PDF

# Create PDF from manpage ping and open in Preview.app
$ man -t ping | open -f -a /Applications/Preview.app

Text to PDF

# Create PDF from text file
$ cupsfilter foo.txt > lorem.pdf 2> /dev/null

# Create PDF from text file and open in Preview.app
$ cupsfilter foo.txt 2>/dev/null | open -f -a /Applications/Preview.app

Image to PDF

# Create PDF from JPG
$ sips -s format pdf test.jpg --out test.pdf

Command’s to PDF

Many test steps would be carried out via command line and again later documented. This takes a lot of time and can lead to errors in documentations.

# Create file from history
$ history > history.txt

# Create PDF from history.txt
$ cupsfilter history.txt 2>/dev/null | open -f -a /Applications/Preview.app

PostScript to PDF

# Convert PostScript into PDF
$ pstopdf foo.ps

# Convert PostScript into PDF with specific name
$ pstopdf foo.ps -o bar.pdf