Setup CUPS-PDF as a network printer

Sat 27 June 2009 by LrdShaper

CUPS-PDF is a FREE virtual PDF printer that allows you to print documents to PDF format. Yes like a PDF writer and I will show you how to install and configure it on your headless server or NAS running Linux so you can have a network printer that produces PDFs on demand from ANY computer you have at home. Since I don't have a Mac, that platform won't be covered here. Some commands used in this tutorial are specific to Debian-based distros.

Install and configure CUPS-PDF
1) Install samba and cups on the printserver

sudo apt-get update || sudo apt-get install samba cups-pdf libcups2-dev

2) Open /etc/cups/cupsd.conf and find the line

Port localhost:631

and replace it with

Port 631

Then add

Allow 192.168.1.0/24
Allow @LOCAL

inside "<Localtion />", "<Location /admin>" and "<Location /admin/conf>". Save your changes and exit

3) Open /etc/cups/cups-pdf.conf and replace

Out $HOME/PDF

to the path where you want the PDFs to be generated. Mine is configured to output to /home/commmon/PDF. Save and exit

4) Add the following lines in your /etc/samba/smb.conf file

printing = cups
printcap name = cups

5) Copy the PPD file from CUPS-PDF into the CUPS model directory

sudo mkdir -p `cups-config --datadir`/model/Generic
sudo cp /usr/share/ppd/cups-pdf/CUPS-PDF.ppd `cups-config --datadir`/model/Generic

6) Restart CUPS and Samba

sudo /etc/init.d/cups restart
sudo /etc/init.d/samba restart

7) Now open up your browser and point it to https://<printserver's ip>:631 and go to Administration->Add Printer. Put in the Name, Location and Description that you want. Mine is PDF-Writer, CUPS-PDF Virtual Printer and Server Room respectively. Click on Continue and choose CUPS-PDF (Virtual PDF Printer) -> Generic -> Generic CUPS-PDF Printer (en) and then finally click on Add Printer. When prompted for credentials, login as root

8) After the printer is added, go to the Administration tab and check "Share published printers connected to this system" and click on Change Settings. Now click on Manage Printers and print a test page to make sure everything is working. The test page will be created in the path you specified in Step 3
9) Now that you've successfully installed CUPS-PDF, we have to push the CUPS Windows drivers into Samba so that Windows clients will be able to add them by simply double-clicking on the printer. Download and install the CUPS Windows driver from the CUPS website

mkdir ~/tmp || cd ~/tmp
wget http://ftp.easysw.com/pub/cups/windows/cups-windows-6.0-source.tar.bz2
tar -xjvf cups-windows-6.0-source.tar.bz2 || cd cups-windows-6.0
sudo make install

to install the drivers into CUPS' data directory and then

cupsaddsmb -v -H localhost -U root &lt;printer name in Step 7&gt;

to export the drivers to Samba.
10) Now we need to make the output directory you specified in Step 3 to be available to the Windows clients via Samba. Paste the following into your /etc/samba/smb.conf

[PDF-Writer] <-- change this to the printer name you specified in Step 7
comment = PDF files
path = /home/common/PDF <-- change this to the path you specified in Step 3
browsable = yes
read only = yes
hide unreadable = yes
guest ok = no

restart Samba again

sudo /etc/init.d/samba restart


And we're done :)


Now to add the printer into other computers:
On Windows:
On the windows machine click on Start->Run->\<print server IP> and press Enter. If you don't see your printer here go to "Printers and Faxes" then double-click on the PDF printer we just added and it should install itself automatically. Now try to print something (like this page?) from Windows using the PDF printer to test it out.

On Linux:
(My wife uses Ubuntu on her notebook so if you're using a different distro the menus may vary)
Go to System->Administration->Printing->New to scan for new printers that are not installed on the system. If it doesn't find any, type in <print server's IP>:631 in the Host field and click on Find Queue. You should have something like

Host: <print server IP>:631
Queue: /printers/<printer name you specified in Step 7>
URI: ipp://<print server IP>:631/printers/<printer name you specified in Step 7>
Click on Forward. For consistency put in the printer name, description and location you specified in Step 7 and click Apply. Print a test page to make sure everything is working.

If it doesn't work for you then either you missed a step or I did. Feel free to point it out, comments below. Cheers!


Comments