Ubuntu - PDF - Print to pdf

Print to pdf from the command line.

1. Install cups and cups-pdf.

apt-get install cups cups-pdf

2. Check which printer is available:

lpstat -p -d 
 
printer Cups-PDF is idle.  enabled since Wed 10 Jul 2013 09:30:05 AM EST
 
no system default destination

where:


3. To print, the lpr command is needed:

echo "Printing some characters to a pdf file" | lpr -P Cups-PDF -J print01.pdf

where

The file will be saved in ~/Desktop, but this can be changed in /etc/cups/cups-pdf.conf.