Printing to PDF from any Application
Something I do a lot of is printing to PDF. With LibreOffice (the OpenOffice.org variant bundled with Ubuntu 11.04) you can export to PDF very easily. There is a PDF icon right there on the toolbar. You can also access the PDF functions through the File > Export as PDF option, which allows you to have a greater degree of control over the PDF that is created – such as password-protecting it. but what about other applications that do not support the creation of PDF documents?
Back in the Windows world I had installed PrimoPDF. This appeared to Windows as though it were a printer. It was a sort of virtual printer. There was no hardware of course, but the PrimoPDF entry used to show up in the print dialogs of any application that could print. If I wanted to create a PDF instead of a hard copy I selected the PrimoPDF ‘printer’ as the output device and a PDF was created for me.
I missed this facility in Ubuntu, so I set about finding out if a similar set-up could be created. Needless to say it could, and very easily.
I should say at this point that I tried this in my Ubuntu Sandbox (a VirtualBox virtual PC running Ubuntu that I use for testing) and it behaved slightly differently than it did on my actual physical Ubuntu box. It worked in both cases, but on my real PC I had to perform a few more steps.
The first thing to do is open the Ubuntu Software Centre and search for cups-pdf. When it is located, highlight it and then click the Install button.
The PDF output from this will go into folder called PDF in your home folder. Check, and if there is no such folder go ahead and create one. You can do this at the command line with:
You could of course use Nautilus if you prefer. But make sure that you have a folder of that name (in upper-case) in your home folder – not in some sub-folder. In my Sandbox virtual PC, that was all I had to do. There was a new printer entry in the System Settings printer list. On my physical PC however I had to go into System Settings > Printing and then click the green Add a Printer button. I selected CUPS-PDF at each stage of the wizard and that was that.
It asked me if I wanted to print a test page so I chose yes. A second later a new PDF was created in the PDF folder. Double-clicking on that caused Evince, the default PDF viewer, to open it. And there was the test page in all its glory.