Results 1 to 6 of 6

Thread: Nautilus Script: Image 2 PDF?

  1. #1
    Join Date
    Jan 2010
    Beans
    18

    Nautilus Script: Image 2 PDF?

    Hi,

    I'm looking for a script to convert multiple images into a single PDF file. That is, I have several PNGs on my Desktop and I'd like to select all of them and create a PDF file via right mouse click. Does anyone know where I can find such a script?

    Thanks in advance.

  2. #2
    Join Date
    Jan 2008
    Location
    Auckland, New Zealand
    Beans
    3,134
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Nautilus Script: Image 2 PDF?

    Install the imagemagick package then save a file containing this to ~/.gnome2/nautilus-scripts/CreatePDF

    Code:
    #!/bin/bash
    
    convert $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS Output.pdf
    Right click on that file and go to its properties and make it executable.

    Now you can create a PDF from the scripts menu.

  3. #3
    Join Date
    Jan 2006
    Location
    Waterloo, ON, Canada
    Beans
    212
    Distro
    Ubuntu 12.04 Precise Pangolin

    Question Re: Nautilus Script: Image 2 PDF?

    How to control the order of the pages though?

    I have 2x PNG files, and they're "foo.png" and "bar.png". I select foo, and then CTRL+click on bar, and bar always is the first page, but I want foo to be the first page.

    I also tried doing .. myImage1.png, and myImage2.png (thinking alpha sorting..) but still the last page comes first...
    ~Fermmy

  4. #4
    Join Date
    Jun 2008
    Location
    California
    Beans
    2,271
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Nautilus Script: Image 2 PDF?

    On my computer, user-selected files are processed by a Nautilus script in the order that they are shown in the right pane of the Nautilus file browser. This order can, of course, be changed by clicking on "Name" or "Size" or one of the other headers. The order in which the files are selected by the user appears to have no impact.

    If there is no other alternative, one option is to have the Nautilus script prompt the user for the desired sort order. The following is an example. This script is a bit cumbersome--perhaps another forum member will have a simpler solution.

    This script uses a zenity dialog, which I don't believe is installed by default. It's in the repo's and is small is size.

    Code:
    #!/bin/bash
    
    files=("$@")
    
    pages=$(zenity --entry --title "File order" --text "Enter space-separated numbers")
    
    for page in ${pages} ; do
      newfiles+=("${files[page-1]}")
    done
    
    convert "${newfiles[@]}" output.pdf
    Last edited by kaibob; April 24th, 2011 at 11:04 PM.

  5. #5
    Join Date
    Sep 2012
    Beans
    8

    Wink Re: Nautilus Script: Image 2 PDF?

    Quote Originally Posted by ad_267 View Post
    Install the imagemagick package then save a file containing this to ~/.gnome2/nautilus-scripts/CreatePDF

    Code:
    #!/bin/bash
    
    convert $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS Output.pdf
    Right click on that file and go to its properties and make it executable.

    Now you can create a PDF from the scripts menu.
    What would that script look like if I wanted that each selected file became an individual PDF? Like a batch comand.

    Thanks for the tip. Very good.

  6. #6
    Join Date
    Jul 2007
    Location
    Magic City of the Plains
    Beans
    Hidden!
    Distro
    Xubuntu 15.10 Wily Werewolf

    Re: Nautilus Script: Image 2 PDF?

    If a post is older than a year or so and hasn't had a new reply in that time, instead of replying to it, create a new thread. In the software world, a lot can change in a very short time, and doing things this way makes it more likely that you will find the best information. You may link to the original discussion in the new thread if you think it may be helpful.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •