Printing multiple files from Nautilus
I just added a right-click menu option that allows you to select multiple files, select Script → pdf-printer.sh and it'll create PDF files. If you choose another printer name in the script, it should use that instead, but I can't verify that. Older how-tos might not work because we've moved to GNOME 3 which has a few changes. In this case, scripts have been moved from ~/.gnome2/nautilus-scripts
to ~/.local/share/nautilus/scripts
. Otherwise, everything should work as you would expect.
-
Install http://apt.ubuntu.com/p/cups-pdf. This package provides a PDF printer that prints to the PDF folder in your home folder,
$HOME/PDF
. -
Open Nautilus and create a folder named
PDF
in yourhome
. -
Press Ctrl+H in Nautilus to show hidden files.
-
Open
~/.local/share/nautilus/scripts
. -
Create a new file and call it
pdf-printer.sh
. -
Paste the following:
#!/bin/bash # # pdf-printer.sh # # Print files from the right-click context menu in Nautilus. # Place this script in ~/.local/share/nautilus/scripts. # The printer to use (as shown in the Printer Configuration # gui or in /etc/cups/printers.conf). printer=PDF echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | while read file do lpr -P "$printer" "$file" done exit 0
-
Save the file and close it.
-
right-click the file and choose Properties → Permissions. Make sure the box is checked to allow executing the file.
It is possible that you have to restart Nautilus for this to work. In that case, you can press Alt+F2 and enter r
. Should that not work, then you can press Alt+F2 and enter killall nautilus
or restart the system.
Other than that, you should now be able to select files, right-click and use the script from the Script menu.
Related videos on Youtube
Daniel
Updated on September 18, 2022Comments
-
Daniel almost 2 years
I tried to print multiple files. However not a single solution posted on the net works.
- I tried a right-click using Nautilus actions as described in multiple posts.
- Using the
lpr
command in the terminal and dragging files from Nautilus. Here print opens but files are held, and when the release button is pressed, the window closes without action. - With a script as posted here: Printing a file from the right-click context menu in Nautilus
The only method that works is combining pdf files in
pdfmod
to a new large file, saving it, and printing it. Not very elegant.Since no option for multiple works, could the community have a fresh look at right-click printing from Nautilus?
-
Jo-Erlend Schinstad almost 11 yearsCan you explain what it is that isn't working? I created a PDF printer just now and it works well, but I don't have a physical printer, so I can't test that.
-
Daniel almost 11 yearsTo clarify what i tried to do: I wanted to printout about 10 pdf documents in oder to stick them in an envelope and snail mail them. As it was a sunny day i wanted to get done fast and not open each and every document in evince and print from there. The above solved the problem. With 3 remarks: 1. the script needs to sit here /home/[usr name]/.gnome2/nautilus-scripts im my case 2. printing i.e odt to pdf folder didnt work 3. but if you use printer=[Printername] (which you will find in the "printing" gui) then all the documents will be sent directly to the printer. Thanks! Appreciate the help.
-
Daniel almost 11 yearsTusend takk og en hilsen til Oslo! Daniel
-
Jo-Erlend Schinstad almost 11 yearsGlad to be of service. Please accept the answer so others can see that it was solved.
-
Jo-Erlend Schinstad over 2 yearsHaving received an upvote today, I was curious to see if it still worked on Ubuntu 21.10, many years later. It does! That's nice. Note to self: it was written on a Sunday.