Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Currently I open the file in document viewer and select print etc. Is it not possible to right click the file and "send to" the printer?

share|improve this question
    
What Ubuntu release are you using? –  Mitch Jul 31 '12 at 6:53
    
Ubuntu 12.04..... –  HeyPaul Jul 31 '12 at 11:03
add comment

2 Answers 2

Use lpr to print PDF files directly from the command-line

I don't think you can do that directly, no. However, there's a command line program called lpr which sends pdf files directly to the printer. So if you have doc.pdf, you should be able to print it with lpr doc.pdf (assuming you're in the right folder on the command line).

You can also view the printer queue with lpq - besides the queue, this shows which is the default printer, and what its status is...

See the other answer for how to add lpr to the right-click menu.

share|improve this answer
    
Thank you I should have remembered lpr from ages ago. –  HeyPaul Jul 31 '12 at 8:17
add comment

Add lpr to the right-click menu

I didn't know about 'lpr' that Steve mentioned about, but I know how to add it to your right click menu, using the Nautilus Scripts function of Nautilus.

Just copy and paste the below text to Gedit:

#!/bin/bash

IFS_BAK=$IFS
IFS="
"

for line in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS; do
   if [[ "$line" = "" || "$line" = " " ]]; then
      exit
   fi
   lpr "$line"
   sleep 1;
done

IFS=$IFS_BAK
IFS_BAK=

Save the file as 'Send to Printer' and then, right click on it->Properties->Permissions->Tick "Allow executing file as program"

Finally, move the file under ~/.gnome2/nautilus-scripts

Now, in every .pdf file you want, you can right click on it and choose Scripts->'Send to Printer'. The command 'lpr' that Steve mentioned about will execute to the file you have selected.

share|improve this answer
    
Thank you - that works perfectly. –  HeyPaul Jul 31 '12 at 8:17
    
Aaaargh - it doesn't work from windows shares! I print orders from a win98 program to pdf files. Then in ubuntu I print to paper. –  HeyPaul Jul 31 '12 at 8:33
    
Hm, that sounds logical, you should have mentioned that you wanted to work through windows shares, though :/ I don't know how nautilus scripts work through windows shares.... I will test it and post back. EDIT: I cannot currently test it but you could first download the pdfs from the network to your hard disk and then use the script... –  hakermania Jul 31 '12 at 8:35
    
Yes - but then I might as well just open them directly and print them!! –  HeyPaul Jul 31 '12 at 9:00
    
No, it is not the same. The failure is logical: The files are not in your PC, you can only see their filenames, how can your PC send them for printing? You can download all of them, select all of them and choose right-click->'Send to Printer' –  hakermania Jul 31 '12 at 9:20
add comment

Your Answer

 
discard

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.