How can I tell the lpr command (cups) that my file is actually a pdf?

lpr file.pdf

won't print anything.

  • Can you post any error messages from cups? Printing a file with lpr should create a print job. You can check the status of that (including error messages) in cups' web interface.
    – Wieland
    Commented Dec 24, 2011 at 20:52
  • 2
    This should work automatically. What is your printer and printer driver? Go and look at localhost:631 as Wieland suggests. There are also logs at /var/log/cups. See for example if there are errors in error_log. Commented Dec 24, 2011 at 22:49

3 Answers 3


There are at least two ways to convert and print a PDF file .

The first way is to view the file in xpdf (the PDF file viewer), and then left-click the printer icon. This won't actually send the file to the printer, but it writes a PostScript file in the same directory, with the same base file name as the PDF file but with a .ps extension. You can then print this file with lpr or convert it to another format.

The second way is to use pdf2ps, part of the gs package, to convert the PDF file to PostScript (then print the PostScript output as described for xpdf above). pdf2ps takes two arguments: the name of the PDF file to convert, and the name of the PostScript file to write to.

To convert the PDF file `pricelist.pdf', type:

$ pdf2ps pricelist.pdf pricelist.ps 

This command writes a PostScript file pricelist.ps in the current directory.

  • lpr is actually able to print pdf files without converting them to postscript first.
    – Wieland
    Commented Dec 25, 2011 at 0:09
  • 1
    @WielandH.: Or if it converts them to postscript, it does so implicitly and silently. Commented Dec 25, 2011 at 0:13

I have had similar troubles trying to print pdf files on a canon inkjet printer using the default viewer application in Mint 17. I know little about cups printing, but for what it's worth this is how I finally got it all working: 1 - I did a distribution update by installing Mint 17.2, not sure if this was a factor in my eventual success. 2 - I installed the correct printer driver using an on-line search (Canon MX410). 3 - I now ensure the printer is turned ON before booting Linux so that the correct printer driver is loaded.

Admittedly, it's all rather unsatisfactory not diagnosing the original problem, but at least I'm happily printing away normally now!


What I do to print PDF directly in command line (cli) from this bash script:


model=XXX # partial match
dev=$(lpstat -a | awk -v m="$model" '$1 ~ m{print $1;exit}')

if [[ -z $1 ]]; then
    echo >&2 "Require PDF file as argument"
    exit 1

exec lpr -P $dev -o Resolution=150dpi -o OptionDuplex=False -o PageSize=A4 -o PageRegion=A4 -o Duplex=None -o InputSlot=Auto -o MediaType=Plain -o ColorModel=Gray "$@"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .