On Ubuntu I'm completely used to the idea of printing out a PDF document of what I want/need. It saves on paper and allows me to keep digital copies; it can also prove indispensable if I need to send a copy via email.
At work, on Microsoft Windows, I have struggled with trying to do this. The only products available for PDF generation appear to be commercial. Through some tinkering with a Ubuntu server in the office I setup a PDF printer for all to use anonymously. Here's how...
Configuring Samba and PDF
The important thing to remember is that PDF printer on the server produces PDF files locally, and therefore access to the produced PDFs must be via SAMBA too.
Samba is usually installed by default, but if not, run:
$ sudo apt-get install samba
Changes need to be made to the config file /etc/samba/smb.conf to allow printing. Uncomment/add the following entries:
printing = cups printcap name = cups
We now need a location that anybody can read or write to (which is where our PDFs will be placed for pickup). In this example I will use the /tmp directory. To do this we add the following entry to the samba config file:
[tmp] comment = Samba server's tmp directory locking = no path = /tmp guest ok = yes create mask = 0666 read only = no
$ sudo /etc/init.d/samba restart
You may already have the PDF printer installed (as cups is installed by default) however, if you don't, simply run:
$ sudo apt-get install cups-pdf
We now need to tell the cups-pdf printer where to otput its files. System users have their files printed to the folder ~/PDF. This has implications for samba users too. If you mount samba shares as a system user on the server then your PDFs will be printed to that user's ~/PDF directory. This may be what you want.
The file we need to alter is /etc/cups/cups-pdf.conf, specifically the following two entries:
The above entry details where PDFs are created for system users. Altering this affects all system users AND samba users who use system user credentials to mount drives. Change this to suit your needs. Next is the AnonDirName entry, change it to:
Now any anonymous user will have their PDFs placed in /tmp to pickup via samba. Restart CUPS - on Hardy (and earlier?) this appears to be:
$ sudo /etc/init.d/cupsys restart
but on Jaunty (and later?) it may be:
$ sudo /etc/init.d/cups restart
The example here has been completed on a Windows Vista machine, but should be similar for other versions. First you need to browse to the computer:
and double-click the "PDF" printer, which will start to install the printer. A printer driver error message will be displayed indicating that the printer driver could not be found:
This is not a problem. Simply click "Ok" to continue the install. You will now need to select a printer driver to use with the printer. The printer works with PostScript documents so I selected a HP PostScript printer driver to use with it, the 'HP LaserJet Series 1200 PS' - CafeNinja tested with the 'IBM 4079 Color Jetprinter PS' driver and achieved successful results
Once the driver has been installed the printer's queue will be displayed. Don't worry about the "Access denied, unable to connect" message - this has never stopped it working for me:
From the printer queue window select Printer > Properties to get to the properties window. Then select to "Print Test Page" - closing any "sent test page" window box that may appear
Now browse to the /tmp directory and collect the Windows (recognisable) printed PDF. Take note that the output PDF is in color too!
A couple of things to remember...
- The PDF gets its name from the file that was being printed - this could lead to accidental overwrites
- The files do not get auto-deleted so you may wish to setup a cron job to do this periodically