QuickTip: Printing to PDF

I often find myself needing to print webpages, and one of the most convenient ways of doing so is to print them as PDF files. Now, as I’m sure you’ll be unsurprised to know, this is possible without too much effort on the EEE, but, you might like a bit of hand-holding whilst you set it up. So, I took mkrishnan’s guide on EEEuser.com, and added some of my own steps to prevent overwriting of previously-printed files. As such, if you want to be able to print to PDF, and have each output file assigned a unique prefix to the name so that you never need worry about accidentally overwriting existing documents, then this guide is for you…

1.) You will need a standard repository available for adept (your package manager), to allow you to install the necessary printing software. If you have not already done so, you can add extra repositories directly to the sources.list file. You can get the relevant software for this QuickTip from the default Xandros repository, so, what you’d need to do is:

sudo nano /etc/apt/sources.list

And add the following line:

deb http://http.us.debian.org/debian stable main

Then, save your changes (Ctl+O, then Enter), and exit (Ctl+X)

2.) Install cups-pdf from the repository

sudo apt-get install cups-pdf

3.) Now it’s installed, you need to configure it, so that it creates a virtual printer for you:

  • In FireFox, open http://localhost:631/
  • Select “Add printer”
  • Enter some text into each of the three fields. You can enter anything you wish- I’ve just used “cups-pdf”, as it seemed neat. Select “Continue”
  • From the drop-down list, select “Virtual Printer (PDF)”. Select “Continue”
  • From the drop-down list, select “Postscript”. Select “Continue”
  • You will only have one option on this screen, so, select it, and then select “Add Printer”

Now, you have installed a PDF printer- if you hit Ctl+P, you can print directly to PDF. The output file will be stored at /home/user/PDF. In order to change the settings to give each printout a unique identifier, you will need to edit the cups-pdf configuration file. If you wish to take a backup of the file first, which is good practice, type:

sudo cp /etc/cups/cups-pdf.conf /etc/cups/cups-pdf.conf.bak

Now, edit the configuration file:

sudo nano /etc/cups/cups-pdf.conf

Look for the setting “Label”

Uncomment it, and change its value to “1”, so that the line reads

Label 1

Save the changes (Ctl+O), then exit (Ctl+X)

You should not need to restart cups for the changes to take effect, but, if you want to:

sudo /etc/init.d/cupsys restart

In cups-pdf.conf, you can change output path etc if you should wish to do so.

Printing PDFs on your EEE… enjoy 🙂

Neil

11 Responses to QuickTip: Printing to PDF

  1. Jack says:

    At the ‘You will only have one option on this screen, so, select it, and then select “Add Printer”’ stage, on clicking continue, I got a pop-up Authorisation Request window, asking for the ‘username and password for “CUPS” at http://localhost:631/‘.

    Any idea what this should be? It’s not the administrator username/password for my machine.

  2. p1ip1i says:

    I would try “root” as your username, and then your machine’s password.

    Neil

  3. Steve says:

    Hi,

    When I input the following line:
    sudo apt-get install cups-pdf

    I get the following error message:
    Reading package lists… Done
    Building dependency tree … Done
    Package cups-pdf is not available but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or is only available from another source.
    W: Coudn’t stat source package list http://http.us.debian.org stable/main Packages
    (/var/lib/apt/lists/http.us.debian.org_debian_dists_stable_main_bineary-i386
    W; You may want to run apt-get update to correct these problems
    E: Package cups-pdf has no installation candidate

    Would appreciate any advice. Thanks!

  4. Carl Ranns says:

    I printed to pdf without installing anything. I think I went to printers and set up a generic postscript driver and printed to postscript (save to file in the printing dialog) then used ps2pdf to convert to pdf. What’s more you can use psmerge to join postscript files together before you convert to pdf. Both were installed by default on mine. Actually the KDE file manager includes a print to pdf function by default (if you use it to view jpg files for example) and the firefox web browser includes an option to print to postscript so you might not even have to set up a postscript driver.

  5. Carl says:

    You can do this without installing anything. Just print to postscript (set up a generic postscript printer if you have to for the app you want ot print from) and then use ps2pdf to convert to pdf and voila! What’s more you can join postscript files together with psmerge first and then convert to pdf. I’ve been doing it since I got mine.

  6. p1ip1i says:

    You have to admit, though, that simply hitting Ctl+P, and then “Print” is a more attractive option for most users, even if your solution does offer technical advantages?

    Neil

  7. qiu says:

    I have the same problem with Steve, getting ‘Package cups-pdf is not available but is referred to by another package.’. A solution will be very much appreciated.

  8. p1ip1i says:

    Are you using the standard Asus repositories, or have you added to the list in /etc/apt/sources.list ?

    Neil

  9. qiu says:

    Niel,

    I know the problem, I was log in as root, i need to type ‘sudo bash’ in the begining. Cheers mate.

  10. Neil says:

    Ah – excellent. Sorted 🙂

  11. Carlomejia says:

    Hello, how about just in original OPENOFFICE 2.0 FILE EXPORT TO PDF…

    so why bother

Leave a comment