Print PDF from any Linux program

The CUPS PDF program saves printed PDFs to the ~/PDF directory from any program.

apt install cups-pdf

The output directory can be configured by editing the “Out” directory in /etc/cups/cups-pdf.conf

Matlab print with CUPS-PDF

  • if you already have Matlab open, just restart Matlab to make the PDF printer available.

  • Workaround for Java bug impacting Matlab to print in color

      imagesc(rand(10))
      print(gcf,'-dpdf','test.pdf')
    

    and you’ll find the color PDF test.pdf in your current directory.

Matplotlib print to PDF

From Matplotlib figures, you can just save to PDF from the GUI, or use [`figure.savefig()` to save to PDF from Matplotlib](http://matplotlib.org/api/figure_api.html#matplotlib.figure.Figure.savefig)