Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On Ubuntu 12.10, I want to install cups-pdf. Using apt-get install cups-pdf works okay, but I want to install it in code source.

This is what I've tried:

  1. Download code from
  2. Build cups-pdf:

    gcc -o cups-pdf `cups-config --cflags` cups-pdf.c `cups-config --libs`
  3. Run the following:

    cp cups-pdf /usr/lib/cups/backend/
    cp ../extra/cups-pdf.conf /etc/cups
    cp ../extra/CUPS-PDF_opt.ppd  /usr/share/cups/model/CUPS-PDF_opt.ppd 
    lpadmin -p PDFprinter -E -v cups-pdf:/ -P /usr/share/cups/model/CUPS-PDF_opt.ppd 
    lpadmin -d PDFprinter
  4. Try to print a file to PDF:

    lp Hello.c 
  5. Nothing happened

share|improve this question
i fond answer [How_to_install_CUPS-PDF_OpenSolarisx86.pdf][1]. The pointer is : chmod 0700 /usr/lib/cups/backend/cups-pdf [1]: – kangear Jan 8 '14 at 7:30
Welcome to Ask Ubuntu! If you've found an answer that works, please write it up as an answer to your own question rather than as a comment. Also, it would be preferable to include the essential parts of the answer here, and provide the link for reference rather than just pasting a URL. – David Edwards Jan 8 '14 at 9:31
sorry, i can't write it up as an answer to my question for my responses. – kangear Jan 9 '14 at 1:32
up vote 0 down vote accepted

Ok. I presume there is a package ready for you that doesn't need to get build just running:

sudo apt-get install cups-pdf

The version of the package is 2.6.1. The same you are trying to build! If you still want to continue, lets check the instructions:

Edit src/cups-pdf.h if you do not like /etc/cups as location for your configuration files.

This probably is ok.

To compile CUPS-PDF, invoke gcc in the src/ directory:

gcc -O9 -s -lcups -o cups-pdf cups-pdf.c

Note: you will have to have the deveopment package for CUPS installed in order to build CUPS-PDF

You are not doing this correctly. You first need to install the CUPS development libraries:

sudo apt-get install libcups2-dev

Then compile it with the command above:

gcc -O9 -s -lcups -o cups-pdf cups-pdf.c
cups-pdf.c: In function ‘read_config_ppd’:
cups-pdf.c:289:3: warning: ‘ppdFirstOption’ is deprecated (declared at /usr/include/cups/ppd.h:431) [-Wdeprecated-declarations]
   option = ppdFirstOption(ppd_file);
cups-pdf.c:292:5: warning: ‘ppdNextOption’ is deprecated (declared at /usr/include/cups/ppd.h:433) [-Wdeprecated-declarations]
     option = ppdNextOption(ppd_file);

Those are build warnings, you can ignore them.

To install the binary, simply copy cups-pdf to the backend directory of CUPS (usually /usr/lib/cups/backend or /usr/lib64/...).

If you have a 64-bit system, the correct is /usr/lib64, if you have 32-bits the correct is /usr/lib.

Now copy extra/cups-pdf.conf to /etc/cups (or whatever location you selected in cups-pdf.h above). Here you can set all properties of CUPS-PDF at runtime without the need for restarting any services. (The defaults should work fine on most systems.)

This is OK.

If you want to use the color PostScript driver that comes with CUPS-PDF go to the extra/ subdirectory and copy CUPS-PDF_opt.ppd to your CUPS model directory (usually /usr/share/cups/model [ /Generic ] ). If you do not want to set any options via PPD (see section 3), use CUPS-PDF_noopt.ppd instead.

Ok too. Now, I cheated and installed the package instead and it worked. If it's not working for you it must be due Ubuntu/Debian patchs. Apply those patches and try again.

share|improve this answer
thank you very much. – kangear Jan 9 '14 at 1:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.